diff options
author | Simon Hausmann <simon.hausmann@nokia.com> | 2012-05-25 15:09:11 +0200 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@nokia.com> | 2012-05-25 15:09:11 +0200 |
commit | a89b2ebb8e192c5e8cea21079bda2ee2c0c7dddd (patch) | |
tree | b7abd9f49ae1d4d2e426a5883bfccd42b8e2ee12 /Source/JavaScriptCore/dfg/DFGDriver.cpp | |
parent | 8d473cf9743f1d30a16a27114e93bd5af5648d23 (diff) | |
download | qtwebkit-a89b2ebb8e192c5e8cea21079bda2ee2c0c7dddd.tar.gz |
Imported WebKit commit eb5c1b8fe4d4b1b90b5137433fc58a91da0e6878 (http://svn.webkit.org/repository/webkit/trunk@118516)
Diffstat (limited to 'Source/JavaScriptCore/dfg/DFGDriver.cpp')
-rw-r--r-- | Source/JavaScriptCore/dfg/DFGDriver.cpp | 48 |
1 files changed, 35 insertions, 13 deletions
diff --git a/Source/JavaScriptCore/dfg/DFGDriver.cpp b/Source/JavaScriptCore/dfg/DFGDriver.cpp index f583a8d63..6ebe338f5 100644 --- a/Source/JavaScriptCore/dfg/DFGDriver.cpp +++ b/Source/JavaScriptCore/dfg/DFGDriver.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2011 Apple Inc. All rights reserved. + * Copyright (C) 2011, 2012 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -28,32 +28,36 @@ #if ENABLE(DFG_JIT) +#include "DFGArgumentsSimplificationPhase.h" #include "DFGByteCodeParser.h" #include "DFGCFAPhase.h" +#include "DFGCFGSimplificationPhase.h" #include "DFGCSEPhase.h" +#include "DFGConstantFoldingPhase.h" #include "DFGFixupPhase.h" #include "DFGJITCompiler.h" #include "DFGPredictionPropagationPhase.h" #include "DFGRedundantPhiEliminationPhase.h" +#include "DFGValidate.h" #include "DFGVirtualRegisterAllocationPhase.h" namespace JSC { namespace DFG { enum CompileMode { CompileFunction, CompileOther }; -inline bool compile(CompileMode compileMode, JSGlobalData& globalData, CodeBlock* codeBlock, JITCode& jitCode, MacroAssemblerCodePtr* jitCodeWithArityCheck) +inline bool compile(CompileMode compileMode, ExecState* exec, CodeBlock* codeBlock, JITCode& jitCode, MacroAssemblerCodePtr* jitCodeWithArityCheck) { SamplingRegion samplingRegion("DFG Compilation (Driver)"); ASSERT(codeBlock); ASSERT(codeBlock->alternative()); ASSERT(codeBlock->alternative()->getJITType() == JITCode::BaselineJIT); - + #if DFG_ENABLE(DEBUG_VERBOSE) - dataLog("DFG compiling code block %p(%p), number of instructions = %u.\n", codeBlock, codeBlock->alternative(), codeBlock->instructionCount()); + dataLog("DFG compiling code block %p(%p) for executable %p, number of instructions = %u.\n", codeBlock, codeBlock->alternative(), codeBlock->ownerExecutable(), codeBlock->instructionCount()); #endif - Graph dfg(globalData, codeBlock); - if (!parse(dfg)) + Graph dfg(exec->globalData(), codeBlock); + if (!parse(exec, dfg)) return false; if (compileMode == CompileFunction) @@ -65,12 +69,30 @@ inline bool compile(CompileMode compileMode, JSGlobalData& globalData, CodeBlock // that references any of the tables directly, yet. codeBlock->shrinkToFit(CodeBlock::EarlyShrink); - performRedundantPhiElimination(dfg); + validate(dfg); performPredictionPropagation(dfg); performFixup(dfg); - performCSE(dfg); + unsigned cnt = 1; + for (;; ++cnt) { +#if DFG_ENABLE(DEBUG_VERBOSE) + dataLog("DFG beginning optimization fixpoint iteration #%u.\n", cnt); +#endif + bool changed = false; + performCFA(dfg); + changed |= performConstantFolding(dfg); + changed |= performArgumentsSimplification(dfg); + changed |= performCFGSimplification(dfg); + if (!changed) + break; + performCSE(dfg, FixpointNotConverged); + dfg.resetExitStates(); + } + performCSE(dfg, FixpointConverged); +#if DFG_ENABLE(DEBUG_VERBOSE) + dataLog("DFG optimization fixpoint converged in %u iterations.\n", cnt); +#endif + dfg.m_dominators.compute(dfg); performVirtualRegisterAllocation(dfg); - performCFA(dfg); #if DFG_ENABLE(DEBUG_VERBOSE) dataLog("Graph after optimization:\n"); @@ -93,14 +115,14 @@ inline bool compile(CompileMode compileMode, JSGlobalData& globalData, CodeBlock return result; } -bool tryCompile(JSGlobalData& globalData, CodeBlock* codeBlock, JITCode& jitCode) +bool tryCompile(ExecState* exec, CodeBlock* codeBlock, JITCode& jitCode) { - return compile(CompileOther, globalData, codeBlock, jitCode, 0); + return compile(CompileOther, exec, codeBlock, jitCode, 0); } -bool tryCompileFunction(JSGlobalData& globalData, CodeBlock* codeBlock, JITCode& jitCode, MacroAssemblerCodePtr& jitCodeWithArityCheck) +bool tryCompileFunction(ExecState* exec, CodeBlock* codeBlock, JITCode& jitCode, MacroAssemblerCodePtr& jitCodeWithArityCheck) { - return compile(CompileFunction, globalData, codeBlock, jitCode, &jitCodeWithArityCheck); + return compile(CompileFunction, exec, codeBlock, jitCode, &jitCodeWithArityCheck); } } } // namespace JSC::DFG |