diff options
Diffstat (limited to 'Source/JavaScriptCore/dfg/DFGJITCompiler.cpp')
-rw-r--r-- | Source/JavaScriptCore/dfg/DFGJITCompiler.cpp | 26 |
1 files changed, 23 insertions, 3 deletions
diff --git a/Source/JavaScriptCore/dfg/DFGJITCompiler.cpp b/Source/JavaScriptCore/dfg/DFGJITCompiler.cpp index 561f51615..3c85cc77c 100644 --- a/Source/JavaScriptCore/dfg/DFGJITCompiler.cpp +++ b/Source/JavaScriptCore/dfg/DFGJITCompiler.cpp @@ -40,6 +40,15 @@ namespace JSC { namespace DFG { +JITCompiler::JITCompiler(Graph& dfg) + : CCallHelpers(&dfg.m_globalData, dfg.m_codeBlock) + , m_graph(dfg) + , m_currentCodeOriginIndex(0) +{ + if (shouldShowDisassembly()) + m_disassembler = adoptPtr(new Disassembler(dfg)); +} + void JITCompiler::linkOSRExits() { for (unsigned i = 0; i < codeBlock()->numberOfOSRExits(); ++i) { @@ -201,9 +210,11 @@ void JITCompiler::link(LinkBuffer& linkBuffer) bool JITCompiler::compile(JITCode& entry) { + setStartOfCode(); compileEntry(); SpeculativeJIT speculative(*this); compileBody(speculative); + setEndOfMainPath(); // Generate slow path code. speculative.runSlowPathGenerators(); @@ -213,6 +224,7 @@ bool JITCompiler::compile(JITCode& entry) // Create OSR entry trampolines if necessary. speculative.createOSREntries(); + setEndOfCode(); LinkBuffer linkBuffer(*m_globalData, this, m_codeBlock, JITCompilationCanFail); if (linkBuffer.didFailToAllocate()) @@ -220,14 +232,18 @@ bool JITCompiler::compile(JITCode& entry) link(linkBuffer); speculative.linkOSREntries(linkBuffer); + if (m_disassembler) + m_disassembler->dump(linkBuffer); + entry = JITCode( - FINALIZE_CODE(linkBuffer, ("DFG program/eval CodeBlock %p", m_codeBlock)), + linkBuffer.finalizeCodeWithoutDisassembly(), JITCode::DFGJIT); return true; } bool JITCompiler::compileFunction(JITCode& entry, MacroAssemblerCodePtr& entryWithArityCheck) { + setStartOfCode(); compileEntry(); // === Function header code generation === @@ -246,6 +262,7 @@ bool JITCompiler::compileFunction(JITCode& entry, MacroAssemblerCodePtr& entryWi // === Function body code generation === SpeculativeJIT speculative(*this); compileBody(speculative); + setEndOfMainPath(); // === Function footer code generation === // @@ -290,7 +307,7 @@ bool JITCompiler::compileFunction(JITCode& entry, MacroAssemblerCodePtr& entryWi // Create OSR entry trampolines if necessary. speculative.createOSREntries(); - + setEndOfCode(); // === Link === LinkBuffer linkBuffer(*m_globalData, this, m_codeBlock, JITCompilationCanFail); @@ -302,10 +319,13 @@ bool JITCompiler::compileFunction(JITCode& entry, MacroAssemblerCodePtr& entryWi // FIXME: switch the register file check & arity check over to DFGOpertaion style calls, not JIT stubs. linkBuffer.link(callRegisterFileCheck, cti_register_file_check); linkBuffer.link(callArityCheck, m_codeBlock->m_isConstructor ? cti_op_construct_arityCheck : cti_op_call_arityCheck); + + if (m_disassembler) + m_disassembler->dump(linkBuffer); entryWithArityCheck = linkBuffer.locationOf(arityCheck); entry = JITCode( - FINALIZE_CODE(linkBuffer, ("DFG function CodeBlock %p", m_codeBlock)), + linkBuffer.finalizeCodeWithoutDisassembly(), JITCode::DFGJIT); return true; } |