X-Git-Url: https://git.saurik.com/apple/javascriptcore.git/blobdiff_plain/6fe7ccc865dc7d7541b93c5bcaf6368d2c98a174..ed1e77d3adeb83d26fd1dfb16dd84cabdcefd250:/runtime/NativeErrorConstructor.h diff --git a/runtime/NativeErrorConstructor.h b/runtime/NativeErrorConstructor.h index 41e4235..b582ef3 100644 --- a/runtime/NativeErrorConstructor.h +++ b/runtime/NativeErrorConstructor.h @@ -26,54 +26,41 @@ namespace JSC { - class ErrorInstance; - class FunctionPrototype; - class NativeErrorPrototype; +class ErrorInstance; +class FunctionPrototype; +class NativeErrorPrototype; - class NativeErrorConstructor : public InternalFunction { - public: - typedef InternalFunction Base; +class NativeErrorConstructor : public InternalFunction { +public: + typedef InternalFunction Base; - static NativeErrorConstructor* create(ExecState* exec, JSGlobalObject* globalObject, Structure* structure, Structure* prototypeStructure, const UString& name) - { - NativeErrorConstructor* constructor = new (NotNull, allocateCell(*exec->heap())) NativeErrorConstructor(globalObject, structure); - constructor->finishCreation(exec, globalObject, prototypeStructure, name); - return constructor; - } - - static const ClassInfo s_info; + static NativeErrorConstructor* create(VM& vm, JSGlobalObject* globalObject, Structure* structure, Structure* prototypeStructure, const String& name) + { + NativeErrorConstructor* constructor = new (NotNull, allocateCell(vm.heap)) NativeErrorConstructor(vm, structure); + constructor->finishCreation(vm, globalObject, prototypeStructure, name); + return constructor; + } - static Structure* createStructure(JSGlobalData& globalData, JSGlobalObject* globalObject, JSValue prototype) - { - return Structure::create(globalData, globalObject, prototype, TypeInfo(ObjectType, StructureFlags), &s_info); - } + DECLARE_INFO; - Structure* errorStructure() { return m_errorStructure.get(); } + static Structure* createStructure(VM& vm, JSGlobalObject* globalObject, JSValue prototype) + { + return Structure::create(vm, globalObject, prototype, TypeInfo(ObjectType, StructureFlags), info()); + } - protected: - void finishCreation(ExecState* exec, JSGlobalObject* globalObject, Structure* prototypeStructure, const UString& name) - { - Base::finishCreation(exec->globalData(), Identifier(exec, name)); - ASSERT(inherits(&s_info)); + Structure* errorStructure() { return m_errorStructure.get(); } - NativeErrorPrototype* prototype = NativeErrorPrototype::create(exec, globalObject, prototypeStructure, name, this); +protected: + void finishCreation(VM&, JSGlobalObject*, Structure* prototypeStructure, const String& name); - putDirect(exec->globalData(), exec->propertyNames().length, jsNumber(1), DontDelete | ReadOnly | DontEnum); // ECMA 15.11.7.5 - putDirect(exec->globalData(), exec->propertyNames().prototype, prototype, DontDelete | ReadOnly | DontEnum); - m_errorStructure.set(exec->globalData(), this, ErrorInstance::createStructure(exec->globalData(), globalObject, prototype)); - ASSERT(m_errorStructure); - ASSERT(m_errorStructure->isObject()); - } +private: + NativeErrorConstructor(VM&, Structure*); + static ConstructType getConstructData(JSCell*, ConstructData&); + static CallType getCallData(JSCell*, CallData&); + static void visitChildren(JSCell*, SlotVisitor&); - private: - NativeErrorConstructor(JSGlobalObject*, Structure*); - static const unsigned StructureFlags = OverridesVisitChildren | InternalFunction::StructureFlags; - static ConstructType getConstructData(JSCell*, ConstructData&); - static CallType getCallData(JSCell*, CallData&); - static void visitChildren(JSCell*, SlotVisitor&); - - WriteBarrier m_errorStructure; - }; + WriteBarrier m_errorStructure; +}; } // namespace JSC