[webkit-dev] Instrumenting JavaScriptCore
Mark Lam
mark.lam at apple.com
Mon Nov 12 20:23:12 PST 2012
Erick,
If your instrumentation is not performance critical, you might be interested in using the llint C++ backend. To use that:
1. in WTF/wtf/Platform.h (or equivalent), #define ENABLE_JIT 0, and #define ENABLE_LLINT 1. This will allow you to build for the C++ llint which generates C++ code.
2. Look at Source/JavaScriptCore/llint/LowLevelInterpreter.cpp. In there, you'll fine macros that implements interpreter labels including one for each bytecode opcode. You can modify that for your experiments.
3. Look in Source/JavaScriptCore/offlineasm/instructions.rb for the cloopDo instruction. You can add this instruction to the llint asm code to insert instrumentation to your liking. e.g.
cloopDo // printf("I just added a printf\n");
This embeds the code after the // in the generated llint interpreter (see the generated LLIntAssembly.h).
Hope that helps. And yes, the old interpreter is no longer available.
Regards,
Mark
On Nov 12, 2012, at 7:55 PM, Erick Lavoie <erick.lavoie at gmail.com> wrote:
> Hi,
>
> A research team instrumented JavaScriptCore in 2010 to gather empirical data about the dynamic behavior of JavaScript [1]. I am currently wondering how easy it would be to replicate their setup using the latest WebKit release.
>
> I noticed, in the latest release, that either the JIT or the Low-level Interpreter must be enabled for the build to succeed. Does that mean that the previous interpreter is not available anymore? If it is still available, is there a way to use only the old interpreter, without the JIT or the LLInt?
>
> Also, I would like an opinion from one of the dev guy on how easy it would be to add instrumentation code for every bytecode in the new Low-level Interpreter, given that some part of it are now written in an assembler dialect.
>
> Thanks,
>
> Erick
>
> [1] http://dl.acm.org/citation.cfm?id=1806598
> _______________________________________________
> webkit-dev mailing list
> webkit-dev at lists.webkit.org
> http://lists.webkit.org/mailman/listinfo/webkit-dev
More information about the webkit-dev
mailing list