Changeset 107394 in webkit


Ignore:
Timestamp:
Feb 10, 2012 3:46:28 AM (12 years ago)
Author:
commit-queue@webkit.org
Message:

CodeGeneratorJS doesn't always generate visitChildren() implementation when required
https://bugs.webkit.org/show_bug.cgi?id=78336

Patch by Pablo Flouret <pablof@motorola.com> on 2012-02-10
Reviewed by Kentaro Hara.

In an IDL for an interface that declares no functions, but has
attributes with [CachedAttribute], the implementation of visitChildren()
is not generated by the JSC code generator.

  • bindings/scripts/CodeGeneratorJS.pm:

(GenerateImplementation):

  • bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.cpp:

(WebCore::JSTestSerializedScriptValueInterface::visitChildren):
(WebCore):

Location:
trunk/Source/WebCore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r107389 r107394  
     12012-02-10  Pablo Flouret  <pablof@motorola.com>
     2
     3        CodeGeneratorJS doesn't always generate visitChildren() implementation when required
     4        https://bugs.webkit.org/show_bug.cgi?id=78336
     5
     6        Reviewed by Kentaro Hara.
     7       
     8        In an IDL for an interface that declares no functions, but has
     9        attributes with [CachedAttribute], the implementation of visitChildren()
     10        is not generated by the JSC code generator.
     11
     12        * bindings/scripts/CodeGeneratorJS.pm:
     13        (GenerateImplementation):
     14        * bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.cpp:
     15        (WebCore::JSTestSerializedScriptValueInterface::visitChildren):
     16        (WebCore):
     17
    1182012-02-10  Noel Gordon  <noel.gordon@gmail.com>
    219
  • trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm

    r107371 r107394  
    21362136            push(@implContent, "#endif\n\n") if $conditional;
    21372137        }
    2138        
     2138    }
     2139
     2140    if ($numFunctions > 0 || $numCachedAttributes > 0) {
    21392141        if ($needsMarkChildren && !$dataNode->extendedAttributes->{"JSCustomMarkFunction"}) {
    21402142            push(@implContent, "void ${className}::visitChildren(JSCell* cell, SlotVisitor& visitor)\n");
     
    21592161            push(@implContent, "}\n\n");
    21602162        }
    2161         # Cached attributes are indeed allowed when there is a custom mark/visitChildren function.
    2162         # The custom function must make sure to account for the cached attribute.
    2163         # Uncomment the below line to temporarily enforce generated mark functions when cached attributes are present.
    2164         # die "Can't generate binding for class with cached attribute and custom mark." if (($numCachedAttributes > 0) and ($dataNode->extendedAttributes->{"JSCustomMarkFunction"}));
    2165     }
     2163    }
     2164
     2165    # Cached attributes are indeed allowed when there is a custom mark/visitChildren function.
     2166    # The custom function must make sure to account for the cached attribute.
     2167    # Uncomment the below line to temporarily enforce generated mark functions when cached attributes are present.
     2168    # die "Can't generate binding for class with cached attribute and custom mark." if (($numCachedAttributes > 0) and ($dataNode->extendedAttributes->{"JSCustomMarkFunction"}));
    21662169
    21672170    if ($numConstants > 0) {
  • trunk/Source/WebCore/bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.cpp

    r107304 r107394  
    241241}
    242242
     243void JSTestSerializedScriptValueInterface::visitChildren(JSCell* cell, SlotVisitor& visitor)
     244{
     245    JSTestSerializedScriptValueInterface* thisObject = jsCast<JSTestSerializedScriptValueInterface*>(cell);
     246    ASSERT_GC_OBJECT_INHERITS(thisObject, &s_info);
     247    COMPILE_ASSERT(StructureFlags & OverridesVisitChildren, OverridesVisitChildrenWithoutSettingFlag);
     248    ASSERT(thisObject->structure()->typeInfo().overridesVisitChildren());
     249    Base::visitChildren(thisObject, visitor);
     250    if (thisObject->m_cachedValue)
     251        visitor.append(&thisObject->m_cachedValue);
     252    if (thisObject->m_cachedReadonlyValue)
     253        visitor.append(&thisObject->m_cachedReadonlyValue);
     254}
     255
    243256static inline bool isObservable(JSTestSerializedScriptValueInterface* jsTestSerializedScriptValueInterface)
    244257{
Note: See TracChangeset for help on using the changeset viewer.