#include "CallFrame.h"
#include "ConstructData.h"
+#include "CopyToken.h"
#include "JSCell.h"
namespace JSC {
- class HashEntry;
- struct HashTable;
+class JSArrayBufferView;
+struct HashTable;
- struct MethodTable {
- typedef void (*DestroyFunctionPtr)(JSCell*);
- DestroyFunctionPtr destroy;
+struct MethodTable {
+ typedef void (*DestroyFunctionPtr)(JSCell*);
+ DestroyFunctionPtr destroy;
- typedef void (*VisitChildrenFunctionPtr)(JSCell*, SlotVisitor&);
- VisitChildrenFunctionPtr visitChildren;
+ typedef void (*VisitChildrenFunctionPtr)(JSCell*, SlotVisitor&);
+ VisitChildrenFunctionPtr visitChildren;
- typedef CallType (*GetCallDataFunctionPtr)(JSCell*, CallData&);
- GetCallDataFunctionPtr getCallData;
+ typedef void (*CopyBackingStoreFunctionPtr)(JSCell*, CopyVisitor&, CopyToken);
+ CopyBackingStoreFunctionPtr copyBackingStore;
- typedef ConstructType (*GetConstructDataFunctionPtr)(JSCell*, ConstructData&);
- GetConstructDataFunctionPtr getConstructData;
+ typedef CallType (*GetCallDataFunctionPtr)(JSCell*, CallData&);
+ GetCallDataFunctionPtr getCallData;
- typedef void (*PutFunctionPtr)(JSCell*, ExecState*, const Identifier& propertyName, JSValue, PutPropertySlot&);
- PutFunctionPtr put;
+ typedef ConstructType (*GetConstructDataFunctionPtr)(JSCell*, ConstructData&);
+ GetConstructDataFunctionPtr getConstructData;
- typedef void (*PutByIndexFunctionPtr)(JSCell*, ExecState*, unsigned propertyName, JSValue, bool shouldThrow);
- PutByIndexFunctionPtr putByIndex;
+ typedef void (*PutFunctionPtr)(JSCell*, ExecState*, PropertyName propertyName, JSValue, PutPropertySlot&);
+ PutFunctionPtr put;
- typedef bool (*DeletePropertyFunctionPtr)(JSCell*, ExecState*, const Identifier&);
- DeletePropertyFunctionPtr deleteProperty;
+ typedef void (*PutByIndexFunctionPtr)(JSCell*, ExecState*, unsigned propertyName, JSValue, bool shouldThrow);
+ PutByIndexFunctionPtr putByIndex;
- typedef bool (*DeletePropertyByIndexFunctionPtr)(JSCell*, ExecState*, unsigned);
- DeletePropertyByIndexFunctionPtr deletePropertyByIndex;
+ typedef bool (*DeletePropertyFunctionPtr)(JSCell*, ExecState*, PropertyName);
+ DeletePropertyFunctionPtr deleteProperty;
- typedef bool (*GetOwnPropertySlotFunctionPtr)(JSCell*, ExecState*, const Identifier&, PropertySlot&);
- GetOwnPropertySlotFunctionPtr getOwnPropertySlot;
+ typedef bool (*DeletePropertyByIndexFunctionPtr)(JSCell*, ExecState*, unsigned);
+ DeletePropertyByIndexFunctionPtr deletePropertyByIndex;
- typedef bool (*GetOwnPropertySlotByIndexFunctionPtr)(JSCell*, ExecState*, unsigned, PropertySlot&);
- GetOwnPropertySlotByIndexFunctionPtr getOwnPropertySlotByIndex;
+ typedef bool (*GetOwnPropertySlotFunctionPtr)(JSObject*, ExecState*, PropertyName, PropertySlot&);
+ GetOwnPropertySlotFunctionPtr getOwnPropertySlot;
- typedef JSObject* (*ToThisObjectFunctionPtr)(JSCell*, ExecState*);
- ToThisObjectFunctionPtr toThisObject;
+ typedef bool (*GetOwnPropertySlotByIndexFunctionPtr)(JSObject*, ExecState*, unsigned, PropertySlot&);
+ GetOwnPropertySlotByIndexFunctionPtr getOwnPropertySlotByIndex;
- typedef JSValue (*DefaultValueFunctionPtr)(const JSObject*, ExecState*, PreferredPrimitiveType);
- DefaultValueFunctionPtr defaultValue;
+ typedef JSValue (*ToThisFunctionPtr)(JSCell*, ExecState*, ECMAMode);
+ ToThisFunctionPtr toThis;
- typedef void (*GetOwnPropertyNamesFunctionPtr)(JSObject*, ExecState*, PropertyNameArray&, EnumerationMode);
- GetOwnPropertyNamesFunctionPtr getOwnPropertyNames;
+ typedef JSValue (*DefaultValueFunctionPtr)(const JSObject*, ExecState*, PreferredPrimitiveType);
+ DefaultValueFunctionPtr defaultValue;
- typedef void (*GetPropertyNamesFunctionPtr)(JSObject*, ExecState*, PropertyNameArray&, EnumerationMode);
- GetPropertyNamesFunctionPtr getPropertyNames;
+ typedef void (*GetOwnPropertyNamesFunctionPtr)(JSObject*, ExecState*, PropertyNameArray&, EnumerationMode);
+ GetOwnPropertyNamesFunctionPtr getOwnPropertyNames;
- typedef UString (*ClassNameFunctionPtr)(const JSObject*);
- ClassNameFunctionPtr className;
+ typedef void (*GetOwnNonIndexPropertyNamesFunctionPtr)(JSObject*, ExecState*, PropertyNameArray&, EnumerationMode);
+ GetOwnNonIndexPropertyNamesFunctionPtr getOwnNonIndexPropertyNames;
- typedef bool (*HasInstanceFunctionPtr)(JSObject*, ExecState*, JSValue, JSValue);
- HasInstanceFunctionPtr hasInstance;
+ typedef void (*GetPropertyNamesFunctionPtr)(JSObject*, ExecState*, PropertyNameArray&, EnumerationMode);
+ GetPropertyNamesFunctionPtr getPropertyNames;
- typedef void (*PutWithAttributesFunctionPtr)(JSObject*, ExecState*, const Identifier& propertyName, JSValue, unsigned attributes);
- PutWithAttributesFunctionPtr putDirectVirtual;
+ typedef String (*ClassNameFunctionPtr)(const JSObject*);
+ ClassNameFunctionPtr className;
- typedef bool (*DefineOwnPropertyFunctionPtr)(JSObject*, ExecState*, const Identifier&, PropertyDescriptor&, bool);
- DefineOwnPropertyFunctionPtr defineOwnProperty;
+ typedef bool (*CustomHasInstanceFunctionPtr)(JSObject*, ExecState*, JSValue);
+ CustomHasInstanceFunctionPtr customHasInstance;
- typedef bool (*GetOwnPropertyDescriptorFunctionPtr)(JSObject*, ExecState*, const Identifier&, PropertyDescriptor&);
- GetOwnPropertyDescriptorFunctionPtr getOwnPropertyDescriptor;
- };
+ typedef bool (*DefineOwnPropertyFunctionPtr)(JSObject*, ExecState*, PropertyName, const PropertyDescriptor&, bool);
+ DefineOwnPropertyFunctionPtr defineOwnProperty;
+
+ typedef ArrayBuffer* (*SlowDownAndWasteMemory)(JSArrayBufferView*);
+ SlowDownAndWasteMemory slowDownAndWasteMemory;
+
+ typedef PassRefPtr<ArrayBufferView> (*GetTypedArrayImpl)(JSArrayBufferView*);
+ GetTypedArrayImpl getTypedArrayImpl;
+
+ typedef void (*DumpToStreamFunctionPtr)(const JSCell*, PrintStream&);
+ DumpToStreamFunctionPtr dumpToStream;
+};
#define CREATE_MEMBER_CHECKER(member) \
-template <typename T> \
-struct MemberCheck##member { \
- struct Fallback { \
- void member(...); \
- }; \
- struct Derived : T, Fallback { }; \
- template <typename U, U> struct Check; \
- typedef char Yes[2]; \
- typedef char No[1]; \
- template <typename U> \
- static No &func(Check<void (Fallback::*)(...), &U::member>*); \
- template <typename U> \
- static Yes &func(...); \
- enum { has = sizeof(func<Derived>(0)) == sizeof(Yes) }; \
-}
+ template <typename T> \
+ struct MemberCheck##member { \
+ struct Fallback { \
+ void member(...); \
+ }; \
+ struct Derived : T, Fallback { }; \
+ template <typename U, U> struct Check; \
+ typedef char Yes[2]; \
+ typedef char No[1]; \
+ template <typename U> \
+ static No &func(Check<void (Fallback::*)(...), &U::member>*); \
+ template <typename U> \
+ static Yes &func(...); \
+ enum { has = sizeof(func<Derived>(0)) == sizeof(Yes) }; \
+ }
#define HAS_MEMBER_NAMED(klass, name) (MemberCheck##name<klass>::has)
#define CREATE_METHOD_TABLE(ClassName) { \
&ClassName::destroy, \
&ClassName::visitChildren, \
+ &ClassName::copyBackingStore, \
&ClassName::getCallData, \
&ClassName::getConstructData, \
&ClassName::put, \
&ClassName::deletePropertyByIndex, \
&ClassName::getOwnPropertySlot, \
&ClassName::getOwnPropertySlotByIndex, \
- &ClassName::toThisObject, \
+ &ClassName::toThis, \
&ClassName::defaultValue, \
&ClassName::getOwnPropertyNames, \
+ &ClassName::getOwnNonIndexPropertyNames, \
&ClassName::getPropertyNames, \
&ClassName::className, \
- &ClassName::hasInstance, \
- &ClassName::putDirectVirtual, \
+ &ClassName::customHasInstance, \
&ClassName::defineOwnProperty, \
- &ClassName::getOwnPropertyDescriptor, \
+ &ClassName::slowDownAndWasteMemory, \
+ &ClassName::getTypedArrayImpl, \
+ &ClassName::dumpToStream \
}, \
ClassName::TypedArrayStorageType
- struct ClassInfo {
- /**
- * A string denoting the class name. Example: "Window".
- */
- const char* className;
-
- /**
- * Pointer to the class information of the base class.
- * 0L if there is none.
- */
- const ClassInfo* parentClass;
- /**
- * Static hash-table of properties.
- * For classes that can be used from multiple threads, it is accessed via a getter function that would typically return a pointer to thread-specific value.
- */
- const HashTable* propHashTable(ExecState* exec) const
- {
- if (classPropHashTableGetterFunction)
- return classPropHashTableGetterFunction(exec);
- return staticPropHashTable;
+struct ClassInfo {
+ // A string denoting the class name. Example: "Window".
+ const char* className;
+
+ // Pointer to the class information of the base class.
+ // nullptrif there is none.
+ const ClassInfo* parentClass;
+
+ // Static hash-table of properties.
+ // For classes that can be used from multiple threads, it is accessed via a getter function
+ // that would typically return a pointer to a thread-specific value.
+ const HashTable* propHashTable(ExecState* exec) const
+ {
+ if (classPropHashTableGetterFunction)
+ return &classPropHashTableGetterFunction(exec->vm());
+
+ return staticPropHashTable;
+ }
+
+ const HashTable* propHashTable(VM& vm) const
+ {
+ if (classPropHashTableGetterFunction)
+ return &classPropHashTableGetterFunction(vm);
+
+ return staticPropHashTable;
+ }
+
+ bool isSubClassOf(const ClassInfo* other) const
+ {
+ for (const ClassInfo* ci = this; ci; ci = ci->parentClass) {
+ if (ci == other)
+ return true;
}
-
- bool isSubClassOf(const ClassInfo* other) const
- {
- for (const ClassInfo* ci = this; ci; ci = ci->parentClass) {
- if (ci == other)
- return true;
- }
- return false;
+ return false;
+ }
+
+ bool hasStaticProperties() const
+ {
+ for (const ClassInfo* ci = this; ci; ci = ci->parentClass) {
+ if (ci->staticPropHashTable || ci->classPropHashTableGetterFunction)
+ return true;
}
+ return false;
+ }
- bool hasStaticProperties() const
- {
- for (const ClassInfo* ci = this; ci; ci = ci->parentClass) {
- if (ci->staticPropHashTable || ci->classPropHashTableGetterFunction)
- return true;
- }
- return false;
- }
+ bool hasStaticSetterOrReadonlyProperties(VM&) const;
- const HashTable* staticPropHashTable;
- typedef const HashTable* (*ClassPropHashTableGetterFunction)(ExecState*);
- const ClassPropHashTableGetterFunction classPropHashTableGetterFunction;
+ const HashTable* staticPropHashTable;
+ typedef const HashTable& (*ClassPropHashTableGetterFunction)(VM&);
+ const ClassPropHashTableGetterFunction classPropHashTableGetterFunction;
- MethodTable methodTable;
+ MethodTable methodTable;
- TypedArrayType typedArrayStorageType;
- };
+ TypedArrayType typedArrayStorageType;
+};
} // namespace JSC