libraries/v8/runtime.cc
// Find the arguments of the JavaScript function invocation that called
// into C++ code. Collect these in a newly allocated array of handles (possibly
// prefixed by a number of empty handles).
Find the arguments of the JavaScript function invocation that called
into C++ code. Collect these in a newly allocated array of handles (possibly
prefixed by a number of empty handles).
Find the arguments of the JavaScript function invocation that called into C ++ code . Collect these in a newly allocated array of handles ( possibly prefixed by a number of empty handles ) .
static SmartArrayPointer<Handle<Object> > GetCallerArguments(
    Isolate* isolate,
    int prefix_argc,
    int* total_argc) {
  JavaScriptFrameIterator it(isolate);
  JavaScriptFrame* frame = it.frame();
  List<JSFunction*> functions(2);
  frame->GetFunctions(&functions);
  if (functions.length() > 1) {
    int inlined_jsframe_index = functions.length() - 1;
    JSFunction* inlined_function = functions[inlined_jsframe_index];
    Vector<SlotRef> args_slots =
        SlotRef::ComputeSlotMappingForArguments(
            frame,
            inlined_jsframe_index,
            inlined_function->shared()->formal_parameter_count());
    int args_count = args_slots.length();
    *total_argc = prefix_argc + args_count;
    SmartArrayPointer<Handle<Object> > param_data(
        NewArray<Handle<Object> >(*total_argc));
    for (int i = 0; i < args_count; i++) {
      Handle<Object> val = args_slots[i].GetValue(isolate);
      param_data[prefix_argc + i] = val;
    }
    args_slots.Dispose();
    return param_data;
  } else {
    it.AdvanceToArgumentsFrame();
    frame = it.frame();
    int args_count = frame->ComputeParametersCount();
    *total_argc = prefix_argc + args_count;
    SmartArrayPointer<Handle<Object> > param_data(
        NewArray<Handle<Object> >(*total_argc));
    for (int i = 0; i < args_count; i++) {
      Handle<Object> val = Handle<Object>(frame->GetParameter(i), isolate);
      param_data[prefix_argc + i] = val;
    }
    return param_data;
  }
}
static SmartArrayPointer < Handle < Object > > GetCallerArguments ( Isolate * isolate , int prefix_argc , int * total_argc ) { JavaScriptFrameIterator it ( isolate ) ; JavaScriptFrame * frame = it . frame ( ) ; List < JSFunction * > functions ( 2 ) ; frame -> GetFunctions ( & functions ) ; if ( functions . length ( ) > 1 ) { int inlined_jsframe_index = functions . length ( ) - 1 ; JSFunction * inlined_function = functions [ inlined_jsframe_index ] ; Vector < SlotRef > args_slots = SlotRef :: ComputeSlotMappingForArguments ( frame , inlined_jsframe_index , inlined_function -> shared ( ) -> formal_parameter_count ( ) ) ; int args_count = args_slots . length ( ) ; * total_argc = prefix_argc + args_count ; SmartArrayPointer < Handle < Object > > param_data ( NewArray < Handle < Object > > ( * total_argc ) ) ; for ( int i = 0 ; i < args_count ; i ++ ) { Handle < Object > val = args_slots [ i ] . GetValue ( isolate ) ; param_data [ prefix_argc + i ] = val ; } args_slots . Dispose ( ) ; return param_data ; } else { it . AdvanceToArgumentsFrame ( ) ; frame = it . frame ( ) ; int args_count = frame -> ComputeParametersCount ( ) ; * total_argc = prefix_argc + args_count ; SmartArrayPointer < Handle < Object > > param_data ( NewArray < Handle < Object > > ( * total_argc ) ) ; for ( int i = 0 ; i < args_count ; i ++ ) { Handle < Object > val = Handle < Object > ( frame -> GetParameter ( i ) , isolate ) ; param_data [ prefix_argc + i ] = val ; } return param_data ; } }
Find the arguments of the JavaScript function invocation that called
into C++ code.
Find the arguments of the JavaScript function invocation that called into C ++ code .
// Find frame containing arguments passed to the caller.