diff options
Diffstat (limited to 'Source/JavaScriptCore/runtime/JSAPIValueWrapper.h')
-rw-r--r-- | Source/JavaScriptCore/runtime/JSAPIValueWrapper.h | 70 |
1 files changed, 36 insertions, 34 deletions
diff --git a/Source/JavaScriptCore/runtime/JSAPIValueWrapper.h b/Source/JavaScriptCore/runtime/JSAPIValueWrapper.h index f0910951b..66e61c70d 100644 --- a/Source/JavaScriptCore/runtime/JSAPIValueWrapper.h +++ b/Source/JavaScriptCore/runtime/JSAPIValueWrapper.h @@ -30,49 +30,51 @@ namespace JSC { - class JSAPIValueWrapper : public JSCell { - friend JSValue jsAPIValueWrapper(ExecState*, JSValue); - public: - typedef JSCell Base; +class JSAPIValueWrapper : public JSCell { + friend JSValue jsAPIValueWrapper(ExecState*, JSValue); +public: + typedef JSCell Base; + static const unsigned StructureFlags = Base::StructureFlags | StructureIsImmortal; - JSValue value() const { return m_value.get(); } + JSValue value() const { return m_value.get(); } - static Structure* createStructure(VM& vm, JSGlobalObject* globalObject, JSValue prototype) - { - return Structure::create(vm, globalObject, prototype, TypeInfo(APIValueWrapperType, OverridesVisitChildren | OverridesGetPropertyNames), &s_info); - } - - static JS_EXPORTDATA const ClassInfo s_info; - - static JSAPIValueWrapper* create(ExecState* exec, JSValue value) - { - JSAPIValueWrapper* wrapper = new (NotNull, allocateCell<JSAPIValueWrapper>(*exec->heap())) JSAPIValueWrapper(exec); - wrapper->finishCreation(exec, value); - return wrapper; - } + static Structure* createStructure(VM& vm, JSGlobalObject* globalObject, JSValue prototype) + { + return Structure::create(vm, globalObject, prototype, TypeInfo(APIValueWrapperType, OverridesGetPropertyNames), info()); + } - protected: - void finishCreation(ExecState* exec, JSValue value) - { - Base::finishCreation(exec->vm()); - m_value.set(exec->vm(), this, value); - ASSERT(!value.isCell()); - } + DECLARE_EXPORT_INFO; - private: - JSAPIValueWrapper(ExecState* exec) - : JSCell(exec->vm(), exec->vm().apiWrapperStructure.get()) - { - } + static JSAPIValueWrapper* create(ExecState* exec, JSValue value) + { + VM& vm = exec->vm(); + JSAPIValueWrapper* wrapper = new (NotNull, allocateCell<JSAPIValueWrapper>(vm.heap)) JSAPIValueWrapper(exec); + wrapper->finishCreation(vm, value); + return wrapper; + } - WriteBarrier<Unknown> m_value; - }; +protected: + void finishCreation(VM& vm, JSValue value) + { + Base::finishCreation(vm); + m_value.set(vm, this, value); + ASSERT(!value.isCell()); + } - inline JSValue jsAPIValueWrapper(ExecState* exec, JSValue value) +private: + JSAPIValueWrapper(ExecState* exec) + : JSCell(exec->vm(), exec->vm().apiWrapperStructure.get()) { - return JSAPIValueWrapper::create(exec, value); } + WriteBarrier<Unknown> m_value; +}; + +inline JSValue jsAPIValueWrapper(ExecState* exec, JSValue value) +{ + return JSAPIValueWrapper::create(exec, value); +} + } // namespace JSC #endif // JSAPIValueWrapper_h |