summaryrefslogtreecommitdiff
path: root/Source/JavaScriptCore/dfg/DFGDriver.cpp
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@digia.com>2013-09-13 12:51:20 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-09-19 20:50:05 +0200
commitd441d6f39bb846989d95bcf5caf387b42414718d (patch)
treee367e64a75991c554930278175d403c072de6bb8 /Source/JavaScriptCore/dfg/DFGDriver.cpp
parent0060b2994c07842f4c59de64b5e3e430525c4b90 (diff)
downloadqtwebkit-d441d6f39bb846989d95bcf5caf387b42414718d.tar.gz
Import Qt5x2 branch of QtWebkit for Qt 5.2
Importing a new snapshot of webkit. Change-Id: I2d01ad12cdc8af8cb015387641120a9d7ea5f10c Reviewed-by: Allan Sandfeld Jensen <allan.jensen@digia.com>
Diffstat (limited to 'Source/JavaScriptCore/dfg/DFGDriver.cpp')
-rw-r--r--Source/JavaScriptCore/dfg/DFGDriver.cpp85
1 files changed, 47 insertions, 38 deletions
diff --git a/Source/JavaScriptCore/dfg/DFGDriver.cpp b/Source/JavaScriptCore/dfg/DFGDriver.cpp
index 8645c6dce..09649cc59 100644
--- a/Source/JavaScriptCore/dfg/DFGDriver.cpp
+++ b/Source/JavaScriptCore/dfg/DFGDriver.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2011, 2012 Apple Inc. All rights reserved.
+ * Copyright (C) 2011, 2012, 2013 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -33,17 +33,23 @@
#if ENABLE(DFG_JIT)
#include "DFGArgumentsSimplificationPhase.h"
+#include "DFGBackwardsPropagationPhase.h"
#include "DFGByteCodeParser.h"
#include "DFGCFAPhase.h"
#include "DFGCFGSimplificationPhase.h"
+#include "DFGCPSRethreadingPhase.h"
#include "DFGCSEPhase.h"
#include "DFGConstantFoldingPhase.h"
+#include "DFGDCEPhase.h"
#include "DFGFixupPhase.h"
#include "DFGJITCompiler.h"
+#include "DFGPredictionInjectionPhase.h"
#include "DFGPredictionPropagationPhase.h"
-#include "DFGStructureCheckHoistingPhase.h"
+#include "DFGTypeCheckHoistingPhase.h"
+#include "DFGUnificationPhase.h"
#include "DFGValidate.h"
#include "DFGVirtualRegisterAllocationPhase.h"
+#include "Operations.h"
#include "Options.h"
namespace JSC { namespace DFG {
@@ -70,10 +76,12 @@ inline bool compile(CompileMode compileMode, ExecState* exec, CodeBlock* codeBlo
if (!Options::useDFGJIT())
return false;
-
-#if DFG_ENABLE(DEBUG_VERBOSE)
- dataLogF("DFG compiling code block %p(%p) for executable %p, number of instructions = %u.\n", codeBlock, codeBlock->alternative(), codeBlock->ownerExecutable(), codeBlock->instructionCount());
-#endif
+
+ if (!Options::bytecodeRangeToDFGCompile().isInRange(codeBlock->instructionCount()))
+ return false;
+
+ if (logCompilationChanges())
+ dataLog("DFG compiling ", *codeBlock, ", number of instructions = ", codeBlock->instructionCount(), "\n");
// Derive our set of must-handle values. The compilation must be at least conservative
// enough to allow for OSR entry with these values.
@@ -98,54 +106,55 @@ inline bool compile(CompileMode compileMode, ExecState* exec, CodeBlock* codeBlo
mustHandleValues[i] = exec->uncheckedR(operand).jsValue();
}
- Graph dfg(exec->globalData(), codeBlock, osrEntryBytecodeIndex, mustHandleValues);
+ Graph dfg(exec->vm(), codeBlock, osrEntryBytecodeIndex, mustHandleValues);
if (!parse(exec, dfg))
return false;
- if (compileMode == CompileFunction)
- dfg.predictArgumentTypes();
-
// By this point the DFG bytecode parser will have potentially mutated various tables
// in the CodeBlock. This is a good time to perform an early shrink, which is more
// powerful than a late one. It's safe to do so because we haven't generated any code
// that references any of the tables directly, yet.
codeBlock->shrinkToFit(CodeBlock::EarlyShrink);
- validate(dfg);
+ if (validationEnabled())
+ validate(dfg);
+
+ performCPSRethreading(dfg);
+ performUnification(dfg);
+ performPredictionInjection(dfg);
+
+ if (validationEnabled())
+ validate(dfg);
+
+ performBackwardsPropagation(dfg);
performPredictionPropagation(dfg);
performFixup(dfg);
- performStructureCheckHoisting(dfg);
- unsigned cnt = 1;
+ performTypeCheckHoisting(dfg);
+
dfg.m_fixpointState = FixpointNotConverged;
- for (;; ++cnt) {
-#if DFG_ENABLE(DEBUG_VERBOSE)
- dataLogF("DFG beginning optimization fixpoint iteration #%u.\n", cnt);
-#endif
- bool changed = false;
- performCFA(dfg);
- changed |= performConstantFolding(dfg);
- changed |= performArgumentsSimplification(dfg);
- changed |= performCFGSimplification(dfg);
- changed |= performCSE(dfg);
- if (!changed)
- break;
- dfg.resetExitStates();
- performFixup(dfg);
- }
- dfg.m_fixpointState = FixpointConverged;
+
performCSE(dfg);
-#if DFG_ENABLE(DEBUG_VERBOSE)
- dataLogF("DFG optimization fixpoint converged in %u iterations.\n", cnt);
-#endif
+ performArgumentsSimplification(dfg);
+ performCPSRethreading(dfg); // This should usually be a no-op since CSE rarely dethreads, and arguments simplification rarely does anything.
+ performCFA(dfg);
+ performConstantFolding(dfg);
+ performCFGSimplification(dfg);
+
+ dfg.m_fixpointState = FixpointConverged;
+
+ performStoreElimination(dfg);
+ performCPSRethreading(dfg);
+ performDCE(dfg);
performVirtualRegisterAllocation(dfg);
GraphDumpMode modeForFinalValidate = DumpGraph;
-#if DFG_ENABLE(DEBUG_VERBOSE)
- dataLogF("Graph after optimization:\n");
- dfg.dump();
- modeForFinalValidate = DontDumpGraph;
-#endif
- validate(dfg, modeForFinalValidate);
+ if (verboseCompilationEnabled()) {
+ dataLogF("Graph after optimization:\n");
+ dfg.dump();
+ modeForFinalValidate = DontDumpGraph;
+ }
+ if (validationEnabled())
+ validate(dfg, modeForFinalValidate);
JITCompiler dataFlowJIT(dfg);
bool result;