diff options
author | Ali Ijaz Sheikh <ofrobots@google.com> | 2016-01-20 09:45:45 -0800 |
---|---|---|
committer | Ali Ijaz Sheikh <ofrobots@google.com> | 2016-01-21 16:53:58 -0800 |
commit | ef4170ea03a80b21b2d8a65ce432efaa370fe2fa (patch) | |
tree | e382b1b38b729cd8155b56b441c3a563914854a3 /deps/v8/src/debug | |
parent | 5f6dfab832979999d2f806fc1a2f1c11a25b0f35 (diff) | |
download | node-new-ef4170ea03a80b21b2d8a65ce432efaa370fe2fa.tar.gz |
deps: upgrade to V8 4.8.271.17
Pick up V8 4.8 branch-head. This branch brings in @@isConcatSpreadable,
@@toPrimitive and ToLength ES6 changes. For full details see:
http://v8project.blogspot.de/2015/11/v8-release-48.html
https://github.com/v8/v8/commit/fa163e2
Ref: https://github.com/nodejs/node/pull/4399
PR-URL: https://github.com/nodejs/node/pull/4785
Reviewed-By: bnoordhuis - Ben Noordhuis <info@bnoordhuis.nl>
Diffstat (limited to 'deps/v8/src/debug')
-rw-r--r-- | deps/v8/src/debug/debug-frames.cc | 2 | ||||
-rw-r--r-- | deps/v8/src/debug/debug-scopes.cc | 19 | ||||
-rw-r--r-- | deps/v8/src/debug/debug-scopes.h | 3 | ||||
-rw-r--r-- | deps/v8/src/debug/debug.cc | 60 | ||||
-rw-r--r-- | deps/v8/src/debug/debug.h | 38 | ||||
-rw-r--r-- | deps/v8/src/debug/debug.js | 68 | ||||
-rw-r--r-- | deps/v8/src/debug/liveedit.cc | 10 | ||||
-rw-r--r-- | deps/v8/src/debug/liveedit.h | 3 | ||||
-rw-r--r-- | deps/v8/src/debug/mirrors.js | 96 |
9 files changed, 187 insertions, 112 deletions
diff --git a/deps/v8/src/debug/debug-frames.cc b/deps/v8/src/debug/debug-frames.cc index c4c288148c..ad54247417 100644 --- a/deps/v8/src/debug/debug-frames.cc +++ b/deps/v8/src/debug/debug-frames.cc @@ -206,7 +206,7 @@ int DebugFrameHelper::FindIndexedNonNativeFrame(JavaScriptFrameIterator* it, it->frame()->Summarize(&frames); for (int i = frames.length() - 1; i >= 0; i--) { // Omit functions from native and extension scripts. - if (!frames[i].function()->IsSubjectToDebugging()) continue; + if (!frames[i].function()->shared()->IsSubjectToDebugging()) continue; if (++count == index) return i; } } diff --git a/deps/v8/src/debug/debug-scopes.cc b/deps/v8/src/debug/debug-scopes.cc index e8ef240393..99d96404d1 100644 --- a/deps/v8/src/debug/debug-scopes.cc +++ b/deps/v8/src/debug/debug-scopes.cc @@ -75,8 +75,7 @@ ScopeIterator::ScopeIterator(Isolate* isolate, FrameInspector* frame_inspector, context_ = Handle<Context>(context_->previous(), isolate_); } } - if (scope_info->scope_type() == FUNCTION_SCOPE || - scope_info->scope_type() == ARROW_SCOPE) { + if (scope_info->scope_type() == FUNCTION_SCOPE) { nested_scope_chain_.Add(scope_info); } } else { @@ -86,8 +85,7 @@ ScopeIterator::ScopeIterator(Isolate* isolate, FrameInspector* frame_inspector, // Check whether we are in global, eval or function code. Zone zone; - if (scope_info->scope_type() != FUNCTION_SCOPE && - scope_info->scope_type() != ARROW_SCOPE) { + if (scope_info->scope_type() != FUNCTION_SCOPE) { // Global or eval code. ParseInfo info(&zone, script); if (scope_info->scope_type() == SCRIPT_SCOPE) { @@ -119,7 +117,7 @@ ScopeIterator::ScopeIterator(Isolate* isolate, Handle<JSFunction> function) context_(function->context()), seen_script_scope_(false), failed_(false) { - if (!function->IsSubjectToDebugging()) context_ = Handle<Context>(); + if (!function->shared()->IsSubjectToDebugging()) context_ = Handle<Context>(); } @@ -132,6 +130,12 @@ MUST_USE_RESULT MaybeHandle<JSObject> ScopeIterator::MaterializeScopeDetails() { Handle<JSObject> scope_object; ASSIGN_RETURN_ON_EXCEPTION(isolate_, scope_object, ScopeObject(), JSObject); details->set(kScopeDetailsObjectIndex, *scope_object); + if (HasContext() && CurrentContext()->closure() != NULL) { + Handle<String> closure_name = JSFunction::GetDebugName( + Handle<JSFunction>(CurrentContext()->closure())); + if (!closure_name.is_null() && (closure_name->length() != 0)) + details->set(kScopeDetailsNameIndex, *closure_name); + } return isolate_->factory()->NewJSArrayWithElements(details); } @@ -177,7 +181,6 @@ ScopeIterator::ScopeType ScopeIterator::Type() { Handle<ScopeInfo> scope_info = nested_scope_chain_.last(); switch (scope_info->scope_type()) { case FUNCTION_SCOPE: - case ARROW_SCOPE: DCHECK(context_->IsFunctionContext() || !scope_info->HasContext()); return ScopeTypeLocal; case MODULE_SCOPE: @@ -200,7 +203,7 @@ ScopeIterator::ScopeType ScopeIterator::Type() { } } if (context_->IsNativeContext()) { - DCHECK(context_->global_object()->IsGlobalObject()); + DCHECK(context_->global_object()->IsJSGlobalObject()); // If we are at the native context and have not yet seen script scope, // fake it. return seen_script_scope_ ? ScopeTypeGlobal : ScopeTypeScript; @@ -401,7 +404,7 @@ void ScopeIterator::RetrieveScopeChain(Scope* scope, MaybeHandle<JSObject> ScopeIterator::MaterializeScriptScope() { - Handle<GlobalObject> global(CurrentContext()->global_object()); + Handle<JSGlobalObject> global(CurrentContext()->global_object()); Handle<ScriptContextTable> script_contexts( global->native_context()->script_context_table()); diff --git a/deps/v8/src/debug/debug-scopes.h b/deps/v8/src/debug/debug-scopes.h index 20cd0336dc..6e5c459037 100644 --- a/deps/v8/src/debug/debug-scopes.h +++ b/deps/v8/src/debug/debug-scopes.h @@ -30,7 +30,8 @@ class ScopeIterator { static const int kScopeDetailsTypeIndex = 0; static const int kScopeDetailsObjectIndex = 1; - static const int kScopeDetailsSize = 2; + static const int kScopeDetailsNameIndex = 2; + static const int kScopeDetailsSize = 3; ScopeIterator(Isolate* isolate, FrameInspector* frame_inspector, bool ignore_nested_scopes = false); diff --git a/deps/v8/src/debug/debug.cc b/deps/v8/src/debug/debug.cc index 4f23555d28..e41c508f44 100644 --- a/deps/v8/src/debug/debug.cc +++ b/deps/v8/src/debug/debug.cc @@ -38,10 +38,12 @@ Debug::Debug(Isolate* isolate) is_suppressed_(false), live_edit_enabled_(true), // TODO(yangguo): set to false by default. break_disabled_(false), + break_points_active_(true), in_debug_event_listener_(false), break_on_exception_(false), break_on_uncaught_exception_(false), debug_info_list_(NULL), + feature_tracker_(isolate), isolate_(isolate) { ThreadInit(); } @@ -315,6 +317,15 @@ Handle<Object> BreakLocation::BreakPointObjects() const { } +void DebugFeatureTracker::Track(DebugFeatureTracker::Feature feature) { + uint32_t mask = 1 << feature; + // Only count one sample per feature and isolate. + if (bitfield_ & mask) return; + isolate_->counters()->debug_feature_usage()->AddSample(feature); + bitfield_ |= mask; +} + + // Threading support. void Debug::ThreadInit() { thread_local_.break_count_ = 0; @@ -395,6 +406,9 @@ bool Debug::Load() { debug_context_ = Handle<Context>::cast( isolate_->global_handles()->Create(*context)); + + feature_tracker()->Track(DebugFeatureTracker::kActive); + return true; } @@ -457,7 +471,7 @@ void Debug::Break(Arguments args, JavaScriptFrame* frame) { // If there is one or more real break points check whether any of these are // triggered. Handle<Object> break_points_hit(heap->undefined_value(), isolate_); - if (break_location.HasBreakPoint()) { + if (break_points_active_ && break_location.HasBreakPoint()) { Handle<Object> break_point_objects = break_location.BreakPointObjects(); break_points_hit = CheckBreakPoints(break_point_objects); } @@ -574,7 +588,7 @@ MaybeHandle<Object> Debug::CallFunction(const char* name, int argc, Handle<JSFunction> fun = Handle<JSFunction>::cast( Object::GetProperty(isolate_, holder, name, STRICT).ToHandleChecked()); Handle<Object> undefined = isolate_->factory()->undefined_value(); - return Execution::TryCall(fun, undefined, argc, args); + return Execution::TryCall(isolate_, fun, undefined, argc, args); } @@ -624,6 +638,8 @@ bool Debug::SetBreakPoint(Handle<JSFunction> function, *source_position = location.statement_position(); location.SetBreakPoint(break_point_object); + feature_tracker()->Track(DebugFeatureTracker::kBreakPoint); + // At least one active break point now. return debug_info->GetBreakPointCount() > 0; } @@ -665,6 +681,8 @@ bool Debug::SetBreakPointForScript(Handle<Script> script, debug_info, ALL_BREAK_LOCATIONS, position, alignment); location.SetBreakPoint(break_point_object); + feature_tracker()->Track(DebugFeatureTracker::kBreakPoint); + position = (alignment == STATEMENT_ALIGNED) ? location.statement_position() : location.position(); @@ -746,9 +764,8 @@ void Debug::FloodWithOneShot(Handle<JSFunction> function, void Debug::FloodBoundFunctionWithOneShot(Handle<JSFunction> function) { - Handle<FixedArray> new_bindings(function->function_bindings()); - Handle<Object> bindee(new_bindings->get(JSFunction::kBoundFunctionIndex), - isolate_); + Handle<BindingsArray> new_bindings(function->function_bindings()); + Handle<Object> bindee(new_bindings->bound_function(), isolate_); if (!bindee.is_null() && bindee->IsJSFunction()) { Handle<JSFunction> bindee_function(JSFunction::cast(*bindee)); @@ -874,6 +891,8 @@ void Debug::PrepareStep(StepAction step_action, JavaScriptFrameIterator frames_it(isolate_, id); JavaScriptFrame* frame = frames_it.frame(); + feature_tracker()->Track(DebugFeatureTracker::kStepping); + // First of all ensure there is one-shot break points in the top handler // if any. FloodHandlerWithOneShot(); @@ -923,7 +942,7 @@ void Debug::PrepareStep(StepAction step_action, } // Skip native and extension functions on the stack. while (!frames_it.done() && - !frames_it.frame()->function()->IsSubjectToDebugging()) { + !frames_it.frame()->function()->shared()->IsSubjectToDebugging()) { frames_it.Advance(); } // Step out: If there is a JavaScript caller frame, we need to @@ -1305,8 +1324,16 @@ bool Debug::PrepareFunctionForBreakPoints(Handle<SharedFunctionInfo> shared) { List<Handle<JSFunction> > functions; List<Handle<JSGeneratorObject> > suspended_generators; - if (!shared->optimized_code_map()->IsSmi()) { - shared->ClearOptimizedCodeMap(); + // Flush all optimized code maps. Note that the below heap iteration does not + // cover this, because the given function might have been inlined into code + // for which no JSFunction exists. + { + SharedFunctionInfo::Iterator iterator(isolate_); + while (SharedFunctionInfo* shared = iterator.Next()) { + if (!shared->optimized_code_map()->IsSmi()) { + shared->ClearOptimizedCodeMap(); + } + } } // Make sure we abort incremental marking. @@ -1503,7 +1530,7 @@ bool Debug::EnsureDebugInfo(Handle<SharedFunctionInfo> shared, // Make sure IC state is clean. This is so that we correctly flood // accessor pairs when stepping in. shared->code()->ClearInlineCaches(); - shared->feedback_vector()->ClearICSlots(*shared); + shared->ClearTypeFeedbackInfo(); // Create the debug info object. DCHECK(shared->HasDebugCode()); @@ -1596,7 +1623,7 @@ void Debug::FramesHaveBeenDropped(StackFrame::Id new_break_frame_id, } -bool Debug::IsDebugGlobal(GlobalObject* global) { +bool Debug::IsDebugGlobal(JSGlobalObject* global) { return is_loaded() && global == debug_context()->global_object(); } @@ -1943,7 +1970,7 @@ void Debug::CallEventCallback(v8::DebugEvent event, event_data, event_listener_data_ }; Handle<JSReceiver> global(isolate_->global_proxy()); - Execution::TryCall(Handle<JSFunction>::cast(event_listener_), + Execution::TryCall(isolate_, Handle<JSFunction>::cast(event_listener_), global, arraysize(argv), argv); } in_debug_event_listener_ = previous; @@ -2089,7 +2116,7 @@ void Debug::NotifyMessageHandler(v8::DebugEvent event, Handle<String> answer; MaybeHandle<Object> maybe_exception; MaybeHandle<Object> maybe_result = - Execution::TryCall(process_debug_request, cmd_processor, 1, + Execution::TryCall(isolate_, process_debug_request, cmd_processor, 1, request_args, &maybe_exception); if (maybe_result.ToHandle(&answer_value)) { @@ -2208,7 +2235,7 @@ void Debug::EnqueueCommandMessage(Vector<const uint16_t> command, } -MaybeHandle<Object> Debug::Call(Handle<JSFunction> fun, Handle<Object> data) { +MaybeHandle<Object> Debug::Call(Handle<Object> fun, Handle<Object> data) { DebugScope debug_scope(this); if (debug_scope.failed()) return isolate_->factory()->undefined_value(); @@ -2244,8 +2271,9 @@ void Debug::HandleDebugBreak() { Object* fun = it.frame()->function(); if (fun && fun->IsJSFunction()) { // Don't stop in builtin functions. - if (!JSFunction::cast(fun)->IsSubjectToDebugging()) return; - GlobalObject* global = JSFunction::cast(fun)->context()->global_object(); + if (!JSFunction::cast(fun)->shared()->IsSubjectToDebugging()) return; + JSGlobalObject* global = + JSFunction::cast(fun)->context()->global_object(); // Don't stop in debugger functions. if (IsDebugGlobal(global)) return; } @@ -2419,7 +2447,7 @@ v8::Local<v8::String> MessageImpl::GetJSON() const { } MaybeHandle<Object> maybe_json = - Execution::TryCall(Handle<JSFunction>::cast(fun), event_data_, 0, NULL); + Execution::TryCall(isolate, fun, event_data_, 0, NULL); Handle<Object> json; if (!maybe_json.ToHandle(&json) || !json->IsString()) { return v8::Local<v8::String>(); diff --git a/deps/v8/src/debug/debug.h b/deps/v8/src/debug/debug.h index 640355a7e6..c24789d376 100644 --- a/deps/v8/src/debug/debug.h +++ b/deps/v8/src/debug/debug.h @@ -343,6 +343,28 @@ class LockingCommandMessageQueue BASE_EMBEDDED { }; +class DebugFeatureTracker { + public: + enum Feature { + kActive = 1, + kBreakPoint = 2, + kStepping = 3, + kHeapSnapshot = 4, + kAllocationTracking = 5, + kProfiler = 6, + kLiveEdit = 7, + }; + + explicit DebugFeatureTracker(Isolate* isolate) + : isolate_(isolate), bitfield_(0) {} + void Track(Feature feature); + + private: + Isolate* isolate_; + uint32_t bitfield_; +}; + + // This class contains the debugger support. The main purpose is to handle // setting break points in the code. // @@ -368,7 +390,7 @@ class Debug { void SetMessageHandler(v8::Debug::MessageHandler handler); void EnqueueCommandMessage(Vector<const uint16_t> command, v8::Debug::ClientData* client_data = NULL); - MUST_USE_RESULT MaybeHandle<Object> Call(Handle<JSFunction> fun, + MUST_USE_RESULT MaybeHandle<Object> Call(Handle<Object> fun, Handle<Object> data); Handle<Context> GetDebugContext(); void HandleDebugBreak(); @@ -441,7 +463,7 @@ class Debug { BreakPositionAlignment position_aligment); // Check whether a global object is the debug global object. - bool IsDebugGlobal(GlobalObject* global); + bool IsDebugGlobal(JSGlobalObject* global); // Check whether this frame is just about to return. bool IsBreakAtReturn(JavaScriptFrame* frame); @@ -482,7 +504,7 @@ class Debug { inline bool in_debug_scope() const { return !!base::NoBarrier_Load(&thread_local_.current_debug_scope_); } - void set_disable_break(bool v) { break_disabled_ = v; } + void set_break_points_active(bool v) { break_points_active_ = v; } StackFrame::Id break_frame_id() { return thread_local_.break_frame_id_; } int break_id() { return thread_local_.break_id_; } @@ -507,6 +529,8 @@ class Debug { StepAction last_step_action() { return thread_local_.last_step_action_; } + DebugFeatureTracker* feature_tracker() { return &feature_tracker_; } + private: explicit Debug(Isolate* isolate); @@ -592,8 +616,8 @@ class Debug { bool is_active_; bool is_suppressed_; bool live_edit_enabled_; - bool has_break_points_; bool break_disabled_; + bool break_points_active_; bool in_debug_event_listener_; bool break_on_exception_; bool break_on_uncaught_exception_; @@ -605,6 +629,9 @@ class Debug { // before returning to the DebugBreakCallHelper. Address after_break_target_; + // Used to collect histogram data on debugger feature usage. + DebugFeatureTracker feature_tracker_; + // Per-thread data. class ThreadLocal { public: @@ -763,6 +790,7 @@ class DebugCodegen : public AllStatic { }; -} } // namespace v8::internal +} // namespace internal +} // namespace v8 #endif // V8_DEBUG_DEBUG_H_ diff --git a/deps/v8/src/debug/debug.js b/deps/v8/src/debug/debug.js index 2e51d43088..50bd0a9c06 100644 --- a/deps/v8/src/debug/debug.js +++ b/deps/v8/src/debug/debug.js @@ -15,22 +15,20 @@ var IsNaN = global.isNaN; var JSONParse = global.JSON.parse; var JSONStringify = global.JSON.stringify; var LookupMirror = global.LookupMirror; +var MakeError; +var MakeTypeError; var MakeMirror = global.MakeMirror; var MakeMirrorSerializer = global.MakeMirrorSerializer; var MathMin = global.Math.min; var Mirror = global.Mirror; var MirrorType; var ParseInt = global.parseInt; -var ToBoolean; -var ToNumber; -var ToString; var ValueMirror = global.ValueMirror; utils.Import(function(from) { + MakeError = from.MakeError; + MakeTypeError = from.MakeTypeError; MirrorType = from.MirrorType; - ToBoolean = from.ToBoolean; - ToNumber = from.ToNumber; - ToString = from.ToString; }); //---------------------------------------------------------------------------- @@ -106,7 +104,7 @@ var debugger_flags = { getValue: function() { return this.value; }, setValue: function(value) { this.value = !!value; - %SetDisableBreak(!this.value); + %SetBreakPointsActive(this.value); } }, breakOnCaughtException: { @@ -234,7 +232,7 @@ BreakPoint.prototype.isTriggered = function(exec_state) { try { var mirror = exec_state.frame(0).evaluate(this.condition()); // If no sensible mirror or non true value break point not triggered. - if (!(mirror instanceof ValueMirror) || !ToBoolean(mirror.value_)) { + if (!(mirror instanceof ValueMirror) || !mirror.value_) { return false; } } catch (e) { @@ -950,8 +948,8 @@ function ExecutionState(break_id) { ExecutionState.prototype.prepareStep = function(opt_action, opt_count, opt_callframe) { var action = Debug.StepAction.StepIn; - if (!IS_UNDEFINED(opt_action)) action = ToNumber(opt_action); - var count = opt_count ? ToNumber(opt_count) : 1; + if (!IS_UNDEFINED(opt_action)) action = TO_NUMBER(opt_action); + var count = opt_count ? TO_NUMBER(opt_count) : 1; var callFrameId = 0; if (!IS_UNDEFINED(opt_callframe)) { callFrameId = opt_callframe.details_.frameId(); @@ -963,7 +961,7 @@ ExecutionState.prototype.prepareStep = function(opt_action, opt_count, ExecutionState.prototype.evaluateGlobal = function(source, disable_break, opt_additional_context) { return MakeMirror(%DebugEvaluateGlobal(this.break_id, source, - ToBoolean(disable_break), + TO_BOOLEAN(disable_break), opt_additional_context)); }; @@ -985,7 +983,7 @@ ExecutionState.prototype.frame = function(opt_index) { }; ExecutionState.prototype.setSelectedFrame = function(index) { - var i = ToNumber(index); + var i = TO_NUMBER(index); if (i < 0 || i >= this.frameCount()) { throw MakeTypeError(kDebuggerFrame); } @@ -1421,7 +1419,7 @@ DebugCommandProcessor.prototype.processDebugJSONRequest = function( var key = request.command.toLowerCase(); var handler = DebugCommandProcessor.prototype.dispatch_[key]; if (IS_FUNCTION(handler)) { - %_CallFunction(this, request, response, handler); + %_Call(handler, this, request, response); } else { throw MakeError(kDebugger, 'Unknown command "' + request.command + '" in request'); @@ -1432,7 +1430,7 @@ DebugCommandProcessor.prototype.processDebugJSONRequest = function( response = this.createResponse(); } response.success = false; - response.message = ToString(e); + response.message = TO_STRING(e); } // Return the response as a JSON encoded string. @@ -1449,7 +1447,7 @@ DebugCommandProcessor.prototype.processDebugJSONRequest = function( '"request_seq":' + request.seq + ',' + '"type":"response",' + '"success":false,' + - '"message":"Internal error: ' + ToString(e) + '"}'; + '"message":"Internal error: ' + TO_STRING(e) + '"}'; } } catch (e) { // Failed in one of the catch blocks above - most generic error. @@ -1470,7 +1468,7 @@ DebugCommandProcessor.prototype.continueRequest_ = function(request, response) { // Get the stepcount argument if any. if (stepcount) { - count = ToNumber(stepcount); + count = TO_NUMBER(stepcount); if (count < 0) { throw MakeError(kDebugger, 'Invalid stepcount argument "' + stepcount + '".'); @@ -1545,7 +1543,7 @@ DebugCommandProcessor.prototype.setBreakPointRequest_ = // Find the function through a global evaluate. f = this.exec_state_.evaluateGlobal(target).value(); } catch (e) { - response.failed('Error: "' + ToString(e) + + response.failed('Error: "' + TO_STRING(e) + '" evaluating "' + target + '"'); return; } @@ -1634,7 +1632,7 @@ DebugCommandProcessor.prototype.changeBreakPointRequest_ = function( } // Pull out arguments. - var break_point = ToNumber(request.arguments.breakpoint); + var break_point = TO_NUMBER(request.arguments.breakpoint); var enabled = request.arguments.enabled; var condition = request.arguments.condition; var ignoreCount = request.arguments.ignoreCount; @@ -1710,7 +1708,7 @@ DebugCommandProcessor.prototype.clearBreakPointRequest_ = function( } // Pull out arguments. - var break_point = ToNumber(request.arguments.breakpoint); + var break_point = TO_NUMBER(request.arguments.breakpoint); // Check for legal arguments. if (!break_point) { @@ -1968,7 +1966,7 @@ DebugCommandProcessor.prototype.scopeRequest_ = function(request, response) { // With no scope argument just return top scope. var scope_index = 0; if (request.arguments && !IS_UNDEFINED(request.arguments.number)) { - scope_index = ToNumber(request.arguments.number); + scope_index = TO_NUMBER(request.arguments.number); if (scope_index < 0 || scope_holder.scopeCount() <= scope_index) { return response.failed('Invalid scope number'); } @@ -1992,11 +1990,11 @@ DebugCommandProcessor.resolveValue_ = function(value_description) { return value_mirror.value(); } else if ("stringDescription" in value_description) { if (value_description.type == MirrorType.BOOLEAN_TYPE) { - return ToBoolean(value_description.stringDescription); + return TO_BOOLEAN(value_description.stringDescription); } else if (value_description.type == MirrorType.NUMBER_TYPE) { - return ToNumber(value_description.stringDescription); + return TO_NUMBER(value_description.stringDescription); } if (value_description.type == MirrorType.STRING_TYPE) { - return ToString(value_description.stringDescription); + return TO_STRING(value_description.stringDescription); } else { throw MakeError(kDebugger, "Unknown type"); } @@ -2032,7 +2030,7 @@ DebugCommandProcessor.prototype.setVariableValueRequest_ = if (IS_UNDEFINED(scope_description.number)) { response.failed('Missing scope number'); } - var scope_index = ToNumber(scope_description.number); + var scope_index = TO_NUMBER(scope_description.number); var scope = scope_holder.scope(scope_index); @@ -2064,7 +2062,7 @@ DebugCommandProcessor.prototype.evaluateRequest_ = function(request, response) { // The expression argument could be an integer so we convert it to a // string. try { - expression = ToString(expression); + expression = TO_STRING(expression); } catch(e) { return response.failed('Failed to convert expression argument to string'); } @@ -2094,7 +2092,7 @@ DebugCommandProcessor.prototype.evaluateRequest_ = function(request, response) { if (global) { // Evaluate in the native context. response.body = this.exec_state_.evaluateGlobal( - expression, ToBoolean(disable_break), additional_context_object); + expression, TO_BOOLEAN(disable_break), additional_context_object); return; } @@ -2110,18 +2108,18 @@ DebugCommandProcessor.prototype.evaluateRequest_ = function(request, response) { // Check whether a frame was specified. if (!IS_UNDEFINED(frame)) { - var frame_number = ToNumber(frame); + var frame_number = TO_NUMBER(frame); if (frame_number < 0 || frame_number >= this.exec_state_.frameCount()) { return response.failed('Invalid frame "' + frame + '"'); } // Evaluate in the specified frame. response.body = this.exec_state_.frame(frame_number).evaluate( - expression, ToBoolean(disable_break), additional_context_object); + expression, TO_BOOLEAN(disable_break), additional_context_object); return; } else { // Evaluate in the selected frame. response.body = this.exec_state_.frame().evaluate( - expression, ToBoolean(disable_break), additional_context_object); + expression, TO_BOOLEAN(disable_break), additional_context_object); return; } }; @@ -2142,7 +2140,7 @@ DebugCommandProcessor.prototype.lookupRequest_ = function(request, response) { // Set 'includeSource' option for script lookup. if (!IS_UNDEFINED(request.arguments.includeSource)) { - var includeSource = ToBoolean(request.arguments.includeSource); + var includeSource = TO_BOOLEAN(request.arguments.includeSource); response.setOption('includeSource', includeSource); } @@ -2210,7 +2208,7 @@ DebugCommandProcessor.prototype.sourceRequest_ = function(request, response) { to_line = request.arguments.toLine; if (!IS_UNDEFINED(request.arguments.frame)) { - var frame_number = ToNumber(request.arguments.frame); + var frame_number = TO_NUMBER(request.arguments.frame); if (frame_number < 0 || frame_number >= this.exec_state_.frameCount()) { return response.failed('Invalid frame "' + frame + '"'); } @@ -2246,7 +2244,7 @@ DebugCommandProcessor.prototype.scriptsRequest_ = function(request, response) { if (request.arguments) { // Pull out arguments. if (!IS_UNDEFINED(request.arguments.types)) { - types = ToNumber(request.arguments.types); + types = TO_NUMBER(request.arguments.types); if (IsNaN(types) || types < 0) { return response.failed('Invalid types "' + request.arguments.types + '"'); @@ -2254,7 +2252,7 @@ DebugCommandProcessor.prototype.scriptsRequest_ = function(request, response) { } if (!IS_UNDEFINED(request.arguments.includeSource)) { - includeSource = ToBoolean(request.arguments.includeSource); + includeSource = TO_BOOLEAN(request.arguments.includeSource); response.setOption('includeSource', includeSource); } @@ -2269,7 +2267,7 @@ DebugCommandProcessor.prototype.scriptsRequest_ = function(request, response) { var filterStr = null; var filterNum = null; if (!IS_UNDEFINED(request.arguments.filter)) { - var num = ToNumber(request.arguments.filter); + var num = TO_NUMBER(request.arguments.filter); if (!IsNaN(num)) { filterNum = num; } @@ -2405,7 +2403,7 @@ DebugCommandProcessor.prototype.restartFrameRequest_ = function( var frame_mirror; // Check whether a frame was specified. if (!IS_UNDEFINED(frame)) { - var frame_number = ToNumber(frame); + var frame_number = TO_NUMBER(frame); if (frame_number < 0 || frame_number >= this.exec_state_.frameCount()) { return response.failed('Invalid frame "' + frame + '"'); } diff --git a/deps/v8/src/debug/liveedit.cc b/deps/v8/src/debug/liveedit.cc index 8a936ac177..7e991b62bc 100644 --- a/deps/v8/src/debug/liveedit.cc +++ b/deps/v8/src/debug/liveedit.cc @@ -910,7 +910,7 @@ class ReplacingVisitor : public ObjectVisitor { : original_(original), substitution_(substitution) { } - virtual void VisitPointers(Object** start, Object** end) { + void VisitPointers(Object** start, Object** end) override { for (Object** p = start; p < end; p++) { if (*p == original_) { *p = substitution_; @@ -918,14 +918,14 @@ class ReplacingVisitor : public ObjectVisitor { } } - virtual void VisitCodeEntry(Address entry) { + void VisitCodeEntry(Address entry) override { if (Code::GetObjectFromEntryAddress(entry) == original_) { Address substitution_entry = substitution_->instruction_start(); Memory::Address_at(entry) = substitution_entry; } } - virtual void VisitCodeTarget(RelocInfo* rinfo) { + void VisitCodeTarget(RelocInfo* rinfo) override { if (RelocInfo::IsCodeTarget(rinfo->rmode()) && Code::GetCodeFromTargetAddress(rinfo->target_address()) == original_) { Address substitution_entry = substitution_->instruction_start(); @@ -933,9 +933,7 @@ class ReplacingVisitor : public ObjectVisitor { } } - virtual void VisitDebugTarget(RelocInfo* rinfo) { - VisitCodeTarget(rinfo); - } + void VisitDebugTarget(RelocInfo* rinfo) override { VisitCodeTarget(rinfo); } private: Code* original_; diff --git a/deps/v8/src/debug/liveedit.h b/deps/v8/src/debug/liveedit.h index 251368f0cb..29fe60579f 100644 --- a/deps/v8/src/debug/liveedit.h +++ b/deps/v8/src/debug/liveedit.h @@ -364,6 +364,7 @@ class SharedInfoWrapper : public JSArrayBasedStruct<SharedInfoWrapper> { friend class JSArrayBasedStruct<SharedInfoWrapper>; }; -} } // namespace v8::internal +} // namespace internal +} // namespace v8 #endif /* V8_DEBUG_LIVEEDIT_H_ */ diff --git a/deps/v8/src/debug/mirrors.js b/deps/v8/src/debug/mirrors.js index 11f9e485c1..5ff3e34955 100644 --- a/deps/v8/src/debug/mirrors.js +++ b/deps/v8/src/debug/mirrors.js @@ -8,22 +8,30 @@ // ---------------------------------------------------------------------------- // Imports +var ErrorToString; var FunctionSourceString; var GlobalArray = global.Array; var IsNaN = global.isNaN; var JSONStringify = global.JSON.stringify; +var MakeError; +var MapEntries; +var MapIteratorNext; var MathMin = global.Math.min; var promiseStatusSymbol = utils.ImportNow("promise_status_symbol"); var promiseValueSymbol = utils.ImportNow("promise_value_symbol"); +var SetIteratorNext; +var SetValues; var SymbolToString; -var ToBoolean; -var ToString; utils.Import(function(from) { + ErrorToString = from.ErrorToString; FunctionSourceString = from.FunctionSourceString; + MakeError = from.MakeError; + MapEntries = from.MapEntries; + MapIteratorNext = from.MapIteratorNext; + SetIteratorNext = from.SetIteratorNext; + SetValues = from.SetValues; SymbolToString = from.SymbolToString; - ToBoolean = from.ToBoolean; - ToString = from.ToString; }); // ---------------------------------------------------------------------------- @@ -536,7 +544,7 @@ Mirror.prototype.toText = function() { * @extends Mirror */ function ValueMirror(type, value, transient) { - %_CallFunction(this, type, Mirror); + %_Call(Mirror, this, type); this.value_ = value; if (!transient) { this.allocateHandle_(); @@ -582,7 +590,7 @@ ValueMirror.prototype.value = function() { * @extends ValueMirror */ function UndefinedMirror() { - %_CallFunction(this, MirrorType.UNDEFINED_TYPE, UNDEFINED, ValueMirror); + %_Call(ValueMirror, this, MirrorType.UNDEFINED_TYPE, UNDEFINED); } inherits(UndefinedMirror, ValueMirror); @@ -598,7 +606,7 @@ UndefinedMirror.prototype.toText = function() { * @extends ValueMirror */ function NullMirror() { - %_CallFunction(this, MirrorType.NULL_TYPE, null, ValueMirror); + %_Call(ValueMirror, this, MirrorType.NULL_TYPE, null); } inherits(NullMirror, ValueMirror); @@ -615,7 +623,7 @@ NullMirror.prototype.toText = function() { * @extends ValueMirror */ function BooleanMirror(value) { - %_CallFunction(this, MirrorType.BOOLEAN_TYPE, value, ValueMirror); + %_Call(ValueMirror, this, MirrorType.BOOLEAN_TYPE, value); } inherits(BooleanMirror, ValueMirror); @@ -632,7 +640,7 @@ BooleanMirror.prototype.toText = function() { * @extends ValueMirror */ function NumberMirror(value) { - %_CallFunction(this, MirrorType.NUMBER_TYPE, value, ValueMirror); + %_Call(ValueMirror, this, MirrorType.NUMBER_TYPE, value); } inherits(NumberMirror, ValueMirror); @@ -649,7 +657,7 @@ NumberMirror.prototype.toText = function() { * @extends ValueMirror */ function StringMirror(value) { - %_CallFunction(this, MirrorType.STRING_TYPE, value, ValueMirror); + %_Call(ValueMirror, this, MirrorType.STRING_TYPE, value); } inherits(StringMirror, ValueMirror); @@ -678,7 +686,7 @@ StringMirror.prototype.toText = function() { * @extends Mirror */ function SymbolMirror(value) { - %_CallFunction(this, MirrorType.SYMBOL_TYPE, value, ValueMirror); + %_Call(ValueMirror, this, MirrorType.SYMBOL_TYPE, value); } inherits(SymbolMirror, ValueMirror); @@ -689,7 +697,7 @@ SymbolMirror.prototype.description = function() { SymbolMirror.prototype.toText = function() { - return %_CallFunction(this.value_, SymbolToString); + return %_Call(SymbolToString, this.value_); } @@ -703,7 +711,7 @@ SymbolMirror.prototype.toText = function() { */ function ObjectMirror(value, type, transient) { type = type || MirrorType.OBJECT_TYPE; - %_CallFunction(this, type, value, transient, ValueMirror); + %_Call(ValueMirror, this, type, value, transient); } inherits(ObjectMirror, ValueMirror); @@ -953,7 +961,7 @@ ObjectMirror.GetInternalProperties = function(value) { * @extends ObjectMirror */ function FunctionMirror(value) { - %_CallFunction(this, value, MirrorType.FUNCTION_TYPE, ObjectMirror); + %_Call(ObjectMirror, this, value, MirrorType.FUNCTION_TYPE); this.resolved_ = true; } inherits(FunctionMirror, ObjectMirror); @@ -1107,7 +1115,7 @@ FunctionMirror.prototype.toText = function() { function UnresolvedFunctionMirror(value) { // Construct this using the ValueMirror as an unresolved function is not a // real object but just a string. - %_CallFunction(this, MirrorType.FUNCTION_TYPE, value, ValueMirror); + %_Call(ValueMirror, this, MirrorType.FUNCTION_TYPE, value); this.propertyCount_ = 0; this.elementCount_ = 0; this.resolved_ = false; @@ -1157,7 +1165,7 @@ UnresolvedFunctionMirror.prototype.propertyNames = function(kind, limit) { * @extends ObjectMirror */ function ArrayMirror(value) { - %_CallFunction(this, value, ObjectMirror); + %_Call(ObjectMirror, this, value); } inherits(ArrayMirror, ObjectMirror); @@ -1174,7 +1182,7 @@ ArrayMirror.prototype.indexedPropertiesFromRange = function(opt_from_index, if (from_index > to_index) return new GlobalArray(); var values = new GlobalArray(to_index - from_index + 1); for (var i = from_index; i <= to_index; i++) { - var details = %DebugGetPropertyDetails(this.value_, ToString(i)); + var details = %DebugGetPropertyDetails(this.value_, TO_STRING(i)); var value; if (details) { value = new PropertyMirror(this, i, details); @@ -1194,7 +1202,7 @@ ArrayMirror.prototype.indexedPropertiesFromRange = function(opt_from_index, * @extends ObjectMirror */ function DateMirror(value) { - %_CallFunction(this, value, ObjectMirror); + %_Call(ObjectMirror, this, value); } inherits(DateMirror, ObjectMirror); @@ -1212,7 +1220,7 @@ DateMirror.prototype.toText = function() { * @extends ObjectMirror */ function RegExpMirror(value) { - %_CallFunction(this, value, MirrorType.REGEXP_TYPE, ObjectMirror); + %_Call(ObjectMirror, this, value, MirrorType.REGEXP_TYPE); } inherits(RegExpMirror, ObjectMirror); @@ -1284,7 +1292,7 @@ RegExpMirror.prototype.toText = function() { * @extends ObjectMirror */ function ErrorMirror(value) { - %_CallFunction(this, value, MirrorType.ERROR_TYPE, ObjectMirror); + %_Call(ObjectMirror, this, value, MirrorType.ERROR_TYPE); } inherits(ErrorMirror, ObjectMirror); @@ -1302,7 +1310,7 @@ ErrorMirror.prototype.toText = function() { // Use the same text representation as in messages.js. var text; try { - text = %_CallFunction(this.value_, builtins.$errorToString); + text = %_Call(ErrorToString, this.value_); } catch (e) { text = '#<Error>'; } @@ -1317,7 +1325,7 @@ ErrorMirror.prototype.toText = function() { * @extends ObjectMirror */ function PromiseMirror(value) { - %_CallFunction(this, value, MirrorType.PROMISE_TYPE, ObjectMirror); + %_Call(ObjectMirror, this, value, MirrorType.PROMISE_TYPE); } inherits(PromiseMirror, ObjectMirror); @@ -1346,7 +1354,7 @@ PromiseMirror.prototype.promiseValue = function() { function MapMirror(value) { - %_CallFunction(this, value, MirrorType.MAP_TYPE, ObjectMirror); + %_Call(ObjectMirror, this, value, MirrorType.MAP_TYPE); } inherits(MapMirror, ObjectMirror); @@ -1372,7 +1380,7 @@ MapMirror.prototype.entries = function(opt_limit) { return result; } - var iter = %_CallFunction(this.value_, builtins.$mapEntries); + var iter = %_Call(MapEntries, this.value_); var next; while ((!opt_limit || result.length < opt_limit) && !(next = iter.next()).done) { @@ -1386,7 +1394,7 @@ MapMirror.prototype.entries = function(opt_limit) { function SetMirror(value) { - %_CallFunction(this, value, MirrorType.SET_TYPE, ObjectMirror); + %_Call(ObjectMirror, this, value, MirrorType.SET_TYPE); } inherits(SetMirror, ObjectMirror); @@ -1395,7 +1403,7 @@ function IteratorGetValues_(iter, next_function, opt_limit) { var result = []; var next; while ((!opt_limit || result.length < opt_limit) && - !(next = %_CallFunction(iter, next_function)).done) { + !(next = %_Call(next_function, iter)).done) { result.push(next.value); } return result; @@ -1414,13 +1422,13 @@ SetMirror.prototype.values = function(opt_limit) { return %GetWeakSetValues(this.value_, opt_limit || 0); } - var iter = %_CallFunction(this.value_, builtins.$setValues); - return IteratorGetValues_(iter, builtins.$setIteratorNext, opt_limit); + var iter = %_Call(SetValues, this.value_); + return IteratorGetValues_(iter, SetIteratorNext, opt_limit); }; function IteratorMirror(value) { - %_CallFunction(this, value, MirrorType.ITERATOR_TYPE, ObjectMirror); + %_Call(ObjectMirror, this, value, MirrorType.ITERATOR_TYPE); } inherits(IteratorMirror, ObjectMirror); @@ -1435,11 +1443,11 @@ inherits(IteratorMirror, ObjectMirror); IteratorMirror.prototype.preview = function(opt_limit) { if (IS_MAP_ITERATOR(this.value_)) { return IteratorGetValues_(%MapIteratorClone(this.value_), - builtins.$mapIteratorNext, + MapIteratorNext, opt_limit); } else if (IS_SET_ITERATOR(this.value_)) { return IteratorGetValues_(%SetIteratorClone(this.value_), - builtins.$setIteratorNext, + SetIteratorNext, opt_limit); } }; @@ -1452,7 +1460,7 @@ IteratorMirror.prototype.preview = function(opt_limit) { * @extends Mirror */ function GeneratorMirror(value) { - %_CallFunction(this, value, MirrorType.GENERATOR_TYPE, ObjectMirror); + %_Call(ObjectMirror, this, value, MirrorType.GENERATOR_TYPE); } inherits(GeneratorMirror, ObjectMirror); @@ -1519,7 +1527,7 @@ GeneratorMirror.prototype.receiver = function() { * @extends Mirror */ function PropertyMirror(mirror, name, details) { - %_CallFunction(this, MirrorType.PROPERTY_TYPE, Mirror); + %_Call(Mirror, this, MirrorType.PROPERTY_TYPE); this.mirror_ = mirror; this.name_ = name; this.value_ = details[0]; @@ -1662,7 +1670,7 @@ PropertyMirror.prototype.isNative = function() { * @extends Mirror */ function InternalPropertyMirror(name, value) { - %_CallFunction(this, MirrorType.INTERNAL_PROPERTY_TYPE, Mirror); + %_Call(Mirror, this, MirrorType.INTERNAL_PROPERTY_TYPE); this.name_ = name; this.value_ = value; } @@ -1875,7 +1883,7 @@ FrameDetails.prototype.stepInPositionsImpl = function() { * @extends Mirror */ function FrameMirror(break_id, index) { - %_CallFunction(this, MirrorType.FRAME_TYPE, Mirror); + %_Call(Mirror, this, MirrorType.FRAME_TYPE); this.break_id_ = break_id; this.index_ = index; this.details_ = new FrameDetails(break_id, index); @@ -2074,7 +2082,7 @@ FrameMirror.prototype.evaluate = function(source, disable_break, this.details_.frameId(), this.details_.inlinedFrameIndex(), source, - ToBoolean(disable_break), + TO_BOOLEAN(disable_break), opt_context_object)); }; @@ -2233,8 +2241,10 @@ FrameMirror.prototype.toText = function(opt_locals) { }; +// This indexes correspond definitions in debug-scopes.h. var kScopeDetailsTypeIndex = 0; var kScopeDetailsObjectIndex = 1; +var kScopeDetailsNameIndex = 2; function ScopeDetails(frame, fun, index, opt_details) { if (frame) { @@ -2271,6 +2281,14 @@ ScopeDetails.prototype.object = function() { }; +ScopeDetails.prototype.name = function() { + if (!IS_UNDEFINED(this.break_id_)) { + %CheckExecutionState(this.break_id_); + } + return this.details_[kScopeDetailsNameIndex]; +}; + + ScopeDetails.prototype.setVariableValueImpl = function(name, new_value) { var raw_res; if (!IS_UNDEFINED(this.break_id_)) { @@ -2296,7 +2314,7 @@ ScopeDetails.prototype.setVariableValueImpl = function(name, new_value) { * @extends Mirror */ function ScopeMirror(frame, fun, index, opt_details) { - %_CallFunction(this, MirrorType.SCOPE_TYPE, Mirror); + %_Call(Mirror, this, MirrorType.SCOPE_TYPE); if (frame) { this.frame_index_ = frame.index_; } else { @@ -2351,7 +2369,7 @@ ScopeMirror.prototype.setVariableValue = function(name, new_value) { * @extends Mirror */ function ScriptMirror(script) { - %_CallFunction(this, MirrorType.SCRIPT_TYPE, Mirror); + %_Call(Mirror, this, MirrorType.SCRIPT_TYPE); this.script_ = script; this.context_ = new ContextMirror(script.context_data); this.allocateHandle_(); @@ -2472,7 +2490,7 @@ ScriptMirror.prototype.toText = function() { * @extends Mirror */ function ContextMirror(data) { - %_CallFunction(this, MirrorType.CONTEXT_TYPE, Mirror); + %_Call(Mirror, this, MirrorType.CONTEXT_TYPE); this.data_ = data; this.allocateHandle_(); } |