Title: [157438] trunk/Source/WebCore
Revision
157438
Author
[email protected]
Date
2013-10-14 19:47:38 -0700 (Mon, 14 Oct 2013)

Log Message

Don't generate a wasteful isObservable check in isReachableFromOpaqueRoots
https://bugs.webkit.org/show_bug.cgi?id=122802

Reviewed by Mark Hahnenberg.

* bindings/scripts/CodeGeneratorJS.pm: (GenerateImplementation): Don't.

* bindings/scripts/test/JS/JSTestActiveDOMObject.cpp:
* bindings/scripts/test/JS/JSTestCustomNamedGetter.cpp:
* bindings/scripts/test/JS/JSTestEventConstructor.cpp:
* bindings/scripts/test/JS/JSTestEventTarget.cpp:
* bindings/scripts/test/JS/JSTestException.cpp:
* bindings/scripts/test/JS/JSTestInterface.cpp:
* bindings/scripts/test/JS/JSTestMediaQueryListListener.cpp:
* bindings/scripts/test/JS/JSTestNamedConstructor.cpp:
* bindings/scripts/test/JS/JSTestObj.cpp:
* bindings/scripts/test/JS/JSTestOverloadedConstructors.cpp:
* bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.cpp:
* bindings/scripts/test/JS/JSTestTypedefs.cpp:
* bindings/scripts/test/JS/JSattribute.cpp:
* bindings/scripts/test/JS/JSreadonly.cpp:
Updated results.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (157437 => 157438)


--- trunk/Source/WebCore/ChangeLog	2013-10-15 01:06:20 UTC (rev 157437)
+++ trunk/Source/WebCore/ChangeLog	2013-10-15 02:47:38 UTC (rev 157438)
@@ -1,3 +1,28 @@
+2013-10-14  Alexey Proskuryakov  <[email protected]>
+
+        Don't generate a wasteful isObservable check in isReachableFromOpaqueRoots
+        https://bugs.webkit.org/show_bug.cgi?id=122802
+
+        Reviewed by Mark Hahnenberg.
+
+        * bindings/scripts/CodeGeneratorJS.pm: (GenerateImplementation): Don't.
+
+        * bindings/scripts/test/JS/JSTestActiveDOMObject.cpp:
+        * bindings/scripts/test/JS/JSTestCustomNamedGetter.cpp:
+        * bindings/scripts/test/JS/JSTestEventConstructor.cpp:
+        * bindings/scripts/test/JS/JSTestEventTarget.cpp:
+        * bindings/scripts/test/JS/JSTestException.cpp:
+        * bindings/scripts/test/JS/JSTestInterface.cpp:
+        * bindings/scripts/test/JS/JSTestMediaQueryListListener.cpp:
+        * bindings/scripts/test/JS/JSTestNamedConstructor.cpp:
+        * bindings/scripts/test/JS/JSTestObj.cpp:
+        * bindings/scripts/test/JS/JSTestOverloadedConstructors.cpp:
+        * bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.cpp:
+        * bindings/scripts/test/JS/JSTestTypedefs.cpp:
+        * bindings/scripts/test/JS/JSattribute.cpp:
+        * bindings/scripts/test/JS/JSreadonly.cpp:
+        Updated results.
+
 2013-10-14  Samuel White  <[email protected]>
 
         AX: fieldset should have GroupRole and legend should be description.

Modified: trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm (157437 => 157438)


--- trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm	2013-10-15 01:06:20 UTC (rev 157437)
+++ trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm	2013-10-15 02:47:38 UTC (rev 157438)
@@ -2562,7 +2562,6 @@
 
         push(@implContent, "bool JS${interfaceName}Owner::isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown> handle, void*, SlotVisitor& visitor)\n");
         push(@implContent, "{\n");
-        push(@implContent, "    JS${interfaceName}* js${interfaceName} = jsCast<JS${interfaceName}*>(handle.get().asCell());\n");
         # All ActiveDOMObjects implement hasPendingActivity(), but not all of them
         # increment their C++ reference counts when hasPendingActivity() becomes
         # true. As a result, ActiveDOMObjects can be prematurely destroyed before
@@ -2570,21 +2569,37 @@
         # wrappers unconditionally keep ActiveDOMObjects with pending activity alive.
         # FIXME: Fix this lifetime issue in the DOM, and move this hasPendingActivity
         # check below the isObservable check.
+        my $emittedJSCast = 0;
         if ($codeGenerator->InheritsExtendedAttribute($interface, "ActiveDOMObject")) {
+            push(@implContent, "    JS${interfaceName}* js${interfaceName} = jsCast<JS${interfaceName}*>(handle.get().asCell());\n");
+            $emittedJSCast = 1;
             push(@implContent, "    if (js${interfaceName}->impl().hasPendingActivity())\n");
             push(@implContent, "        return true;\n");
         }
         if ($codeGenerator->InheritsExtendedAttribute($interface, "EventTarget")) {
+            if (!$emittedJSCast) {
+                push(@implContent, "    JS${interfaceName}* js${interfaceName} = jsCast<JS${interfaceName}*>(handle.get().asCell());\n");
+                $emittedJSCast = 1;
+            }
             push(@implContent, "    if (js${interfaceName}->impl().isFiringEventListeners())\n");
             push(@implContent, "        return true;\n");
         }
         if ($codeGenerator->InheritsInterface($interface, "Node")) {
+            if (!$emittedJSCast) {
+                push(@implContent, "    JS${interfaceName}* js${interfaceName} = jsCast<JS${interfaceName}*>(handle.get().asCell());\n");
+                $emittedJSCast = 1;
+            }
             push(@implContent, "    if (JSNodeOwner::isReachableFromOpaqueRoots(handle, 0, visitor))\n");
             push(@implContent, "        return true;\n");
         }
-        push(@implContent, "    if (!isObservable(js${interfaceName}))\n");
-        push(@implContent, "        return false;\n");
         if (GetGenerateIsReachable($interface)) {
+            if (!$emittedJSCast) {
+                push(@implContent, "    JS${interfaceName}* js${interfaceName} = jsCast<JS${interfaceName}*>(handle.get().asCell());\n");
+                $emittedJSCast = 1;
+            }
+            push(@implContent, "    if (!isObservable(js${interfaceName}))\n");
+            push(@implContent, "        return false;\n");
+
             my $rootString;
             if (GetGenerateIsReachable($interface) eq "Impl") {
                 $rootString  = "    ${implType}* root = &js${interfaceName}->impl();\n";
@@ -2618,6 +2633,9 @@
             push(@implContent, $rootString);
             push(@implContent, "    return visitor.containsOpaqueRoot(root);\n");
         } else {
+            if (!$emittedJSCast) {
+                push(@implContent, "    UNUSED_PARAM(handle);\n");
+            }
             push(@implContent, "    UNUSED_PARAM(visitor);\n");
             push(@implContent, "    return false;\n");
         }

Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestActiveDOMObject.cpp (157437 => 157438)


--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestActiveDOMObject.cpp	2013-10-15 01:06:20 UTC (rev 157437)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestActiveDOMObject.cpp	2013-10-15 02:47:38 UTC (rev 157438)
@@ -201,9 +201,7 @@
 
 bool JSTestActiveDOMObjectOwner::isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown> handle, void*, SlotVisitor& visitor)
 {
-    JSTestActiveDOMObject* jsTestActiveDOMObject = jsCast<JSTestActiveDOMObject*>(handle.get().asCell());
-    if (!isObservable(jsTestActiveDOMObject))
-        return false;
+    UNUSED_PARAM(handle);
     UNUSED_PARAM(visitor);
     return false;
 }

Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestCustomNamedGetter.cpp (157437 => 157438)


--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestCustomNamedGetter.cpp	2013-10-15 01:06:20 UTC (rev 157437)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestCustomNamedGetter.cpp	2013-10-15 02:47:38 UTC (rev 157438)
@@ -181,9 +181,7 @@
 
 bool JSTestCustomNamedGetterOwner::isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown> handle, void*, SlotVisitor& visitor)
 {
-    JSTestCustomNamedGetter* jsTestCustomNamedGetter = jsCast<JSTestCustomNamedGetter*>(handle.get().asCell());
-    if (!isObservable(jsTestCustomNamedGetter))
-        return false;
+    UNUSED_PARAM(handle);
     UNUSED_PARAM(visitor);
     return false;
 }

Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestEventConstructor.cpp (157437 => 157438)


--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestEventConstructor.cpp	2013-10-15 01:06:20 UTC (rev 157437)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestEventConstructor.cpp	2013-10-15 02:47:38 UTC (rev 157438)
@@ -207,9 +207,7 @@
 
 bool JSTestEventConstructorOwner::isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown> handle, void*, SlotVisitor& visitor)
 {
-    JSTestEventConstructor* jsTestEventConstructor = jsCast<JSTestEventConstructor*>(handle.get().asCell());
-    if (!isObservable(jsTestEventConstructor))
-        return false;
+    UNUSED_PARAM(handle);
     UNUSED_PARAM(visitor);
     return false;
 }

Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestEventTarget.cpp (157437 => 157438)


--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestEventTarget.cpp	2013-10-15 01:06:20 UTC (rev 157437)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestEventTarget.cpp	2013-10-15 02:47:38 UTC (rev 157438)
@@ -293,8 +293,6 @@
     JSTestEventTarget* jsTestEventTarget = jsCast<JSTestEventTarget*>(handle.get().asCell());
     if (jsTestEventTarget->impl().isFiringEventListeners())
         return true;
-    if (!isObservable(jsTestEventTarget))
-        return false;
     UNUSED_PARAM(visitor);
     return false;
 }

Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestException.cpp (157437 => 157438)


--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestException.cpp	2013-10-15 01:06:20 UTC (rev 157437)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestException.cpp	2013-10-15 02:47:38 UTC (rev 157438)
@@ -150,9 +150,7 @@
 
 bool JSTestExceptionOwner::isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown> handle, void*, SlotVisitor& visitor)
 {
-    JSTestException* jsTestException = jsCast<JSTestException*>(handle.get().asCell());
-    if (!isObservable(jsTestException))
-        return false;
+    UNUSED_PARAM(handle);
     UNUSED_PARAM(visitor);
     return false;
 }

Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestInterface.cpp (157437 => 157438)


--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestInterface.cpp	2013-10-15 01:06:20 UTC (rev 157437)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestInterface.cpp	2013-10-15 02:47:38 UTC (rev 157438)
@@ -712,8 +712,6 @@
     JSTestInterface* jsTestInterface = jsCast<JSTestInterface*>(handle.get().asCell());
     if (jsTestInterface->impl().hasPendingActivity())
         return true;
-    if (!isObservable(jsTestInterface))
-        return false;
     UNUSED_PARAM(visitor);
     return false;
 }

Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestMediaQueryListListener.cpp (157437 => 157438)


--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestMediaQueryListListener.cpp	2013-10-15 01:06:20 UTC (rev 157437)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestMediaQueryListListener.cpp	2013-10-15 02:47:38 UTC (rev 157438)
@@ -165,9 +165,7 @@
 
 bool JSTestMediaQueryListListenerOwner::isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown> handle, void*, SlotVisitor& visitor)
 {
-    JSTestMediaQueryListListener* jsTestMediaQueryListListener = jsCast<JSTestMediaQueryListListener*>(handle.get().asCell());
-    if (!isObservable(jsTestMediaQueryListListener))
-        return false;
+    UNUSED_PARAM(handle);
     UNUSED_PARAM(visitor);
     return false;
 }

Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestNamedConstructor.cpp (157437 => 157438)


--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestNamedConstructor.cpp	2013-10-15 01:06:20 UTC (rev 157437)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestNamedConstructor.cpp	2013-10-15 02:47:38 UTC (rev 157438)
@@ -192,8 +192,6 @@
     JSTestNamedConstructor* jsTestNamedConstructor = jsCast<JSTestNamedConstructor*>(handle.get().asCell());
     if (jsTestNamedConstructor->impl().hasPendingActivity())
         return true;
-    if (!isObservable(jsTestNamedConstructor))
-        return false;
     UNUSED_PARAM(visitor);
     return false;
 }

Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp (157437 => 157438)


--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp	2013-10-15 01:06:20 UTC (rev 157437)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp	2013-10-15 02:47:38 UTC (rev 157438)
@@ -3315,9 +3315,7 @@
 
 bool JSTestObjOwner::isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown> handle, void*, SlotVisitor& visitor)
 {
-    JSTestObj* jsTestObj = jsCast<JSTestObj*>(handle.get().asCell());
-    if (!isObservable(jsTestObj))
-        return false;
+    UNUSED_PARAM(handle);
     UNUSED_PARAM(visitor);
     return false;
 }

Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestOverloadedConstructors.cpp (157437 => 157438)


--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestOverloadedConstructors.cpp	2013-10-15 01:06:20 UTC (rev 157437)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestOverloadedConstructors.cpp	2013-10-15 02:47:38 UTC (rev 157438)
@@ -212,9 +212,7 @@
 
 bool JSTestOverloadedConstructorsOwner::isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown> handle, void*, SlotVisitor& visitor)
 {
-    JSTestOverloadedConstructors* jsTestOverloadedConstructors = jsCast<JSTestOverloadedConstructors*>(handle.get().asCell());
-    if (!isObservable(jsTestOverloadedConstructors))
-        return false;
+    UNUSED_PARAM(handle);
     UNUSED_PARAM(visitor);
     return false;
 }

Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.cpp (157437 => 157438)


--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.cpp	2013-10-15 01:06:20 UTC (rev 157437)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.cpp	2013-10-15 02:47:38 UTC (rev 157438)
@@ -247,9 +247,7 @@
 
 bool JSTestSerializedScriptValueInterfaceOwner::isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown> handle, void*, SlotVisitor& visitor)
 {
-    JSTestSerializedScriptValueInterface* jsTestSerializedScriptValueInterface = jsCast<JSTestSerializedScriptValueInterface*>(handle.get().asCell());
-    if (!isObservable(jsTestSerializedScriptValueInterface))
-        return false;
+    UNUSED_PARAM(handle);
     UNUSED_PARAM(visitor);
     return false;
 }

Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestTypedefs.cpp (157437 => 157438)


--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestTypedefs.cpp	2013-10-15 01:06:20 UTC (rev 157437)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestTypedefs.cpp	2013-10-15 02:47:38 UTC (rev 157438)
@@ -568,9 +568,7 @@
 
 bool JSTestTypedefsOwner::isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown> handle, void*, SlotVisitor& visitor)
 {
-    JSTestTypedefs* jsTestTypedefs = jsCast<JSTestTypedefs*>(handle.get().asCell());
-    if (!isObservable(jsTestTypedefs))
-        return false;
+    UNUSED_PARAM(handle);
     UNUSED_PARAM(visitor);
     return false;
 }

Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSattribute.cpp (157437 => 157438)


--- trunk/Source/WebCore/bindings/scripts/test/JS/JSattribute.cpp	2013-10-15 01:06:20 UTC (rev 157437)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSattribute.cpp	2013-10-15 02:47:38 UTC (rev 157438)
@@ -150,9 +150,7 @@
 
 bool JSattributeOwner::isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown> handle, void*, SlotVisitor& visitor)
 {
-    JSattribute* jsattribute = jsCast<JSattribute*>(handle.get().asCell());
-    if (!isObservable(jsattribute))
-        return false;
+    UNUSED_PARAM(handle);
     UNUSED_PARAM(visitor);
     return false;
 }

Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSreadonly.cpp (157437 => 157438)


--- trunk/Source/WebCore/bindings/scripts/test/JS/JSreadonly.cpp	2013-10-15 01:06:20 UTC (rev 157437)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSreadonly.cpp	2013-10-15 02:47:38 UTC (rev 157438)
@@ -137,9 +137,7 @@
 
 bool JSreadonlyOwner::isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown> handle, void*, SlotVisitor& visitor)
 {
-    JSreadonly* jsreadonly = jsCast<JSreadonly*>(handle.get().asCell());
-    if (!isObservable(jsreadonly))
-        return false;
+    UNUSED_PARAM(handle);
     UNUSED_PARAM(visitor);
     return false;
 }
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to