diff options
Diffstat (limited to 'Source/JavaScriptCore/dfg/DFGDriver.cpp')
| -rw-r--r-- | Source/JavaScriptCore/dfg/DFGDriver.cpp | 65 |
1 files changed, 35 insertions, 30 deletions
diff --git a/Source/JavaScriptCore/dfg/DFGDriver.cpp b/Source/JavaScriptCore/dfg/DFGDriver.cpp index fe407aae6..780ad6c22 100644 --- a/Source/JavaScriptCore/dfg/DFGDriver.cpp +++ b/Source/JavaScriptCore/dfg/DFGDriver.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2011, 2012, 2013, 2014 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 @@ -30,16 +30,15 @@ #include "JSString.h" #include "CodeBlock.h" -#include "DFGFunctionWhitelist.h" #include "DFGJITCode.h" #include "DFGPlan.h" #include "DFGThunks.h" #include "DFGWorklist.h" +#include "Debugger.h" #include "JITCode.h" -#include "JSCInlines.h" +#include "Operations.h" #include "Options.h" #include "SamplingTool.h" -#include "TypeProfilerLog.h" #include <wtf/Atomics.h> #if ENABLE(FTL_JIT) @@ -57,24 +56,32 @@ unsigned getNumCompilations() #if ENABLE(DFG_JIT) static CompilationResult compileImpl( - VM& vm, CodeBlock* codeBlock, CodeBlock* profiledDFGCodeBlock, CompilationMode mode, - unsigned osrEntryBytecodeIndex, const Operands<JSValue>& mustHandleValues, - PassRefPtr<DeferredCompilationCallback> callback) + VM& vm, CodeBlock* codeBlock, CompilationMode mode, unsigned osrEntryBytecodeIndex, + const Operands<JSValue>& mustHandleValues, + PassRefPtr<DeferredCompilationCallback> callback, Worklist* worklist) { SamplingRegion samplingRegion("DFG Compilation (Driver)"); - if (!Options::bytecodeRangeToDFGCompile().isInRange(codeBlock->instructionCount()) - || !FunctionWhitelist::ensureGlobalWhitelist().contains(codeBlock)) - return CompilationFailed; - numCompilations++; ASSERT(codeBlock); ASSERT(codeBlock->alternative()); ASSERT(codeBlock->alternative()->jitType() == JITCode::BaselineJIT); - ASSERT(!profiledDFGCodeBlock || profiledDFGCodeBlock->jitType() == JITCode::DFGJIT); - if (logCompilationChanges(mode)) + if (!Options::useDFGJIT() || !MacroAssembler::supportsFloatingPoint()) + return CompilationFailed; + + if (!Options::bytecodeRangeToDFGCompile().isInRange(codeBlock->instructionCount())) + return CompilationFailed; + + if (vm.enabledProfiler()) + return CompilationInvalidated; + + Debugger* debugger = codeBlock->globalObject()->debugger(); + if (debugger && (debugger->isStepping() || codeBlock->baselineAlternative()->hasDebuggerRequests())) + return CompilationInvalidated; + + if (logCompilationChanges()) dataLog("DFG(Driver) compiling ", *codeBlock, " with ", mode, ", number of instructions = ", codeBlock->instructionCount(), "\n"); // Make sure that any stubs that the DFG is going to use are initialized. We want to @@ -82,44 +89,42 @@ static CompilationResult compileImpl( vm.getCTIStub(osrExitGenerationThunkGenerator); vm.getCTIStub(throwExceptionFromCallSlowPathGenerator); vm.getCTIStub(linkCallThunkGenerator); - vm.getCTIStub(linkPolymorphicCallThunkGenerator); - - if (vm.typeProfiler()) - vm.typeProfilerLog()->processLogEntries(ASCIILiteral("Preparing for DFG compilation.")); + vm.getCTIStub(linkConstructThunkGenerator); + vm.getCTIStub(linkClosureCallThunkGenerator); + vm.getCTIStub(virtualCallThunkGenerator); + vm.getCTIStub(virtualConstructThunkGenerator); RefPtr<Plan> plan = adoptRef( - new Plan(codeBlock, profiledDFGCodeBlock, mode, osrEntryBytecodeIndex, mustHandleValues)); + new Plan(codeBlock, mode, osrEntryBytecodeIndex, mustHandleValues)); - plan->callback = callback; - if (Options::enableConcurrentJIT()) { - Worklist* worklist = ensureGlobalWorklistFor(mode); - if (logCompilationChanges(mode)) + if (worklist) { + plan->callback = callback; + if (logCompilationChanges()) dataLog("Deferring DFG compilation of ", *codeBlock, " with queue length ", worklist->queueLength(), ".\n"); worklist->enqueue(plan); return CompilationDeferred; } - plan->compileInThread(*vm.dfgState, 0); + plan->compileInThread(*vm.dfgState); return plan->finalizeWithoutNotifyingCallback(); } #else // ENABLE(DFG_JIT) static CompilationResult compileImpl( - VM&, CodeBlock*, CodeBlock*, CompilationMode, unsigned, const Operands<JSValue>&, - PassRefPtr<DeferredCompilationCallback>) + VM&, CodeBlock*, CompilationMode, unsigned, const Operands<JSValue>&, + PassRefPtr<DeferredCompilationCallback>, Worklist*) { return CompilationFailed; } #endif // ENABLE(DFG_JIT) CompilationResult compile( - VM& vm, CodeBlock* codeBlock, CodeBlock* profiledDFGCodeBlock, CompilationMode mode, - unsigned osrEntryBytecodeIndex, const Operands<JSValue>& mustHandleValues, - PassRefPtr<DeferredCompilationCallback> passedCallback) + VM& vm, CodeBlock* codeBlock, CompilationMode mode, unsigned osrEntryBytecodeIndex, + const Operands<JSValue>& mustHandleValues, + PassRefPtr<DeferredCompilationCallback> passedCallback, Worklist* worklist) { RefPtr<DeferredCompilationCallback> callback = passedCallback; CompilationResult result = compileImpl( - vm, codeBlock, profiledDFGCodeBlock, mode, osrEntryBytecodeIndex, mustHandleValues, - callback); + vm, codeBlock, mode, osrEntryBytecodeIndex, mustHandleValues, callback, worklist); if (result != CompilationDeferred) callback->compilationDidComplete(codeBlock, result); return result; |
