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 722 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
733 // Count the visible scopes. | 733 // Count the visible scopes. |
734 int n = 0; | 734 int n = 0; |
735 for (ScopeIterator it(isolate, &frame_inspector); !it.Done(); it.Next()) { | 735 for (ScopeIterator it(isolate, &frame_inspector); !it.Done(); it.Next()) { |
736 n++; | 736 n++; |
737 } | 737 } |
738 | 738 |
739 return Smi::FromInt(n); | 739 return Smi::FromInt(n); |
740 } | 740 } |
741 | 741 |
742 | 742 |
743 // Returns the list of step-in positions (text offset) in a function of the | |
744 // stack frame in a range from the current debug break position to the end | |
745 // of the corresponding statement. | |
746 RUNTIME_FUNCTION(Runtime_GetStepInPositions) { | |
747 HandleScope scope(isolate); | |
748 DCHECK(args.length() == 2); | |
749 CONVERT_NUMBER_CHECKED(int, break_id, Int32, args[0]); | |
750 RUNTIME_ASSERT(isolate->debug()->CheckExecutionState(break_id)); | |
751 | |
752 CONVERT_SMI_ARG_CHECKED(wrapped_id, 1); | |
753 | |
754 // Get the frame where the debugging is performed. | |
755 StackFrame::Id id = DebugFrameHelper::UnwrapFrameId(wrapped_id); | |
756 JavaScriptFrameIterator frame_it(isolate, id); | |
757 RUNTIME_ASSERT(!frame_it.done()); | |
758 | |
759 List<int> positions; | |
760 isolate->debug()->GetStepinPositions(frame_it.frame(), id, &positions); | |
761 Factory* factory = isolate->factory(); | |
762 Handle<FixedArray> array = factory->NewFixedArray(positions.length()); | |
763 for (int i = 0; i < positions.length(); ++i) { | |
764 array->set(i, Smi::FromInt(positions[i])); | |
765 } | |
766 return *factory->NewJSArrayWithElements(array, FAST_SMI_ELEMENTS); | |
767 } | |
768 | |
769 | |
770 // Return an array with scope details | 743 // Return an array with scope details |
771 // args[0]: number: break id | 744 // args[0]: number: break id |
772 // args[1]: number: frame index | 745 // args[1]: number: frame index |
773 // args[2]: number: inlined frame index | 746 // args[2]: number: inlined frame index |
774 // args[3]: number: scope index | 747 // args[3]: number: scope index |
775 // | 748 // |
776 // The array returned contains the following information: | 749 // The array returned contains the following information: |
777 // 0: Scope type | 750 // 0: Scope type |
778 // 1: Scope object | 751 // 1: Scope object |
779 RUNTIME_FUNCTION(Runtime_GetScopeDetails) { | 752 RUNTIME_FUNCTION(Runtime_GetScopeDetails) { |
(...skipping 895 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1675 return Smi::FromInt(isolate->debug()->is_active()); | 1648 return Smi::FromInt(isolate->debug()->is_active()); |
1676 } | 1649 } |
1677 | 1650 |
1678 | 1651 |
1679 RUNTIME_FUNCTION(Runtime_DebugBreakInOptimizedCode) { | 1652 RUNTIME_FUNCTION(Runtime_DebugBreakInOptimizedCode) { |
1680 UNIMPLEMENTED(); | 1653 UNIMPLEMENTED(); |
1681 return NULL; | 1654 return NULL; |
1682 } | 1655 } |
1683 } // namespace internal | 1656 } // namespace internal |
1684 } // namespace v8 | 1657 } // namespace v8 |
OLD | NEW |