Changeset 182294 in webkit
- Timestamp:
- Apr 2, 2015 3:46:52 PM (9 years ago)
- Location:
- trunk/Source/JavaScriptCore
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/ChangeLog
r182280 r182294 1 2015-04-02 Mark Lam <mark.lam@apple.com> 2 3 Add Options::dumpSourceAtDFGTime(). 4 <https://webkit.org/b/143349> 5 6 Reviewed by Oliver Hunt, and Michael Saboff. 7 8 Sometimes, we will want to see the JS source code that we're compiling, and it 9 would be nice to be able to do this without having to jump thru a lot of hoops. 10 So, let's add a Options::dumpSourceAtDFGTime() option just like we have a 11 Options::dumpBytecodeAtDFGTime() option. 12 13 Also added versions of CodeBlock::dumpSource() and CodeBlock::dumpBytecode() 14 that explicitly take no arguments (instead of relying on the version that takes 15 the default argument). These versions are friendlier to use when we want to call 16 them from an interactive debugging session. 17 18 * bytecode/CodeBlock.cpp: 19 (JSC::CodeBlock::dumpSource): 20 (JSC::CodeBlock::dumpBytecode): 21 * bytecode/CodeBlock.h: 22 * dfg/DFGByteCodeParser.cpp: 23 (JSC::DFG::ByteCodeParser::parseCodeBlock): 24 * runtime/Options.h: 25 1 26 2015-04-02 Yusuke Suzuki <utatane.tea@gmail.com> 2 27 -
trunk/Source/JavaScriptCore/bytecode/CodeBlock.cpp
r182038 r182294 551 551 out.printf("%s, %s, %s", registerName(r0).data(), idName(id0, identifier(id0)).data(), registerName(r1).data()); 552 552 it += 5; 553 } 554 555 void CodeBlock::dumpSource() 556 { 557 dumpSource(WTF::dataFile()); 558 } 559 560 void CodeBlock::dumpSource(PrintStream& out) 561 { 562 ScriptExecutable* executable = ownerExecutable(); 563 if (executable->isFunctionExecutable()) { 564 FunctionExecutable* functionExecutable = reinterpret_cast<FunctionExecutable*>(executable); 565 String source = functionExecutable->source().provider()->getRange( 566 functionExecutable->parametersStartOffset(), 567 functionExecutable->typeProfilingEndOffset() + 1); // Type profiling end offset is the character before the '}'. 568 569 out.print("function ", inferredName(), source); 570 return; 571 } 572 out.print(executable->source().toString()); 573 } 574 575 void CodeBlock::dumpBytecode() 576 { 577 dumpBytecode(WTF::dataFile()); 553 578 } 554 579 -
trunk/Source/JavaScriptCore/bytecode/CodeBlock.h
r181993 r182294 156 156 void visitAggregate(SlotVisitor&); 157 157 158 void dumpBytecode(PrintStream& = WTF::dataFile()); 158 void dumpSource(); 159 void dumpSource(PrintStream&); 160 161 void dumpBytecode(); 162 void dumpBytecode(PrintStream&); 159 163 void dumpBytecode( 160 164 PrintStream&, unsigned bytecodeOffset, -
trunk/Source/JavaScriptCore/dfg/DFGByteCodeParser.cpp
r182167 r182294 3971 3971 } 3972 3972 3973 bool shouldDumpSource = Options::dumpSourceAtDFGTime(); 3973 3974 bool shouldDumpBytecode = Options::dumpBytecodeAtDFGTime(); 3974 if (shouldDump Bytecode) {3975 if (shouldDumpSource || shouldDumpBytecode) { 3975 3976 dataLog("Parsing ", *codeBlock); 3976 3977 if (inlineCallFrame()) { … … 3982 3983 ": needsActivation = ", codeBlock->needsActivation(), 3983 3984 ", isStrictMode = ", codeBlock->ownerExecutable()->isStrictMode(), "\n"); 3985 } 3986 3987 if (shouldDumpSource) { 3988 dataLog("==== begin source ====\n"); 3989 codeBlock->baselineVersion()->dumpSource(); 3990 dataLog("\n==== end source ====\n\n"); 3991 } 3992 3993 if (shouldDumpBytecode) 3984 3994 codeBlock->baselineVersion()->dumpBytecode(); 3985 }3986 3995 3987 3996 Vector<unsigned, 32> jumpTargets; -
trunk/Source/JavaScriptCore/runtime/Options.h
r181993 r182294 125 125 v(optionRange, bytecodeRangeToDFGCompile, 0) \ 126 126 v(optionString, dfgFunctionWhitelistFile, nullptr) \ 127 v(bool, dumpSourceAtDFGTime, false) \ 127 128 v(bool, dumpBytecodeAtDFGTime, false) \ 128 129 v(bool, dumpGraphAfterParsing, false) \
Note: See TracChangeset
for help on using the changeset viewer.