#pragma once
#include "JSObject.h"
#include "Options.h"
namespace JSC {
struct DollarVMAssertScope {
DollarVMAssertScope() { RELEASE_ASSERT(Options::useDollarVM()); }
~DollarVMAssertScope() { RELEASE_ASSERT(Options::useDollarVM()); }
};
class JSDollarVM final : public JSNonFinalObject {
public:
typedef JSNonFinalObject Base;
template<typename CellType, SubspaceAccess>
static CompleteSubspace* subspaceFor(VM& vm)
{
return &vm.cellSpace;
}
DECLARE_EXPORT_INFO;
static Structure* createStructure(VM& vm, JSGlobalObject* globalObject, JSValue prototype)
{
DollarVMAssertScope assertScope;
return Structure::create(vm, globalObject, prototype, TypeInfo(ObjectType, StructureFlags), info());
}
static JSDollarVM* create(VM& vm, Structure* structure)
{
DollarVMAssertScope assertScope;
JSDollarVM* instance = new (NotNull, allocateCell<JSDollarVM>(vm.heap)) JSDollarVM(vm, structure);
instance->finishCreation(vm);
return instance;
}
Structure* objectDoingSideEffectPutWithoutCorrectSlotStatusStructure() { return m_objectDoingSideEffectPutWithoutCorrectSlotStatusStructure.get(); }
private:
JSDollarVM(VM& vm, Structure* structure)
: Base(vm, structure)
{
DollarVMAssertScope assertScope;
}
void finishCreation(VM&);
void addFunction(VM&, JSGlobalObject*, const char* name, NativeFunction, unsigned arguments);
void addConstructibleFunction(VM&, JSGlobalObject*, const char* name, NativeFunction, unsigned arguments);
static void visitChildren(JSCell*, SlotVisitor&);
WriteBarrier<Structure> m_objectDoingSideEffectPutWithoutCorrectSlotStatusStructure;
};
}