Hi,

I am trying to determine the arguments for a JS Function at runtime and 
store them in a separate data structure.
Specifically, I am trying to do this in runtimeprofiler.cc::Optimizer() 
function (void RuntimeProfiler::Optimize(JSFunction* function, const char* 
reason) {)

I am able to extract the JS Function name in there as follows:

    SmartArrayPointer<char> debug_name = 
function->shared()->DebugName()->ToCString();
    std::string func_name = debug_name.get();
    PrintF(" optimizing func_name: %s\n", func_name.c_str());


And I see there is code to extract the calllers argument in runtime.cc in 
the runtime functions:

    HandleScope scope(isolate);
    // Get all arguments of calling function (Function.prototype.bind).     
               
    int argc = 0;
    SmartArrayPointer<Handle<Object> > arguments =
      GetCallerArguments(isolate, 0, &argc);
    // Don't count the this-arg.                                           
                
    if (argc > 0) {
      RUNTIME_ASSERT(arguments[0].is_identical_to(this_object));
      argc--;
    } else {
      RUNTIME_ASSERT(this_object->IsUndefined());
    }

But when I try to do the same inside runtime-profiler.cc, I get compilation 
errors. I made sure to include #include "src/runtime.h"

../deps/v8/src/runtime-profiler.cc:104:23: error: 'isolate' was not 
declared in this scope
../deps/v8/src/runtime-profiler.cc:108:43: error: 'GetCallerArguments' was 
not declared in this scope
../deps/v8/src/runtime-profiler.cc:111:51: error: 'this_object' was not 
declared in this scope
../deps/v8/src/runtime-profiler.cc:111:63: error: 'RUNTIME_ASSERT' was not 
declared in this scope
../deps/v8/src/runtime-profiler.cc:114:22: error: 'this_object' was not 
declared in this scope
../deps/v8/src/runtime-profiler.cc:114:48: error: 'RUNTIME_ASSERT' was not 
declared in this scope

Is there a better way to extract a JS Function's arguments at runtime, then 
the direction I am looking at? If not, how should I be using the runtime 
function
to get this information?


Malek

-- 
-- 
v8-users mailing list
v8-users@googlegroups.com
http://groups.google.com/group/v8-users
--- 
You received this message because you are subscribed to the Google Groups 
"v8-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to v8-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to