OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/runtime/runtime-utils.h" | 5 #include "src/runtime/runtime-utils.h" |
6 | 6 |
7 #include "src/arguments.h" | 7 #include "src/arguments.h" |
8 #include "src/debug/debug.h" | 8 #include "src/debug/debug.h" |
9 #include "src/debug/debug-evaluate.h" | 9 #include "src/debug/debug-evaluate.h" |
10 #include "src/debug/debug-frames.h" | 10 #include "src/debug/debug-frames.h" |
(...skipping 515 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
526 isolate); | 526 isolate); |
527 | 527 |
528 // Find source position in unoptimized code. | 528 // Find source position in unoptimized code. |
529 int position = frame_inspector.GetSourcePosition(); | 529 int position = frame_inspector.GetSourcePosition(); |
530 | 530 |
531 // Check for constructor frame. | 531 // Check for constructor frame. |
532 bool constructor = frame_inspector.IsConstructor(); | 532 bool constructor = frame_inspector.IsConstructor(); |
533 | 533 |
534 // Get scope info and read from it for local variable information. | 534 // Get scope info and read from it for local variable information. |
535 Handle<JSFunction> function(JSFunction::cast(frame_inspector.GetFunction())); | 535 Handle<JSFunction> function(JSFunction::cast(frame_inspector.GetFunction())); |
| 536 RUNTIME_ASSERT(function->IsSubjectToDebugging()); |
536 Handle<SharedFunctionInfo> shared(function->shared()); | 537 Handle<SharedFunctionInfo> shared(function->shared()); |
537 Handle<ScopeInfo> scope_info(shared->scope_info()); | 538 Handle<ScopeInfo> scope_info(shared->scope_info()); |
538 DCHECK(*scope_info != ScopeInfo::Empty(isolate)); | 539 DCHECK(*scope_info != ScopeInfo::Empty(isolate)); |
539 | 540 |
540 // Get the locals names and values into a temporary array. | 541 // Get the locals names and values into a temporary array. |
541 int local_count = scope_info->LocalCount(); | 542 int local_count = scope_info->LocalCount(); |
542 for (int slot = 0; slot < scope_info->LocalCount(); ++slot) { | 543 for (int slot = 0; slot < scope_info->LocalCount(); ++slot) { |
543 // Hide compiler-introduced temporary variables, whether on the stack or on | 544 // Hide compiler-introduced temporary variables, whether on the stack or on |
544 // the context. | 545 // the context. |
545 if (scope_info->LocalIsSynthetic(slot)) local_count--; | 546 if (scope_info->LocalIsSynthetic(slot)) local_count--; |
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
705 | 706 |
706 // Add the value being returned. | 707 // Add the value being returned. |
707 if (at_return) { | 708 if (at_return) { |
708 details->set(details_index++, *return_value); | 709 details->set(details_index++, *return_value); |
709 } | 710 } |
710 | 711 |
711 // Add the receiver (same as in function frame). | 712 // Add the receiver (same as in function frame). |
712 // THIS MUST BE DONE LAST SINCE WE MIGHT ADVANCE | 713 // THIS MUST BE DONE LAST SINCE WE MIGHT ADVANCE |
713 // THE FRAME ITERATOR TO WRAP THE RECEIVER. | 714 // THE FRAME ITERATOR TO WRAP THE RECEIVER. |
714 Handle<Object> receiver(it.frame()->receiver(), isolate); | 715 Handle<Object> receiver(it.frame()->receiver(), isolate); |
715 if (!receiver->IsJSObject() && is_sloppy(shared->language_mode()) && | 716 DCHECK(!function->IsBuiltin()); |
716 !function->IsBuiltin()) { | 717 if (!receiver->IsJSObject() && is_sloppy(shared->language_mode())) { |
717 // If the receiver is not a JSObject and the function is not a | 718 // If the receiver is not a JSObject and the function is not a |
718 // builtin or strict-mode we have hit an optimization where a | 719 // builtin or strict-mode we have hit an optimization where a |
719 // value object is not converted into a wrapped JS objects. To | 720 // value object is not converted into a wrapped JS objects. To |
720 // hide this optimization from the debugger, we wrap the receiver | 721 // hide this optimization from the debugger, we wrap the receiver |
721 // by creating correct wrapper object based on the calling frame's | 722 // by creating correct wrapper object based on the calling frame's |
722 // native context. | 723 // native context. |
723 it.Advance(); | 724 it.Advance(); |
724 if (receiver->IsUndefined()) { | 725 if (receiver->IsUndefined()) { |
725 receiver = handle(function->global_proxy()); | 726 receiver = handle(function->global_proxy()); |
726 } else { | 727 } else { |
(...skipping 903 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1630 Debug* debug = isolate->debug(); | 1631 Debug* debug = isolate->debug(); |
1631 if (!debug->is_active() || !debug->IsStepping() || | 1632 if (!debug->is_active() || !debug->IsStepping() || |
1632 debug->last_step_action() != StepIn) { | 1633 debug->last_step_action() != StepIn) { |
1633 return isolate->heap()->false_value(); | 1634 return isolate->heap()->false_value(); |
1634 } | 1635 } |
1635 CONVERT_ARG_CHECKED(Object, callback, 0); | 1636 CONVERT_ARG_CHECKED(Object, callback, 0); |
1636 // We do not step into the callback if it's a builtin other than a bound, | 1637 // We do not step into the callback if it's a builtin other than a bound, |
1637 // or not even a function. | 1638 // or not even a function. |
1638 return isolate->heap()->ToBoolean( | 1639 return isolate->heap()->ToBoolean( |
1639 callback->IsJSFunction() && | 1640 callback->IsJSFunction() && |
1640 (!JSFunction::cast(callback)->IsBuiltin() || | 1641 (JSFunction::cast(callback)->IsSubjectToDebugging() || |
1641 JSFunction::cast(callback)->shared()->bound())); | 1642 JSFunction::cast(callback)->shared()->bound())); |
1642 } | 1643 } |
1643 | 1644 |
1644 | 1645 |
1645 // Set one shot breakpoints for the callback function that is passed to a | 1646 // Set one shot breakpoints for the callback function that is passed to a |
1646 // built-in function such as Array.forEach to enable stepping into the callback. | 1647 // built-in function such as Array.forEach to enable stepping into the callback. |
1647 RUNTIME_FUNCTION(Runtime_DebugPrepareStepInIfStepping) { | 1648 RUNTIME_FUNCTION(Runtime_DebugPrepareStepInIfStepping) { |
1648 DCHECK(args.length() == 1); | 1649 DCHECK(args.length() == 1); |
1649 RUNTIME_ASSERT(isolate->debug()->is_active()); | 1650 RUNTIME_ASSERT(isolate->debug()->is_active()); |
1650 | 1651 |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1722 return *isolate->factory()->undefined_value(); | 1723 return *isolate->factory()->undefined_value(); |
1723 } | 1724 } |
1724 | 1725 |
1725 | 1726 |
1726 RUNTIME_FUNCTION(Runtime_DebugBreakInOptimizedCode) { | 1727 RUNTIME_FUNCTION(Runtime_DebugBreakInOptimizedCode) { |
1727 UNIMPLEMENTED(); | 1728 UNIMPLEMENTED(); |
1728 return NULL; | 1729 return NULL; |
1729 } | 1730 } |
1730 } // namespace internal | 1731 } // namespace internal |
1731 } // namespace v8 | 1732 } // namespace v8 |
OLD | NEW |