From 1bf1084f2b10c3b47fd1a588d85d21ed0eb41d0c Mon Sep 17 00:00:00 2001 From: Lorry Tar Creator Date: Tue, 27 Jun 2017 06:07:23 +0000 Subject: webkitgtk-2.16.5 --- Source/JavaScriptCore/dfg/DFGPlan.h | 76 ++++++++++++++++++++++++------------- 1 file changed, 49 insertions(+), 27 deletions(-) (limited to 'Source/JavaScriptCore/dfg/DFGPlan.h') 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 +#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 #include +#include namespace JSC { class CodeBlock; +class SlotVisitor; namespace DFG { class LongLivedState; +class ThreadData; #if ENABLE(DFG_JIT) struct Plan : public ThreadSafeRefCounted { Plan( - PassRefPtr, CompilationMode, unsigned osrEntryBytecodeIndex, + CodeBlock* codeBlockToCompile, CodeBlock* profiledDFGCodeBlock, + CompilationMode, unsigned osrEntryBytecodeIndex, const Operands& mustHandleValues); ~Plan(); - - void compileInThread(LongLivedState&); + + void compileInThread(LongLivedState&, ThreadData*); CompilationResult finalizeWithoutNotifyingCallback(); void finalizeAndNotifyCallback(); + void notifyCompiling(); void notifyReady(); CompilationKey key(); - VM& vm; - RefPtr codeBlock; + void markCodeBlocks(SlotVisitor&); + template + 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 mustHandleValues; + bool mustHandleValuesMayIncludeGarbage { true }; + Lock mustHandleValueCleaningLock; + + ThreadData* threadData; RefPtr compilation; - OwnPtr finalizer; + std::unique_ptr finalizer; + RefPtr inlineCallFrames; DesiredWatchpoints watchpoints; DesiredIdentifiers identifiers; - DesiredStructureChains chains; DesiredWeakReferences weakReferences; - DesiredWriteBarriers writeBarriers; DesiredTransitions transitions; - - double beforeFTL; - bool isCompiled; + bool willTryToTierUp { false }; + + HashMap> tierUpInLoopHierarchy; + Vector tierUpAndOSREnterBytecodes; + + enum Stage { Preparing, Compiling, Ready, Cancelled }; + Stage stage; RefPtr 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 { - // Dummy class to allow !ENABLE(DFG_JIT) to build. + double m_timeBeforeFTL; }; #endif // ENABLE(DFG_JIT) } } // namespace JSC::DFG - -#endif // DFGPlan_h - -- cgit v1.2.1