Title: [283160] trunk/Source/_javascript_Core
Revision
283160
Author
[email protected]
Date
2021-09-28 02:39:40 -0700 (Tue, 28 Sep 2021)

Log Message

Tweak isCallable() to early return `true` for InternalFunction instances
https://bugs.webkit.org/show_bug.cgi?id=230869

Reviewed by Yusuke Suzuki.

With this change, isCallable() avoids calling into InternalFunction::getCallData(),
which is concurrency-aware and guaranteed to never return CallData::Type::None.
We have a similar optimization for JSFunction.

* runtime/JSCellInlines.h:
(JSC::JSCell::isCallableWithConcurrency):

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (283159 => 283160)


--- trunk/Source/_javascript_Core/ChangeLog	2021-09-28 06:45:49 UTC (rev 283159)
+++ trunk/Source/_javascript_Core/ChangeLog	2021-09-28 09:39:40 UTC (rev 283160)
@@ -1,3 +1,17 @@
+2021-09-28  Alexey Shvayka  <[email protected]>
+
+        Tweak isCallable() to early return `true` for InternalFunction instances
+        https://bugs.webkit.org/show_bug.cgi?id=230869
+
+        Reviewed by Yusuke Suzuki.
+
+        With this change, isCallable() avoids calling into InternalFunction::getCallData(),
+        which is concurrency-aware and guaranteed to never return CallData::Type::None.
+        We have a similar optimization for JSFunction.
+
+        * runtime/JSCellInlines.h:
+        (JSC::JSCell::isCallableWithConcurrency):
+
 2021-09-27  Saam Barati  <[email protected]>
 
         Build an unlinked baseline JIT

Modified: trunk/Source/_javascript_Core/runtime/JSCellInlines.h (283159 => 283160)


--- trunk/Source/_javascript_Core/runtime/JSCellInlines.h	2021-09-28 06:45:49 UTC (rev 283159)
+++ trunk/Source/_javascript_Core/runtime/JSCellInlines.h	2021-09-28 09:39:40 UTC (rev 283160)
@@ -254,15 +254,13 @@
 {
     if (!isObject())
         return TriState::False;
-    if (type() == JSFunctionType)
+    // JSFunction and InternalFunction assert during construction that derived classes don't override getCallData,
+    // which guarantees that CallData::Type::None is never returned.
+    if (type() == JSFunctionType || type() == InternalFunctionType)
         return TriState::True;
     if (inlineTypeFlags() & OverridesGetCallData) {
         if constexpr (concurrency == Concurrency::MainThread)
             return (methodTable(vm)->getCallData(this).type != CallData::Type::None) ? TriState::True : TriState::False;
-        // We know that InternalFunction::getCallData is concurrency aware. Plus, derived classes of InternalFunction never
-        // override getCallData (this is ensured by ASSERT in InternalFunction).
-        if (type() == InternalFunctionType)
-            return (methodTable(vm)->getCallData(this).type != CallData::Type::None) ? TriState::True : TriState::False;
         return TriState::Indeterminate;
     }
     return TriState::False;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to