Index: src/runtime.cc |
diff --git a/src/runtime.cc b/src/runtime.cc |
index ff55fab8c95f51359464eb2e80f05ab24c63b792..644ee66fe91061fe905858fdaa87f3084b628c73 100644 |
--- a/src/runtime.cc |
+++ b/src/runtime.cc |
@@ -11564,6 +11564,55 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_GetScopeCount) { |
} |
+RUNTIME_FUNCTION(MaybeObject*, Runtime_GetStepInPositions) { |
+ HandleScope scope(isolate); |
+ ASSERT(args.length() == 2); |
+ |
+ // Check arguments. |
+ Object* check; |
+ { MaybeObject* maybe_check = Runtime_CheckExecutionState( |
+ RUNTIME_ARGUMENTS(isolate, args)); |
+ if (!maybe_check->ToObject(&check)) return maybe_check; |
+ } |
+ CONVERT_SMI_ARG_CHECKED(wrapped_id, 1); |
+ |
+ // Get the frame where the debugging is performed. |
+ StackFrame::Id id = UnwrapFrameId(wrapped_id); |
+ JavaScriptFrameIterator frame_it(isolate, id); |
+ JavaScriptFrame* frame = frame_it.frame(); |
+ |
+ Handle<SharedFunctionInfo> shared = |
+ Handle<SharedFunctionInfo>(JSFunction::cast(frame->function())->shared()); |
+ Handle<DebugInfo> debug_info = Debug::GetDebugInfo(shared); |
+ |
+ int len = 0; |
+ Handle<JSArray> array(isolate->factory()->NewJSArray(10)); |
+ // Find the break point where execution has stopped. |
+ BreakLocationIterator break_location_iterator(debug_info, |
+ ALL_BREAK_LOCATIONS); |
+ |
+ break_location_iterator.FindBreakLocationFromAddress(frame->pc()); |
+ int current_statement_pos = break_location_iterator.statement_position(); |
+ |
+ while (!break_location_iterator.Done()) { |
+ if (break_location_iterator.IsStepInLocation(isolate)) { |
+ Smi* position_value = Smi::FromInt(break_location_iterator.position()); |
+ JSObject::SetElement(array, len, |
+ Handle<Object>(position_value, isolate), |
+ NONE, kNonStrictMode); |
+ len++; |
+ } |
+ // Advance iterator. |
+ break_location_iterator.Next(); |
+ if (current_statement_pos != |
+ break_location_iterator.statement_position()) { |
+ break; |
+ } |
+ } |
+ return *array; |
+} |
Yang
2013/06/14 13:41:12
Am I understanding this correctly that you are loo
Peter.Rybin
2013/06/14 19:48:01
No, it's absolutely fine. The things is that in so
|
+ |
+ |
static const int kScopeDetailsTypeIndex = 0; |
static const int kScopeDetailsObjectIndex = 1; |
static const int kScopeDetailsSize = 2; |