The V8 profiler can be used to profile both the C++ and Javascript code executing.
http://code.google.com/p/v8/wiki/V8Profiler
Ex:
Produce a profiling trace:
./d8 --prof test.js
Output looks like:
function-creation,0x2f3200,0x61dca0 code-creation,LazyCompile,0x61e100,1428,"ProtocolPackage native d8.js:1150" code-creation,LazyCompile,0x61e760,202,"parse native json.js:61" function-creation,0x2e2a1c,0x61e760 code-creation,LazyCompile,0x61e880,142,"ParseJSONUnfiltered native json.js:30" function-creation,0x2e29e4,0x61e880 code-creation,Eval,0x61e960,108,""
Process the trace:
./tools/mac-tick-processor v8.log
Output looks like:
ticks parent name 27 20.5% v8::internal::CEntryStub::MajorKey 26 19.7% unibrow::Letter::Is 10 7.6% __mh_dylib_header 6 4.5% v8::internal::Scanner::ScanIdentifier 5 3.8% unibrow::Utf8::ReadBlock 1 20.0% Script: native string.js 3 2.3% v8::internal::Scanner::ScanJavaScript 3 2.3% ___keymgr_initializer
Erick