[webkit-dev] Function & Property Names

Nyx mcheva at cs.mcgill.ca
Wed Apr 28 14:33:54 PDT 2010


I'm in the process of writing a program to analyze traces of JavaScript code.
This involves logging events that occur in the interpreter. Currently, I'm
trying to just log function calls and property accesses. However, I'm unsure
exactly how to go about getting the names (identifiers) associated with
functions (and properties).

I wrote the following piece of code just to test things out, which I
inserted in Interpreter.cpp, in the definition of the op_call opcode, after
the "vPC = newCodeBlock->instructions().begin();" line:

JSGlobalObject* globalObject = callFrame->scopeChain()->globalObject;

printf("Function call: %s\n",
asFunction(v)->name(globalObject->globalExec()).ascii());
printf("%s\n", newCodeBlock->ownerExecutable()->sourceURL().ascii());
printf("%i\n", newCodeBlock->ownerExecutable()->lineNo());

My goal was to report the name of the function being called each time an
op_call is executed. However, this does not report the function names
correctly. My guess is that I'm passing the wrong value to
InternalFunction::name(). Can anyone tell me what I'm doing wrong here? I'm
rather unfamiliar with the WebKit code.
-- 
View this message in context: http://old.nabble.com/Function---Property-Names-tp28394250p28394250.html
Sent from the Webkit mailing list archive at Nabble.com.



More information about the webkit-dev mailing list