JSAsyncGeneratorFunction.h [plain text]
#pragma once
#include "JSFunction.h"
namespace JSC {
class JSAsyncGeneratorFunction : public JSFunction {
friend class JIT;
friend class VM;
public:
using Base = JSFunction;
const static unsigned StructureFlags = Base::StructureFlags;
template<typename CellType>
static IsoSubspace* subspaceFor(VM& vm)
{
return &vm.asyncGeneratorFunctionSpace;
}
DECLARE_EXPORT_INFO;
static JSAsyncGeneratorFunction* create(VM&, FunctionExecutable*, JSScope*);
static JSAsyncGeneratorFunction* create(VM&, FunctionExecutable*, JSScope*, Structure*);
static JSAsyncGeneratorFunction* createWithInvalidatedReallocationWatchpoint(VM&, FunctionExecutable*, JSScope*);
static size_t allocationSize(size_t inlineCapacity)
{
ASSERT_UNUSED(inlineCapacity, !inlineCapacity);
return sizeof(JSAsyncGeneratorFunction);
}
static Structure* createStructure(VM& vm, JSGlobalObject* globalObject, JSValue prototype)
{
ASSERT(globalObject);
return Structure::create(vm, globalObject, prototype, TypeInfo(JSFunctionType, StructureFlags), info());
}
enum class AsyncGeneratorState : int32_t {
Completed = -1,
Executing = -2,
SuspendedStart = -3,
SuspendedYield = -4,
AwaitingReturn = -5
};
enum class AsyncGeneratorSuspendReason : int32_t {
None = 0,
Yield = -1,
Await = -2
};
private:
JSAsyncGeneratorFunction(VM&, FunctionExecutable*, JSScope*, Structure*);
static JSAsyncGeneratorFunction* createImpl(VM&, FunctionExecutable*, JSScope*, Structure*);
};
}