From 7d596f14830c02a3ee80b60f3c4d2bdabf3a017b Mon Sep 17 00:00:00 2001 From: Ivailo Monev Date: Tue, 26 Nov 2019 02:52:39 +0000 Subject: [PATCH] move info member to bases classes of JSCallbackObject Signed-off-by: Ivailo Monev --- src/3rdparty/javascriptcore/API/JSCallbackObject.cpp | 4 ---- src/3rdparty/javascriptcore/API/JSCallbackObject.h | 4 +--- src/3rdparty/javascriptcore/API/JSCallbackObjectFunctions.h | 2 +- src/3rdparty/javascriptcore/API/JSObjectRef.cpp | 8 ++++---- src/3rdparty/javascriptcore/runtime/JSGlobalObject.cpp | 2 ++ src/3rdparty/javascriptcore/runtime/JSGlobalObject.h | 3 +++ src/3rdparty/javascriptcore/runtime/JSObject.cpp | 2 ++ src/3rdparty/javascriptcore/runtime/JSObject.h | 2 ++ 8 files changed, 15 insertions(+), 12 deletions(-) diff --git a/src/3rdparty/javascriptcore/API/JSCallbackObject.cpp b/src/3rdparty/javascriptcore/API/JSCallbackObject.cpp index fd04b768e..9a2254dc4 100644 --- a/src/3rdparty/javascriptcore/API/JSCallbackObject.cpp +++ b/src/3rdparty/javascriptcore/API/JSCallbackObject.cpp @@ -34,8 +34,4 @@ namespace JSC { ASSERT_CLASS_FITS_IN_CELL(JSCallbackObject); ASSERT_CLASS_FITS_IN_CELL(JSCallbackObject); -// Define the two types of JSCallbackObjects we support. -template <> const ClassInfo JSCallbackObject::info = { "CallbackObject", 0, 0, 0 }; -template <> const ClassInfo JSCallbackObject::info = { "CallbackGlobalObject", 0, 0, 0 }; - } // namespace JSC diff --git a/src/3rdparty/javascriptcore/API/JSCallbackObject.h b/src/3rdparty/javascriptcore/API/JSCallbackObject.h index 1c3ec1503..225851e62 100644 --- a/src/3rdparty/javascriptcore/API/JSCallbackObject.h +++ b/src/3rdparty/javascriptcore/API/JSCallbackObject.h @@ -43,8 +43,6 @@ public: void setPrivate(void* data); void* getPrivate(); - static const ClassInfo info; - JSClassRef classRef() const { return m_callbackObjectData->jsClass; } bool inherits(JSClassRef) const; @@ -77,7 +75,7 @@ private: virtual ConstructType getConstructData(ConstructData&); virtual CallType getCallData(CallData&); - virtual const ClassInfo* classInfo() const { return &info; } + virtual const ClassInfo* classInfo() const { return &Base::info; } void init(ExecState*); diff --git a/src/3rdparty/javascriptcore/API/JSCallbackObjectFunctions.h b/src/3rdparty/javascriptcore/API/JSCallbackObjectFunctions.h index 0802bb451..e781b1961 100644 --- a/src/3rdparty/javascriptcore/API/JSCallbackObjectFunctions.h +++ b/src/3rdparty/javascriptcore/API/JSCallbackObjectFunctions.h @@ -42,7 +42,7 @@ namespace JSC { template inline JSCallbackObject* JSCallbackObject::asCallbackObject(JSValue value) { - Q_ASSERT(asObject(value)->inherits(&info)); + Q_ASSERT(asObject(value)->inherits(&Base::info)); return static_cast(asObject(value)); } diff --git a/src/3rdparty/javascriptcore/API/JSObjectRef.cpp b/src/3rdparty/javascriptcore/API/JSObjectRef.cpp index eb86ffea2..02f0b7ec3 100644 --- a/src/3rdparty/javascriptcore/API/JSObjectRef.cpp +++ b/src/3rdparty/javascriptcore/API/JSObjectRef.cpp @@ -341,9 +341,9 @@ void* JSObjectGetPrivate(JSObjectRef object) { JSObject* jsObject = toJS(object); - if (jsObject->inherits(&JSCallbackObject::info)) + if (jsObject->inherits(&JSGlobalObject::info)) return static_cast*>(jsObject)->getPrivate(); - else if (jsObject->inherits(&JSCallbackObject::info)) + else if (jsObject->inherits(&JSObject::info)) return static_cast*>(jsObject)->getPrivate(); return 0; @@ -353,10 +353,10 @@ bool JSObjectSetPrivate(JSObjectRef object, void* data) { JSObject* jsObject = toJS(object); - if (jsObject->inherits(&JSCallbackObject::info)) { + if (jsObject->inherits(&JSGlobalObject::info)) { static_cast*>(jsObject)->setPrivate(data); return true; - } else if (jsObject->inherits(&JSCallbackObject::info)) { + } else if (jsObject->inherits(&JSObject::info)) { static_cast*>(jsObject)->setPrivate(data); return true; } diff --git a/src/3rdparty/javascriptcore/runtime/JSGlobalObject.cpp b/src/3rdparty/javascriptcore/runtime/JSGlobalObject.cpp index 7f6c75c47..217c6e980 100644 --- a/src/3rdparty/javascriptcore/runtime/JSGlobalObject.cpp +++ b/src/3rdparty/javascriptcore/runtime/JSGlobalObject.cpp @@ -72,6 +72,8 @@ namespace JSC { ASSERT_CLASS_FITS_IN_CELL(JSGlobalObject); +const ClassInfo JSGlobalObject::info = { "CallbackGlobalObject", 0, 0, 0 }; + static inline void markIfNeeded(MarkStack& markStack, JSValue v) { if (v) diff --git a/src/3rdparty/javascriptcore/runtime/JSGlobalObject.h b/src/3rdparty/javascriptcore/runtime/JSGlobalObject.h index 27e2fe1f6..1f53f5d6a 100644 --- a/src/3rdparty/javascriptcore/runtime/JSGlobalObject.h +++ b/src/3rdparty/javascriptcore/runtime/JSGlobalObject.h @@ -49,6 +49,9 @@ namespace JSC { class RegisterFile; class JSGlobalObject : public JSVariableObject { + public: + static const ClassInfo info; + protected: using JSVariableObject::JSVariableObjectData; diff --git a/src/3rdparty/javascriptcore/runtime/JSObject.cpp b/src/3rdparty/javascriptcore/runtime/JSObject.cpp index e11bbb426..1cb135593 100644 --- a/src/3rdparty/javascriptcore/runtime/JSObject.cpp +++ b/src/3rdparty/javascriptcore/runtime/JSObject.cpp @@ -42,6 +42,8 @@ namespace JSC { ASSERT_CLASS_FITS_IN_CELL(JSObject); +const ClassInfo JSObject::info = { "CallbackObject", 0, 0, 0 }; + static inline void getClassPropertyNames(ExecState* exec, const ClassInfo* classInfo, PropertyNameArray& propertyNames, EnumerationMode mode) { // Add properties from the static hashtables of properties diff --git a/src/3rdparty/javascriptcore/runtime/JSObject.h b/src/3rdparty/javascriptcore/runtime/JSObject.h index 457a44e2a..161cab545 100644 --- a/src/3rdparty/javascriptcore/runtime/JSObject.h +++ b/src/3rdparty/javascriptcore/runtime/JSObject.h @@ -89,6 +89,8 @@ namespace JSC { virtual UString className() const; + static const ClassInfo info; + JSValue get(ExecState*, const Identifier& propertyName) const; JSValue get(ExecState*, unsigned propertyName) const; -- 2.11.0