#ifndef DFGPlan_h
#define DFGPlan_h
#include "CompilationResult.h"
#include "DFGCompilationKey.h"
#include "DFGCompilationMode.h"
#include "DFGDesiredIdentifiers.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/ThreadSafeRefCounted.h>
namespace JSC {
class CodeBlock;
class CodeBlockSet;
class SlotVisitor;
namespace DFG {
class LongLivedState;
class ThreadData;
#if ENABLE(DFG_JIT)
struct Plan : public ThreadSafeRefCounted<Plan> {
Plan(
PassRefPtr<CodeBlock> codeBlockToCompile, CodeBlock* profiledDFGCodeBlock,
CompilationMode, unsigned osrEntryBytecodeIndex,
const Operands<JSValue>& mustHandleValues);
~Plan();
void compileInThread(LongLivedState&, ThreadData*);
CompilationResult finalizeWithoutNotifyingCallback();
void finalizeAndNotifyCallback();
void notifyCompiling();
void notifyCompiled();
void notifyReady();
CompilationKey key();
void checkLivenessAndVisitChildren(SlotVisitor&, CodeBlockSet&);
bool isKnownToBeLiveDuringGC();
void cancel();
VM& vm;
RefPtr<CodeBlock> codeBlock;
RefPtr<CodeBlock> profiledDFGCodeBlock;
CompilationMode mode;
const unsigned osrEntryBytecodeIndex;
Operands<JSValue> mustHandleValues;
ThreadData* threadData;
RefPtr<Profiler::Compilation> compilation;
std::unique_ptr<Finalizer> finalizer;
RefPtr<InlineCallFrameSet> inlineCallFrames;
DesiredWatchpoints watchpoints;
DesiredIdentifiers identifiers;
DesiredWeakReferences weakReferences;
DesiredWriteBarriers writeBarriers;
DesiredTransitions transitions;
bool willTryToTierUp;
enum Stage { Preparing, Compiling, Compiled, Ready, Cancelled };
Stage stage;
RefPtr<DeferredCompilationCallback> callback;
private:
bool reportCompileTimes() const;
enum CompilationPath { FailPath, DFGPath, FTLPath, CancelPath };
CompilationPath compileInThreadImpl(LongLivedState&);
bool isStillValid();
void reallyAdd(CommonData*);
double m_timeBeforeFTL;
};
#else // ENABLE(DFG_JIT)
class Plan : public RefCounted<Plan> {
};
#endif // ENABLE(DFG_JIT)
} }
#endif // DFGPlan_h