CodeGeneratorJS's InstanceNeedsVisitChildren should not return true just because...
authormark.lam@apple.com <mark.lam@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 1 Jun 2017 00:12:51 +0000 (00:12 +0000)
committermark.lam@apple.com <mark.lam@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 1 Jun 2017 00:12:51 +0000 (00:12 +0000)
https://bugs.webkit.org/show_bug.cgi?id=172782
<rdar://problem/32498266>

Reviewed by Chris Dumez.

No new tests needed.  This change is covered by existing binding tests.

InstanceNeedsVisitChildren should also not check the IsJSBuiltinConstructor
condition, which is not used to emit any additional code in the visitChildren
override.

The other conditions for generating visitChildren() are adequate if the class
needs to override visitChildren.  Currently, we're generating some visitChildren()
methods that only call its Base::visitChildren().  Removing the "is / extends
EventTarget" conditions removes those unneeded visitChildren overrides.

* bindings/scripts/CodeGeneratorJS.pm:
(InstanceNeedsVisitChildren):
* bindings/scripts/test/JS/JSTestClassWithJSBuiltinConstructor.cpp:
(WebCore::JSTestClassWithJSBuiltinConstructor::visitChildren): Deleted.
* bindings/scripts/test/JS/JSTestClassWithJSBuiltinConstructor.h:
* bindings/scripts/test/JS/JSTestDOMJIT.cpp:
(WebCore::JSTestDOMJIT::visitChildren): Deleted.
* bindings/scripts/test/JS/JSTestDOMJIT.h:
* bindings/scripts/test/JS/JSTestEventTarget.cpp:
(WebCore::JSTestEventTarget::visitChildren): Deleted.
* bindings/scripts/test/JS/JSTestEventTarget.h:
* bindings/scripts/test/JS/JSTestJSBuiltinConstructor.cpp:
(WebCore::JSTestJSBuiltinConstructor::visitChildren): Deleted.
* bindings/scripts/test/JS/JSTestJSBuiltinConstructor.h:
* bindings/scripts/test/JS/JSTestNode.cpp:
(WebCore::JSTestNode::visitChildren): Deleted.
* bindings/scripts/test/JS/JSTestNode.h:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@217642 268f45cc-cd09-0410-ab3c-d52691b4dbfc

12 files changed:
Source/WebCore/ChangeLog
Source/WebCore/bindings/scripts/CodeGeneratorJS.pm
Source/WebCore/bindings/scripts/test/JS/JSTestClassWithJSBuiltinConstructor.cpp
Source/WebCore/bindings/scripts/test/JS/JSTestClassWithJSBuiltinConstructor.h
Source/WebCore/bindings/scripts/test/JS/JSTestDOMJIT.cpp
Source/WebCore/bindings/scripts/test/JS/JSTestDOMJIT.h
Source/WebCore/bindings/scripts/test/JS/JSTestEventTarget.cpp
Source/WebCore/bindings/scripts/test/JS/JSTestEventTarget.h
Source/WebCore/bindings/scripts/test/JS/JSTestJSBuiltinConstructor.cpp
Source/WebCore/bindings/scripts/test/JS/JSTestJSBuiltinConstructor.h
Source/WebCore/bindings/scripts/test/JS/JSTestNode.cpp
Source/WebCore/bindings/scripts/test/JS/JSTestNode.h

index e36f02a..b1c714d 100644 (file)
@@ -1,3 +1,40 @@
+2017-05-31  Mark Lam  <mark.lam@apple.com>
+
+        CodeGeneratorJS's InstanceNeedsVisitChildren should not return true just because a class is / extends EventTarget.
+        https://bugs.webkit.org/show_bug.cgi?id=172782
+        <rdar://problem/32498266>
+
+        Reviewed by Chris Dumez.
+
+        No new tests needed.  This change is covered by existing binding tests.
+
+        InstanceNeedsVisitChildren should also not check the IsJSBuiltinConstructor
+        condition, which is not used to emit any additional code in the visitChildren
+        override.
+
+        The other conditions for generating visitChildren() are adequate if the class
+        needs to override visitChildren.  Currently, we're generating some visitChildren()
+        methods that only call its Base::visitChildren().  Removing the "is / extends
+        EventTarget" conditions removes those unneeded visitChildren overrides.
+
+        * bindings/scripts/CodeGeneratorJS.pm:
+        (InstanceNeedsVisitChildren):
+        * bindings/scripts/test/JS/JSTestClassWithJSBuiltinConstructor.cpp:
+        (WebCore::JSTestClassWithJSBuiltinConstructor::visitChildren): Deleted.
+        * bindings/scripts/test/JS/JSTestClassWithJSBuiltinConstructor.h:
+        * bindings/scripts/test/JS/JSTestDOMJIT.cpp:
+        (WebCore::JSTestDOMJIT::visitChildren): Deleted.
+        * bindings/scripts/test/JS/JSTestDOMJIT.h:
+        * bindings/scripts/test/JS/JSTestEventTarget.cpp:
+        (WebCore::JSTestEventTarget::visitChildren): Deleted.
+        * bindings/scripts/test/JS/JSTestEventTarget.h:
+        * bindings/scripts/test/JS/JSTestJSBuiltinConstructor.cpp:
+        (WebCore::JSTestJSBuiltinConstructor::visitChildren): Deleted.
+        * bindings/scripts/test/JS/JSTestJSBuiltinConstructor.h:
+        * bindings/scripts/test/JS/JSTestNode.cpp:
+        (WebCore::JSTestNode::visitChildren): Deleted.
+        * bindings/scripts/test/JS/JSTestNode.h:
+
 2017-05-31  Chris Dumez  <cdumez@apple.com>
 
         Make QualifiedName cache per thread
index a5b1fa7..7f5322d 100644 (file)
@@ -1358,10 +1358,7 @@ sub InstanceNeedsVisitChildren
     }
 
     return 1 if $interface->extendedAttributes->{JSCustomMarkFunction};
-    return 1 if $codeGenerator->InheritsInterface($interface, "EventTarget");
-    return 1 if $interface->type->name eq "EventTarget";
     return 1 if $interface->extendedAttributes->{ReportExtraMemoryCost};
-    return 1 if IsJSBuiltinConstructor($interface);
     return 0;
 }
 
index 7457466..2e1afb5 100644 (file)
@@ -158,13 +158,6 @@ bool setJSTestClassWithJSBuiltinConstructorConstructor(ExecState* state, Encoded
     return prototype->putDirect(state->vm(), state->propertyNames().constructor, JSValue::decode(encodedValue));
 }
 
-void JSTestClassWithJSBuiltinConstructor::visitChildren(JSCell* cell, SlotVisitor& visitor)
-{
-    auto* thisObject = jsCast<JSTestClassWithJSBuiltinConstructor*>(cell);
-    ASSERT_GC_OBJECT_INHERITS(thisObject, info());
-    Base::visitChildren(thisObject, visitor);
-}
-
 bool JSTestClassWithJSBuiltinConstructorOwner::isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown> handle, void*, SlotVisitor& visitor)
 {
     UNUSED_PARAM(handle);
index 3808999..061b23a 100644 (file)
@@ -49,8 +49,6 @@ public:
     }
 
     static JSC::JSValue getConstructor(JSC::VM&, const JSC::JSGlobalObject*);
-    static void visitChildren(JSCell*, JSC::SlotVisitor&);
-
 protected:
     JSTestClassWithJSBuiltinConstructor(JSC::Structure*, JSDOMGlobalObject&, Ref<TestClassWithJSBuiltinConstructor>&&);
 
index 21a2507..ba6faaf 100644 (file)
@@ -1286,12 +1286,5 @@ JSC::EncodedJSValue JIT_OPERATION unsafeJsTestDOMJITPrototypeFunctionGetElements
     return JSValue::encode(toJS<IDLInterface<NodeList>>(*state, *castedThis->globalObject(), impl.getElementsByName(WTFMove(elementName))));
 }
 
-void JSTestDOMJIT::visitChildren(JSCell* cell, SlotVisitor& visitor)
-{
-    auto* thisObject = jsCast<JSTestDOMJIT*>(cell);
-    ASSERT_GC_OBJECT_INHERITS(thisObject, info());
-    Base::visitChildren(thisObject, visitor);
-}
-
 
 }
index 4eeefd2..dafc9fb 100644 (file)
@@ -48,8 +48,6 @@ public:
     }
 
     static JSC::JSValue getConstructor(JSC::VM&, const JSC::JSGlobalObject*);
-    static void visitChildren(JSCell*, JSC::SlotVisitor&);
-
     TestDOMJIT& wrapped() const
     {
         return static_cast<TestDOMJIT&>(Base::wrapped());
index ea579e0..b90bda8 100644 (file)
@@ -223,13 +223,6 @@ EncodedJSValue JSC_HOST_CALL jsTestEventTargetPrototypeFunctionItem(ExecState* s
     return IDLOperation<JSTestEventTarget>::call<jsTestEventTargetPrototypeFunctionItemBody>(*state, "item");
 }
 
-void JSTestEventTarget::visitChildren(JSCell* cell, SlotVisitor& visitor)
-{
-    auto* thisObject = jsCast<JSTestEventTarget*>(cell);
-    ASSERT_GC_OBJECT_INHERITS(thisObject, info());
-    Base::visitChildren(thisObject, visitor);
-}
-
 #if ENABLE(BINDING_INTEGRITY)
 #if PLATFORM(WIN)
 #pragma warning(disable: 4483)
index d9516e8..612b9b5 100644 (file)
@@ -52,8 +52,6 @@ public:
 
     static void getOwnPropertyNames(JSC::JSObject*, JSC::ExecState*, JSC::PropertyNameArray&, JSC::EnumerationMode = JSC::EnumerationMode());
     static JSC::JSValue getConstructor(JSC::VM&, const JSC::JSGlobalObject*);
-    static void visitChildren(JSCell*, JSC::SlotVisitor&);
-
     TestEventTarget& wrapped() const
     {
         return static_cast<TestEventTarget&>(Base::wrapped());
index e1ec205..60cafac 100644 (file)
@@ -229,12 +229,5 @@ EncodedJSValue JSC_HOST_CALL jsTestJSBuiltinConstructorPrototypeFunctionTestCust
     return IDLOperation<JSTestJSBuiltinConstructor>::call<jsTestJSBuiltinConstructorPrototypeFunctionTestCustomFunctionBody>(*state, "testCustomFunction");
 }
 
-void JSTestJSBuiltinConstructor::visitChildren(JSCell* cell, SlotVisitor& visitor)
-{
-    auto* thisObject = jsCast<JSTestJSBuiltinConstructor*>(cell);
-    ASSERT_GC_OBJECT_INHERITS(thisObject, info());
-    Base::visitChildren(thisObject, visitor);
-}
-
 
 }
index 4770a72..d6d800f 100644 (file)
@@ -46,8 +46,6 @@ public:
     }
 
     static JSC::JSValue getConstructor(JSC::VM&, const JSC::JSGlobalObject*);
-    static void visitChildren(JSCell*, JSC::SlotVisitor&);
-
 
     // Custom attributes
     JSC::JSValue testAttributeCustom(JSC::ExecState&) const;
index 77e15e1..4288fd8 100644 (file)
@@ -335,13 +335,6 @@ EncodedJSValue JSC_HOST_CALL jsTestNodePrototypeFunctionToJSON(ExecState* state)
     return IDLOperation<JSTestNode>::call<jsTestNodePrototypeFunctionToJSONBody>(*state, "toJSON");
 }
 
-void JSTestNode::visitChildren(JSCell* cell, SlotVisitor& visitor)
-{
-    auto* thisObject = jsCast<JSTestNode*>(cell);
-    ASSERT_GC_OBJECT_INHERITS(thisObject, info());
-    Base::visitChildren(thisObject, visitor);
-}
-
 #if ENABLE(BINDING_INTEGRITY)
 #if PLATFORM(WIN)
 #pragma warning(disable: 4483)
index f557311..728c94d 100644 (file)
@@ -48,8 +48,6 @@ public:
 
     static JSC::JSValue getConstructor(JSC::VM&, const JSC::JSGlobalObject*);
     static JSC::JSObject* serialize(JSC::ExecState*, JSTestNode* thisObject, JSC::ThrowScope&);
-    static void visitChildren(JSCell*, JSC::SlotVisitor&);
-
     TestNode& wrapped() const
     {
         return static_cast<TestNode&>(Base::wrapped());