diff options
Diffstat (limited to 'Source/JavaScriptCore/dfg/DFGDriver.cpp')
| -rw-r--r-- | Source/JavaScriptCore/dfg/DFGDriver.cpp | 67 |
1 files changed, 31 insertions, 36 deletions
diff --git a/Source/JavaScriptCore/dfg/DFGDriver.cpp b/Source/JavaScriptCore/dfg/DFGDriver.cpp index 780ad6c22..0369848b1 100644 --- a/Source/JavaScriptCore/dfg/DFGDriver.cpp +++ b/Source/JavaScriptCore/dfg/DFGDriver.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2011, 2012, 2013 Apple Inc. All rights reserved. + * Copyright (C) 2011, 2012, 2013, 2014 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,15 +30,16 @@ #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 "Operations.h" +#include "JSCInlines.h" #include "Options.h" #include "SamplingTool.h" +#include "TypeProfilerLog.h" #include <wtf/Atomics.h> #if ENABLE(FTL_JIT) @@ -56,32 +57,24 @@ unsigned getNumCompilations() #if ENABLE(DFG_JIT) static CompilationResult compileImpl( - VM& vm, CodeBlock* codeBlock, CompilationMode mode, unsigned osrEntryBytecodeIndex, - const Operands<JSValue>& mustHandleValues, - PassRefPtr<DeferredCompilationCallback> callback, Worklist* worklist) + VM& vm, CodeBlock* codeBlock, CodeBlock* profiledDFGCodeBlock, CompilationMode mode, + unsigned osrEntryBytecodeIndex, const Operands<JSValue>& mustHandleValues, + PassRefPtr<DeferredCompilationCallback> callback) { 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 (!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()) + if (logCompilationChanges(mode)) 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 @@ -89,44 +82,46 @@ static CompilationResult compileImpl( vm.getCTIStub(osrExitGenerationThunkGenerator); vm.getCTIStub(throwExceptionFromCallSlowPathGenerator); vm.getCTIStub(linkCallThunkGenerator); - vm.getCTIStub(linkConstructThunkGenerator); - vm.getCTIStub(linkClosureCallThunkGenerator); - vm.getCTIStub(virtualCallThunkGenerator); - vm.getCTIStub(virtualConstructThunkGenerator); + vm.getCTIStub(linkPolymorphicCallThunkGenerator); + + if (vm.typeProfiler()) + vm.typeProfilerLog()->processLogEntries(ASCIILiteral("Preparing for DFG compilation.")); RefPtr<Plan> plan = adoptRef( - new Plan(codeBlock, mode, osrEntryBytecodeIndex, mustHandleValues)); + new Plan(codeBlock, profiledDFGCodeBlock, mode, osrEntryBytecodeIndex, mustHandleValues)); - if (worklist) { - plan->callback = callback; - if (logCompilationChanges()) + plan->callback = callback; + if (Options::useConcurrentJIT()) { + Worklist* worklist = ensureGlobalWorklistFor(mode); + if (logCompilationChanges(mode)) dataLog("Deferring DFG compilation of ", *codeBlock, " with queue length ", worklist->queueLength(), ".\n"); worklist->enqueue(plan); return CompilationDeferred; } - plan->compileInThread(*vm.dfgState); + plan->compileInThread(*vm.dfgState, 0); return plan->finalizeWithoutNotifyingCallback(); } #else // ENABLE(DFG_JIT) static CompilationResult compileImpl( - VM&, CodeBlock*, CompilationMode, unsigned, const Operands<JSValue>&, - PassRefPtr<DeferredCompilationCallback>, Worklist*) + VM&, CodeBlock*, CodeBlock*, CompilationMode, unsigned, const Operands<JSValue>&, + PassRefPtr<DeferredCompilationCallback>) { return CompilationFailed; } #endif // ENABLE(DFG_JIT) CompilationResult compile( - VM& vm, CodeBlock* codeBlock, CompilationMode mode, unsigned osrEntryBytecodeIndex, - const Operands<JSValue>& mustHandleValues, - PassRefPtr<DeferredCompilationCallback> passedCallback, Worklist* worklist) + VM& vm, CodeBlock* codeBlock, CodeBlock* profiledDFGCodeBlock, CompilationMode mode, + unsigned osrEntryBytecodeIndex, const Operands<JSValue>& mustHandleValues, + PassRefPtr<DeferredCompilationCallback> passedCallback) { RefPtr<DeferredCompilationCallback> callback = passedCallback; CompilationResult result = compileImpl( - vm, codeBlock, mode, osrEntryBytecodeIndex, mustHandleValues, callback, worklist); + vm, codeBlock, profiledDFGCodeBlock, mode, osrEntryBytecodeIndex, mustHandleValues, + callback); if (result != CompilationDeferred) - callback->compilationDidComplete(codeBlock, result); + callback->compilationDidComplete(codeBlock, profiledDFGCodeBlock, result); return result; } |
