diff options
Diffstat (limited to 'Source/JavaScriptCore/runtime/ObjectConstructor.h')
| -rw-r--r-- | Source/JavaScriptCore/runtime/ObjectConstructor.h | 102 |
1 files changed, 45 insertions, 57 deletions
diff --git a/Source/JavaScriptCore/runtime/ObjectConstructor.h b/Source/JavaScriptCore/runtime/ObjectConstructor.h index 15b0d4dae..4a6b4711b 100644 --- a/Source/JavaScriptCore/runtime/ObjectConstructor.h +++ b/Source/JavaScriptCore/runtime/ObjectConstructor.h @@ -27,73 +27,61 @@ namespace JSC { -EncodedJSValue JSC_HOST_CALL objectConstructorGetOwnPropertyDescriptor(ExecState*); -EncodedJSValue JSC_HOST_CALL objectConstructorGetOwnPropertySymbols(ExecState*); -EncodedJSValue JSC_HOST_CALL objectConstructorKeys(ExecState*); -EncodedJSValue JSC_HOST_CALL ownEnumerablePropertyKeys(ExecState*); + class ObjectPrototype; -class ObjectPrototype; + class ObjectConstructor : public InternalFunction { + public: + typedef InternalFunction Base; -class ObjectConstructor : public InternalFunction { -public: - typedef InternalFunction Base; - static const unsigned StructureFlags = Base::StructureFlags | OverridesGetOwnPropertySlot; + static ObjectConstructor* create(VM& vm, Structure* structure, ObjectPrototype* objectPrototype) + { + ObjectConstructor* constructor = new (NotNull, allocateCell<ObjectConstructor>(vm.heap)) ObjectConstructor(vm, structure); + constructor->finishCreation(vm, objectPrototype); + return constructor; + } - static ObjectConstructor* create(VM& vm, JSGlobalObject* globalObject, Structure* structure, ObjectPrototype* objectPrototype) + static bool getOwnPropertySlot(JSObject*, ExecState*, PropertyName, PropertySlot&); + + DECLARE_INFO; + + static Structure* createStructure(VM& vm, JSGlobalObject* globalObject, JSValue prototype) + { + return Structure::create(vm, globalObject, prototype, TypeInfo(ObjectType, StructureFlags), info()); + } + + protected: + void finishCreation(VM& vm, ObjectPrototype*); + static const unsigned StructureFlags = OverridesGetOwnPropertySlot | InternalFunction::StructureFlags; + + private: + ObjectConstructor(VM&, Structure*); + static ConstructType getConstructData(JSCell*, ConstructData&); + static CallType getCallData(JSCell*, CallData&); + }; + + inline JSObject* constructEmptyObject(ExecState* exec, Structure* structure) { - ObjectConstructor* constructor = new (NotNull, allocateCell<ObjectConstructor>(vm.heap)) ObjectConstructor(vm, structure); - constructor->finishCreation(vm, globalObject, objectPrototype); - return constructor; + return JSFinalObject::create(exec, structure); } - static bool getOwnPropertySlot(JSObject*, ExecState*, PropertyName, PropertySlot&); - - DECLARE_INFO; + inline JSObject* constructEmptyObject(ExecState* exec, JSObject* prototype, unsigned inlineCapacity) + { + JSGlobalObject* globalObject = exec->lexicalGlobalObject(); + PrototypeMap& prototypeMap = globalObject->vm().prototypeMap; + Structure* structure = prototypeMap.emptyObjectStructureForPrototype( + prototype, inlineCapacity); + return constructEmptyObject(exec, structure); + } - static Structure* createStructure(VM& vm, JSGlobalObject* globalObject, JSValue prototype) + inline JSObject* constructEmptyObject(ExecState* exec, JSObject* prototype) { - return Structure::create(vm, globalObject, prototype, TypeInfo(ObjectType, StructureFlags), info()); + return constructEmptyObject(exec, prototype, JSFinalObject::defaultInlineCapacity()); } - JSFunction* addDefineProperty(ExecState*, JSGlobalObject*); - -protected: - void finishCreation(VM&, JSGlobalObject*, ObjectPrototype*); - -private: - ObjectConstructor(VM&, Structure*); - static ConstructType getConstructData(JSCell*, ConstructData&); - static CallType getCallData(JSCell*, CallData&); -}; - -inline JSObject* constructEmptyObject(ExecState* exec, Structure* structure) -{ - return JSFinalObject::create(exec, structure); -} - -inline JSObject* constructEmptyObject(ExecState* exec, JSObject* prototype, unsigned inlineCapacity) -{ - JSGlobalObject* globalObject = exec->lexicalGlobalObject(); - PrototypeMap& prototypeMap = globalObject->vm().prototypeMap; - Structure* structure = prototypeMap.emptyObjectStructureForPrototype( - prototype, inlineCapacity); - return constructEmptyObject(exec, structure); -} - -inline JSObject* constructEmptyObject(ExecState* exec, JSObject* prototype) -{ - return constructEmptyObject(exec, prototype, JSFinalObject::defaultInlineCapacity()); -} - -inline JSObject* constructEmptyObject(ExecState* exec) -{ - return constructEmptyObject(exec, exec->lexicalGlobalObject()->objectPrototype()); -} - -JSObject* objectConstructorFreeze(ExecState*, JSObject*); -JSValue objectConstructorGetPrototypeOf(ExecState*, JSObject*); -JSArray* ownPropertyKeys(ExecState*, JSObject*, PropertyNameMode, DontEnumPropertiesMode); -bool toPropertyDescriptor(ExecState*, JSValue, PropertyDescriptor&); + inline JSObject* constructEmptyObject(ExecState* exec) + { + return constructEmptyObject(exec, exec->lexicalGlobalObject()->objectPrototype()); + } } // namespace JSC |
