UnlinkedEvalCodeBlock.h [plain text]
#pragma once
#include "UnlinkedGlobalCodeBlock.h"
namespace JSC {
class UnlinkedEvalCodeBlock final : public UnlinkedGlobalCodeBlock {
public:
typedef UnlinkedGlobalCodeBlock Base;
static const unsigned StructureFlags = Base::StructureFlags | StructureIsImmortal;
static UnlinkedEvalCodeBlock* create(VM* vm, const ExecutableInfo& info, DebuggerMode debuggerMode)
{
UnlinkedEvalCodeBlock* instance = new (NotNull, allocateCell<UnlinkedEvalCodeBlock>(vm->heap)) UnlinkedEvalCodeBlock(vm, vm->unlinkedEvalCodeBlockStructure.get(), info, debuggerMode);
instance->finishCreation(*vm);
return instance;
}
static void destroy(JSCell*);
const Identifier& variable(unsigned index) { return m_variables[index]; }
unsigned numVariables() { return m_variables.size(); }
void adoptVariables(Vector<Identifier, 0, UnsafeVectorOverflow>& variables)
{
ASSERT(m_variables.isEmpty());
m_variables.swap(variables);
}
const Identifier& functionHoistingCandidate(unsigned index) { return m_functionHoistingCandidates[index]; }
unsigned numFunctionHoistingCandidates() { return m_functionHoistingCandidates.size(); }
void adoptFunctionHoistingCandidates(Vector<Identifier, 0, UnsafeVectorOverflow>&& functionHoistingCandidates)
{
ASSERT(m_functionHoistingCandidates.isEmpty());
m_functionHoistingCandidates = WTFMove(functionHoistingCandidates);
}
private:
UnlinkedEvalCodeBlock(VM* vm, Structure* structure, const ExecutableInfo& info, DebuggerMode debuggerMode)
: Base(vm, structure, EvalCode, info, debuggerMode)
{
}
Vector<Identifier, 0, UnsafeVectorOverflow> m_variables;
Vector<Identifier, 0, UnsafeVectorOverflow> m_functionHoistingCandidates;
public:
static Structure* createStructure(VM& vm, JSGlobalObject* globalObject, JSValue proto)
{
return Structure::create(vm, globalObject, proto, TypeInfo(UnlinkedEvalCodeBlockType, StructureFlags), info());
}
DECLARE_INFO;
};
}