diff options
author | Lorry Tar Creator <lorry-tar-importer@lorry> | 2016-04-10 09:28:39 +0000 |
---|---|---|
committer | Lorry Tar Creator <lorry-tar-importer@lorry> | 2016-04-10 09:28:39 +0000 |
commit | 32761a6cee1d0dee366b885b7b9c777e67885688 (patch) | |
tree | d6bec92bebfb216f4126356e55518842c2f476a1 /Source/JavaScriptCore/runtime/ObjectConstructor.h | |
parent | a4e969f4965059196ca948db781e52f7cfebf19e (diff) | |
download | WebKitGtk-tarball-32761a6cee1d0dee366b885b7b9c777e67885688.tar.gz |
webkitgtk-2.4.11webkitgtk-2.4.11
Diffstat (limited to 'Source/JavaScriptCore/runtime/ObjectConstructor.h')
-rw-r--r-- | Source/JavaScriptCore/runtime/ObjectConstructor.h | 105 |
1 files changed, 45 insertions, 60 deletions
diff --git a/Source/JavaScriptCore/runtime/ObjectConstructor.h b/Source/JavaScriptCore/runtime/ObjectConstructor.h index 6a12f5681..4a6b4711b 100644 --- a/Source/JavaScriptCore/runtime/ObjectConstructor.h +++ b/Source/JavaScriptCore/runtime/ObjectConstructor.h @@ -27,76 +27,61 @@ namespace JSC { -EncodedJSValue JSC_HOST_CALL objectConstructorGetOwnPropertyDescriptor(ExecState*); -EncodedJSValue JSC_HOST_CALL objectConstructorGetOwnPropertyDescriptors(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*); -JSValue objectConstructorGetOwnPropertyDescriptor(ExecState*, JSObject*, const Identifier&); -JSValue objectConstructorGetOwnPropertyDescriptors(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 |