#pragma once
#include "ArgumentsMode.h"
#include "JSObject.h"
namespace JSC {
class ClonedArguments final : public JSNonFinalObject {
public:
using Base = JSNonFinalObject;
static constexpr unsigned StructureFlags = Base::StructureFlags | OverridesGetOwnPropertySlot | OverridesGetOwnSpecialPropertyNames;
template<typename CellType, SubspaceAccess mode>
static IsoSubspace* subspaceFor(VM& vm)
{
static_assert(!CellType::needsDestruction, "");
return &vm.clonedArgumentsSpace;
}
private:
ClonedArguments(VM&, Structure*, Butterfly*);
public:
static ClonedArguments* createEmpty(VM&, Structure*, JSFunction* callee, unsigned length);
static ClonedArguments* createEmpty(JSGlobalObject*, JSFunction* callee, unsigned length);
static ClonedArguments* createWithInlineFrame(JSGlobalObject*, CallFrame* targetFrame, InlineCallFrame*, ArgumentsMode);
static ClonedArguments* createWithMachineFrame(JSGlobalObject*, CallFrame* targetFrame, ArgumentsMode);
static ClonedArguments* createByCopyingFrom(JSGlobalObject*, Structure*, Register* argumentsStart, unsigned length, JSFunction* callee);
static Structure* createStructure(VM&, JSGlobalObject*, JSValue prototype);
static Structure* createSlowPutStructure(VM&, JSGlobalObject*, JSValue prototype);
static void visitChildren(JSCell*, SlotVisitor&);
DECLARE_INFO;
private:
static Structure* createStructure(VM&, JSGlobalObject*, JSValue prototype, IndexingType);
static bool getOwnPropertySlot(JSObject*, JSGlobalObject*, PropertyName, PropertySlot&);
static void getOwnSpecialPropertyNames(JSObject*, JSGlobalObject*, PropertyNameArray&, DontEnumPropertiesMode);
static bool put(JSCell*, JSGlobalObject*, PropertyName, JSValue, PutPropertySlot&);
static bool deleteProperty(JSCell*, JSGlobalObject*, PropertyName, DeletePropertySlot&);
static bool defineOwnProperty(JSObject*, JSGlobalObject*, PropertyName, const PropertyDescriptor&, bool shouldThrow);
bool specialsMaterialized() const { return !m_callee; }
void materializeSpecials(JSGlobalObject*);
void materializeSpecialsIfNecessary(JSGlobalObject*);
WriteBarrier<JSFunction> m_callee; };
static const PropertyOffset clonedArgumentsLengthPropertyOffset = 100;
}