ProgramExecutable.h [plain text]
#pragma once
#include "ExecutableToCodeBlockEdge.h"
#include "GlobalExecutable.h"
namespace JSC {
class ProgramExecutable final : public GlobalExecutable {
friend class LLIntOffsetsExtractor;
public:
using Base = GlobalExecutable;
static constexpr unsigned StructureFlags = Base::StructureFlags | StructureIsImmortal;
template<typename CellType, SubspaceAccess>
static IsoSubspace* subspaceFor(VM& vm)
{
return &vm.programExecutableSpace.space;
}
static ProgramExecutable* create(JSGlobalObject* globalObject, const SourceCode& source)
{
VM& vm = getVM(globalObject);
ProgramExecutable* executable = new (NotNull, allocateCell<ProgramExecutable>(vm.heap)) ProgramExecutable(globalObject, source);
executable->finishCreation(vm);
return executable;
}
JSObject* initializeGlobalProperties(VM&, JSGlobalObject*, JSScope*);
static void destroy(JSCell*);
ProgramCodeBlock* codeBlock()
{
return bitwise_cast<ProgramCodeBlock*>(ExecutableToCodeBlockEdge::unwrap(m_programCodeBlock.get()));
}
Ref<JITCode> generatedJITCode()
{
return generatedJITCodeForCall();
}
static Structure* createStructure(VM& vm, JSGlobalObject* globalObject, JSValue proto)
{
return Structure::create(vm, globalObject, proto, TypeInfo(ProgramExecutableType, StructureFlags), info());
}
DECLARE_INFO;
ExecutableInfo executableInfo() const { return ExecutableInfo(usesEval(), false, false, ConstructorKind::None, JSParserScriptMode::Classic, SuperBinding::NotNeeded, SourceParseMode::ProgramMode, derivedContextType(), NeedsClassFieldInitializer::No, isArrowFunctionContext(), false, EvalContextType::None); }
TemplateObjectMap& ensureTemplateObjectMap(VM&);
private:
friend class ExecutableBase;
friend class ScriptExecutable;
ProgramExecutable(JSGlobalObject*, const SourceCode&);
static void visitChildren(JSCell*, SlotVisitor&);
WriteBarrier<UnlinkedProgramCodeBlock> m_unlinkedProgramCodeBlock;
WriteBarrier<ExecutableToCodeBlockEdge> m_programCodeBlock;
std::unique_ptr<TemplateObjectMap> m_templateObjectMap;
};
}