libraries/v8/runtime.cc
// Returns the list of step-in positions (text offset) in a function of the
// stack frame in a range from the current debug break position to the end
// of the corresponding statement.
Returns the list of step-in positions (text offset) in a function of the
stack frame in a range from the current debug break position to the end
of the corresponding statement.
Returns the list of step - in positions ( text offset ) in a function of the stack frame in a range from the current debug break position to the end of the corresponding statement .
RUNTIME_FUNCTION(MaybeObject*, Runtime_GetStepInPositions) {
  HandleScope scope(isolate);
  ASSERT(args.length() == 2);
  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);
  StackFrame::Id id = UnwrapFrameId(wrapped_id);
  JavaScriptFrameIterator frame_it(isolate, id);
  RUNTIME_ASSERT(!frame_it.done());
  JavaScriptFrame* frame = frame_it.frame();
  Handle<JSFunction> fun =
      Handle<JSFunction>(frame->function());
  Handle<SharedFunctionInfo> shared =
      Handle<SharedFunctionInfo>(fun->shared());
  if (!isolate->debug()->EnsureDebugInfo(shared, fun)) {
    return isolate->heap()->undefined_value();
  }
  Handle<DebugInfo> debug_info = Debug::GetDebugInfo(shared);
  int len = 0;
  Handle<JSArray> array(isolate->factory()->NewJSArray(10));
  BreakLocationIterator break_location_iterator(debug_info,
                                                ALL_BREAK_LOCATIONS);
  break_location_iterator.FindBreakLocationFromAddress(frame->pc() - 1);
  int current_statement_pos = break_location_iterator.statement_position();
  while (!break_location_iterator.Done()) {
    bool accept;
    if (break_location_iterator.pc() > frame->pc()) {
      accept = true;
    } else {
      StackFrame::Id break_frame_id = isolate->debug()->break_frame_id();
      if (break_frame_id == StackFrame::NO_ID) {
        accept = false;
      } else {
        JavaScriptFrameIterator additional_frame_it(isolate, break_frame_id);
        accept = additional_frame_it.frame()->id() == id;
      }
    }
    if (accept) {
      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++;
      }
    }
    break_location_iterator.Next();
    if (current_statement_pos !=
        break_location_iterator.statement_position()) {
      break;
    }
  }
  return *array;
}
RUNTIME_FUNCTION ( MaybeObject * , Runtime_GetStepInPositions ) { HandleScope scope ( isolate ) ; ASSERT ( args . length ( ) == 2 ) ; 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 ) ; StackFrame :: Id id = UnwrapFrameId ( wrapped_id ) ; JavaScriptFrameIterator frame_it ( isolate , id ) ; RUNTIME_ASSERT ( ! frame_it . done ( ) ) ; JavaScriptFrame * frame = frame_it . frame ( ) ; Handle < JSFunction > fun = Handle < JSFunction > ( frame -> function ( ) ) ; Handle < SharedFunctionInfo > shared = Handle < SharedFunctionInfo > ( fun -> shared ( ) ) ; if ( ! isolate -> debug ( ) -> EnsureDebugInfo ( shared , fun ) ) { return isolate -> heap ( ) -> undefined_value ( ) ; } Handle < DebugInfo > debug_info = Debug :: GetDebugInfo ( shared ) ; int len = 0 ; Handle < JSArray > array ( isolate -> factory ( ) -> NewJSArray ( 10 ) ) ; BreakLocationIterator break_location_iterator ( debug_info , ALL_BREAK_LOCATIONS ) ; break_location_iterator . FindBreakLocationFromAddress ( frame -> pc ( ) - 1 ) ; int current_statement_pos = break_location_iterator . statement_position ( ) ; while ( ! break_location_iterator . Done ( ) ) { bool accept ; if ( break_location_iterator . pc ( ) > frame -> pc ( ) ) { accept = true ; } else { StackFrame :: Id break_frame_id = isolate -> debug ( ) -> break_frame_id ( ) ; if ( break_frame_id == StackFrame :: NO_ID ) { accept = false ; } else { JavaScriptFrameIterator additional_frame_it ( isolate , break_frame_id ) ; accept = additional_frame_it . frame ( ) -> id ( ) == id ; } } if ( accept ) { 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 ++ ; } } break_location_iterator . Next ( ) ; if ( current_statement_pos != break_location_iterator . statement_position ( ) ) { break ; } } return * array ; }
Returns the list of step-in positions (text offset) in a function of the
stack frame in a range from the current debug break position to the end
of the corresponding statement.
Returns the list of step - in positions ( text offset ) in a function of the stack frame in a range from the current debug break position to the end of the corresponding statement .
// Check arguments. // Get the frame where the debugging is performed. // Find the break point where execution has stopped. // The break point is near our pc. Could be a step-in possibility, // that is currently taken by active debugger call. // We are not stepping. // If our frame is a top frame and we are stepping, we can do step-in // at this place. // Advance iterator.