diff options
author | Lorry Tar Creator <lorry-tar-importer@lorry> | 2017-06-27 06:07:23 +0000 |
---|---|---|
committer | Lorry Tar Creator <lorry-tar-importer@lorry> | 2017-06-27 06:07:23 +0000 |
commit | 1bf1084f2b10c3b47fd1a588d85d21ed0eb41d0c (patch) | |
tree | 46dcd36c86e7fbc6e5df36deb463b33e9967a6f7 /Source/JavaScriptCore/dfg/DFGPlan.h | |
parent | 32761a6cee1d0dee366b885b7b9c777e67885688 (diff) | |
download | WebKitGtk-tarball-master.tar.gz |
webkitgtk-2.16.5HEADwebkitgtk-2.16.5master
Diffstat (limited to 'Source/JavaScriptCore/dfg/DFGPlan.h')
-rw-r--r-- | Source/JavaScriptCore/dfg/DFGPlan.h | 76 |
1 files changed, 49 insertions, 27 deletions
diff --git a/Source/JavaScriptCore/dfg/DFGPlan.h b/Source/JavaScriptCore/dfg/DFGPlan.h index a60269798..4bff13c89 100644 --- a/Source/JavaScriptCore/dfg/DFGPlan.h +++ b/Source/JavaScriptCore/dfg/DFGPlan.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2013 Apple Inc. All rights reserved. + * Copyright (C) 2013-2017 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -23,91 +23,113 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef DFGPlan_h -#define DFGPlan_h - -#include <wtf/Platform.h> +#pragma once #include "CompilationResult.h" #include "DFGCompilationKey.h" #include "DFGCompilationMode.h" #include "DFGDesiredIdentifiers.h" -#include "DFGDesiredStructureChains.h" #include "DFGDesiredTransitions.h" #include "DFGDesiredWatchpoints.h" #include "DFGDesiredWeakReferences.h" -#include "DFGDesiredWriteBarriers.h" #include "DFGFinalizer.h" #include "DeferredCompilationCallback.h" #include "Operands.h" #include "ProfilerCompilation.h" +#include <wtf/HashMap.h> #include <wtf/ThreadSafeRefCounted.h> +#include <wtf/text/CString.h> namespace JSC { class CodeBlock; +class SlotVisitor; namespace DFG { class LongLivedState; +class ThreadData; #if ENABLE(DFG_JIT) struct Plan : public ThreadSafeRefCounted<Plan> { Plan( - PassRefPtr<CodeBlock>, CompilationMode, unsigned osrEntryBytecodeIndex, + CodeBlock* codeBlockToCompile, CodeBlock* profiledDFGCodeBlock, + CompilationMode, unsigned osrEntryBytecodeIndex, const Operands<JSValue>& mustHandleValues); ~Plan(); - - void compileInThread(LongLivedState&); + + void compileInThread(LongLivedState&, ThreadData*); CompilationResult finalizeWithoutNotifyingCallback(); void finalizeAndNotifyCallback(); + void notifyCompiling(); void notifyReady(); CompilationKey key(); - VM& vm; - RefPtr<CodeBlock> codeBlock; + void markCodeBlocks(SlotVisitor&); + template<typename Func> + void iterateCodeBlocksForGC(const Func&); + void checkLivenessAndVisitChildren(SlotVisitor&); + bool isKnownToBeLiveDuringGC(); + void cancel(); + + bool canTierUpAndOSREnter() const { return !tierUpAndOSREnterBytecodes.isEmpty(); } + + void cleanMustHandleValuesIfNecessary(); + + // Warning: pretty much all of the pointer fields in this object get nulled by cancel(). So, if + // you're writing code that is callable on the cancel path, be sure to null check everything! + + VM* vm; + + // These can be raw pointers because we visit them during every GC in checkLivenessAndVisitChildren. + CodeBlock* codeBlock; + CodeBlock* profiledDFGCodeBlock; + CompilationMode mode; const unsigned osrEntryBytecodeIndex; Operands<JSValue> mustHandleValues; + bool mustHandleValuesMayIncludeGarbage { true }; + Lock mustHandleValueCleaningLock; + + ThreadData* threadData; RefPtr<Profiler::Compilation> compilation; - OwnPtr<Finalizer> finalizer; + std::unique_ptr<Finalizer> finalizer; + RefPtr<InlineCallFrameSet> inlineCallFrames; DesiredWatchpoints watchpoints; DesiredIdentifiers identifiers; - DesiredStructureChains chains; DesiredWeakReferences weakReferences; - DesiredWriteBarriers writeBarriers; DesiredTransitions transitions; - - double beforeFTL; - bool isCompiled; + bool willTryToTierUp { false }; + + HashMap<unsigned, Vector<unsigned>> tierUpInLoopHierarchy; + Vector<unsigned> tierUpAndOSREnterBytecodes; + + enum Stage { Preparing, Compiling, Ready, Cancelled }; + Stage stage; RefPtr<DeferredCompilationCallback> callback; private: - enum CompilationPath { FailPath, DFGPath, FTLPath }; + bool computeCompileTimes() const; + bool reportCompileTimes() const; + + enum CompilationPath { FailPath, DFGPath, FTLPath, CancelPath }; CompilationPath compileInThreadImpl(LongLivedState&); bool isStillValid(); void reallyAdd(CommonData*); -}; - -#else // ENABLE(DFG_JIT) -class Plan : public RefCounted<Plan> { - // Dummy class to allow !ENABLE(DFG_JIT) to build. + double m_timeBeforeFTL; }; #endif // ENABLE(DFG_JIT) } } // namespace JSC::DFG - -#endif // DFGPlan_h - |