WebKit Bugzilla
Attachment 358079 Details for
Bug 193037
: [JSC] Remove one indirection in JSObject::toStringName
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-193037-20181227015208.patch (text/plain), 8.21 KB, created by
Yusuke Suzuki
on 2018-12-26 08:52:09 PST
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Yusuke Suzuki
Created:
2018-12-26 08:52:09 PST
Size:
8.21 KB
patch
obsolete
>Subversion Revision: 239552 >diff --git a/Source/JavaScriptCore/ChangeLog b/Source/JavaScriptCore/ChangeLog >index ce49b369d01e4f4220910366ab524ef9dcee2e28..0963dd8d325226f2ebd9e6ca61130d2e445828ba 100644 >--- a/Source/JavaScriptCore/ChangeLog >+++ b/Source/JavaScriptCore/ChangeLog >@@ -1,3 +1,26 @@ >+2018-12-26 Yusuke Suzuki <yusukesuzuki@slowstart.org> >+ >+ [JSC] Remove one indirection in JSObject::toStringName >+ https://bugs.webkit.org/show_bug.cgi?id=193037 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ We should not have additional one-level indirection in JSObject::toStringName. >+ JSObject::toStringName is dispatched through methodTable. Even after that, we >+ need to call JSObject::className function through methodTable again. But className >+ function is rarely defined. So instead of introducing this indirection here, >+ classes having className functions should have toStringName function too. This can >+ remove one-level indirection in toStringName in major cases. >+ >+ * API/JSCallbackObject.h: >+ * API/JSCallbackObjectFunctions.h: >+ (JSC::JSCallbackObject<Parent>::toStringName): >+ * debugger/DebuggerScope.cpp: >+ (JSC::DebuggerScope::toStringName): >+ * debugger/DebuggerScope.h: >+ * runtime/JSObject.cpp: >+ (JSC::JSObject::toStringName): >+ > 2018-12-25 Fujii Hironori <Hironori.Fujii@sony.com> > > [JSC][Win][Clang] warning: implicit conversion from 'size_t' (aka 'unsigned long long') to 'int32_t' (aka 'int') changes value from 18446744073709551552 to -64 [-Wconstant-conversion] >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index cc1b98ade03d35cac7252acf16c46af23d009b4f..85c57e917fd1366b19b6355846aa67c930294f66 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,18 @@ >+2018-12-26 Yusuke Suzuki <yusukesuzuki@slowstart.org> >+ >+ [JSC] Remove one indirection in JSObject::toStringName >+ https://bugs.webkit.org/show_bug.cgi?id=193037 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Use old JSObject::toStringName function here. >+ >+ * bindings/js/JSDOMConstructorBase.cpp: >+ (WebCore::JSDOMConstructorBase::className): >+ (WebCore::JSDOMConstructorBase::toStringName): >+ * bindings/js/JSDOMConstructorBase.h: >+ (WebCore::JSDOMConstructorBase::className): Deleted. >+ > 2018-12-24 Fujii Hironori <Hironori.Fujii@sony.com> > > Remove "using namespace std;" >diff --git a/Source/JavaScriptCore/API/JSCallbackObject.h b/Source/JavaScriptCore/API/JSCallbackObject.h >index 53a0f7453f65717f4fdf43e68a1c778aa46fa600..27b283fc16bb2b34098a39360d1707f8c2180c83 100644 >--- a/Source/JavaScriptCore/API/JSCallbackObject.h >+++ b/Source/JavaScriptCore/API/JSCallbackObject.h >@@ -187,6 +187,7 @@ class JSCallbackObject final : public Parent { > > private: > static String className(const JSObject*, VM&); >+ static String toStringName(const JSObject*, ExecState*); > > static JSValue defaultValue(const JSObject*, ExecState*, PreferredPrimitiveType); > >diff --git a/Source/JavaScriptCore/API/JSCallbackObjectFunctions.h b/Source/JavaScriptCore/API/JSCallbackObjectFunctions.h >index 4f4b7d71ee0929557c28e20b8ad87c3db5e7cbd4..ae3a6fe3acf9c6a80394e1d734fa317d908fae2c 100644 >--- a/Source/JavaScriptCore/API/JSCallbackObjectFunctions.h >+++ b/Source/JavaScriptCore/API/JSCallbackObjectFunctions.h >@@ -139,6 +139,15 @@ String JSCallbackObject<Parent>::className(const JSObject* object, VM& vm) > return Parent::className(object, vm); > } > >+template <class Parent> >+String JSCallbackObject<Parent>::toStringName(const JSObject* object, ExecState* exec) >+{ >+ VM& vm = exec->vm(); >+ const ClassInfo* info = object->classInfo(vm); >+ ASSERT(info); >+ return info->methodTable.className(object, vm); >+} >+ > template <class Parent> > bool JSCallbackObject<Parent>::getOwnPropertySlot(JSObject* object, ExecState* exec, PropertyName propertyName, PropertySlot& slot) > { >diff --git a/Source/JavaScriptCore/debugger/DebuggerScope.cpp b/Source/JavaScriptCore/debugger/DebuggerScope.cpp >index e5adad98043a88828d1dac722bb46067d209d6e5..b1e7aec54d2d0764d14f96df12f04c7960a5de39 100644 >--- a/Source/JavaScriptCore/debugger/DebuggerScope.cpp >+++ b/Source/JavaScriptCore/debugger/DebuggerScope.cpp >@@ -77,6 +77,17 @@ String DebuggerScope::className(const JSObject* object, VM& vm) > return thisObject->methodTable(vm)->className(thisObject, vm); > } > >+String DebuggerScope::toStringName(const JSObject* object, ExecState* exec) >+{ >+ const DebuggerScope* scope = jsCast<const DebuggerScope*>(object); >+ // We cannot assert that scope->isValid() because the TypeProfiler may encounter an invalidated >+ // DebuggerScope in its log entries. We just need to handle it appropriately as below. >+ if (!scope->isValid()) >+ return String(); >+ JSObject* thisObject = JSScope::objectAtScope(scope->jsScope()); >+ return thisObject->methodTable(exec->vm())->toStringName(thisObject, exec); >+} >+ > bool DebuggerScope::getOwnPropertySlot(JSObject* object, ExecState* exec, PropertyName propertyName, PropertySlot& slot) > { > DebuggerScope* scope = jsCast<DebuggerScope*>(object); >diff --git a/Source/JavaScriptCore/debugger/DebuggerScope.h b/Source/JavaScriptCore/debugger/DebuggerScope.h >index cb21ba4aff6a0f13249878b148ea46277f9a5205..c92d3d0f74333bbb5e00b5b2c48636b63cc1e341 100644 >--- a/Source/JavaScriptCore/debugger/DebuggerScope.h >+++ b/Source/JavaScriptCore/debugger/DebuggerScope.h >@@ -42,6 +42,7 @@ class DebuggerScope final : public JSNonFinalObject { > > static void visitChildren(JSCell*, SlotVisitor&); > static String className(const JSObject*, VM&); >+ static String toStringName(const JSObject*, ExecState*); > static bool getOwnPropertySlot(JSObject*, ExecState*, PropertyName, PropertySlot&); > static bool put(JSCell*, ExecState*, PropertyName, JSValue, PutPropertySlot&); > static bool deleteProperty(JSCell*, ExecState*, PropertyName); >diff --git a/Source/JavaScriptCore/runtime/JSObject.cpp b/Source/JavaScriptCore/runtime/JSObject.cpp >index e803afcc63d1c37460c4d8ef318532eef7e567e8..ca453d89cfbe4df14565bac0a6f882b5ba46d861 100644 >--- a/Source/JavaScriptCore/runtime/JSObject.cpp >+++ b/Source/JavaScriptCore/runtime/JSObject.cpp >@@ -519,7 +519,7 @@ String JSObject::toStringName(const JSObject* object, ExecState* exec) > VM& vm = exec->vm(); > const ClassInfo* info = object->classInfo(vm); > ASSERT(info); >- return info->methodTable.className(object, vm); >+ return info->className; > } > > String JSObject::calculatedClassName(JSObject* object) >diff --git a/Source/WebCore/bindings/js/JSDOMConstructorBase.cpp b/Source/WebCore/bindings/js/JSDOMConstructorBase.cpp >index 3cc2f4b0d2f939fc28d4168aa83812295acf2b9a..96bad245671dd902efe4c3e2bfdc1340daf5ca44 100644 >--- a/Source/WebCore/bindings/js/JSDOMConstructorBase.cpp >+++ b/Source/WebCore/bindings/js/JSDOMConstructorBase.cpp >@@ -43,4 +43,17 @@ CallType JSDOMConstructorBase::getCallData(JSCell*, CallData& callData) > return CallType::Host; > } > >+String JSDOMConstructorBase::className(const JSObject*, JSC::VM&) >+{ >+ return "Function"_s; >+} >+ >+String JSDOMConstructorBase::toStringName(const JSObject* object, JSC::ExecState* exec) >+{ >+ VM& vm = exec->vm(); >+ const ClassInfo* info = object->classInfo(vm); >+ ASSERT(info); >+ return info->methodTable.className(object, vm); >+} >+ > } // namespace WebCore >diff --git a/Source/WebCore/bindings/js/JSDOMConstructorBase.h b/Source/WebCore/bindings/js/JSDOMConstructorBase.h >index cd24c083702ec729e3c42a3fbb917529e5e8717d..01ecdd4e30a8b89cbf6f07d82afe0a51601b5a6c 100644 >--- a/Source/WebCore/bindings/js/JSDOMConstructorBase.h >+++ b/Source/WebCore/bindings/js/JSDOMConstructorBase.h >@@ -38,6 +38,7 @@ class JSDOMConstructorBase : public JSDOMObject { > } > > static String className(const JSObject*, JSC::VM&); >+ static String toStringName(const JSObject*, JSC::ExecState*); > static JSC::CallType getCallData(JSCell*, JSC::CallData&); > }; > >@@ -46,9 +47,4 @@ inline JSC::Structure* JSDOMConstructorBase::createStructure(JSC::VM& vm, JSC::J > return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info()); > } > >-inline String JSDOMConstructorBase::className(const JSObject*, JSC::VM&) >-{ >- return "Function"_s; >-} >- > } // namespace WebCore
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 193037
: 358079