FunctionCodeBlock.h [plain text]
#pragma once
#include "CodeBlock.h"
#include "UnlinkedFunctionCodeBlock.h"
namespace JSC {
class FunctionCodeBlock final : public CodeBlock {
public:
typedef CodeBlock Base;
DECLARE_INFO;
template<typename>
static IsoSubspace* subspaceFor(VM& vm)
{
return &vm.functionCodeBlockSpace.space;
}
static FunctionCodeBlock* create(VM* vm, CopyParsedBlockTag, FunctionCodeBlock& other)
{
FunctionCodeBlock* instance = new (NotNull, allocateCell<FunctionCodeBlock>(vm->heap))
FunctionCodeBlock(vm, vm->functionCodeBlockStructure.get(), CopyParsedBlock, other);
instance->finishCreation(*vm, CopyParsedBlock, other);
return instance;
}
static FunctionCodeBlock* create(VM* vm, FunctionExecutable* ownerExecutable, UnlinkedFunctionCodeBlock* unlinkedCodeBlock, JSScope* scope,
RefPtr<SourceProvider>&& sourceProvider, unsigned sourceOffset, unsigned firstLineColumnOffset)
{
FunctionCodeBlock* instance = new (NotNull, allocateCell<FunctionCodeBlock>(vm->heap))
FunctionCodeBlock(vm, vm->functionCodeBlockStructure.get(), ownerExecutable, unlinkedCodeBlock, scope, WTFMove(sourceProvider), sourceOffset, firstLineColumnOffset);
if (!instance->finishCreation(*vm, ownerExecutable, unlinkedCodeBlock, scope))
return nullptr;
return instance;
}
static Structure* createStructure(VM& vm, JSGlobalObject* globalObject, JSValue prototype)
{
return Structure::create(vm, globalObject, prototype, TypeInfo(CodeBlockType, StructureFlags), info());
}
private:
FunctionCodeBlock(VM* vm, Structure* structure, CopyParsedBlockTag, FunctionCodeBlock& other)
: CodeBlock(vm, structure, CopyParsedBlock, other)
{
}
FunctionCodeBlock(VM* vm, Structure* structure, FunctionExecutable* ownerExecutable, UnlinkedFunctionCodeBlock* unlinkedCodeBlock, JSScope* scope,
RefPtr<SourceProvider>&& sourceProvider, unsigned sourceOffset, unsigned firstLineColumnOffset)
: CodeBlock(vm, structure, ownerExecutable, unlinkedCodeBlock, scope, WTFMove(sourceProvider), sourceOffset, firstLineColumnOffset)
{
}
static void destroy(JSCell*);
};
}