Changeset 120968 in webkit


Ignore:
Timestamp:
Jun 21, 2012 3:34:26 PM (12 years ago)
Author:
arv@chromium.org
Message:

[V8] Use v8::V8::AddImplicitReferences instead of SetHiddenValue
https://bugs.webkit.org/show_bug.cgi?id=80880

Reviewed by Adam Barth.

We used to add a hidden property in the getter to the returned wrapper.
With this patch we instead handle the liveness of the wrapper in the GC phase by
calling v8::V8::AddHiddenReference.

To reduce the amount of custom code we need, the V8 code generator now supports
GenerateIsReachable (as well as CustomIsReachable) which, even though different
from the JSC attribute, is used in the same cases and takes the same values (even though
at the moment not all JSC values are supported by V8). Interfaces that have *IsReachable
also have a dependent life time (just like if V8DependentLifetime was present).

No new tests. Covered by existing tests.

  • Target.pri:
  • UseV8.cmake:
  • WebCore.gypi:
  • bindings/scripts/CodeGeneratorJS.pm:

(GetGenerateIsReachable): Abstracted GenerateIsReachable and JSGenerateIsReachable.
(GetCustomIsReachable): Ditto.
(GenerateHeader):
(GenerateImplementation):

  • bindings/scripts/CodeGeneratorV8.pm:

(NeedsToVisitDOMWrapper):
(GetGenerateIsReachable):
(GetCustomIsReachable):
(GenerateVisitDOMWrapper):
(GenerateHeader):
(GenerateNamedConstructorCallback):
(GenerateImplementation):

  • bindings/scripts/IDLAttributes.txt:
  • bindings/scripts/test/V8/V8Float64Array.cpp:

(WebCore):

  • bindings/scripts/test/V8/V8Float64Array.h:

(V8Float64Array):

  • bindings/scripts/test/V8/V8TestActiveDOMObject.cpp:

(WebCore):

  • bindings/scripts/test/V8/V8TestActiveDOMObject.h:

(V8TestActiveDOMObject):

  • bindings/scripts/test/V8/V8TestCustomNamedGetter.cpp:

(WebCore):

  • bindings/scripts/test/V8/V8TestCustomNamedGetter.h:

(V8TestCustomNamedGetter):

  • bindings/scripts/test/V8/V8TestEventConstructor.cpp:

(WebCore):

  • bindings/scripts/test/V8/V8TestEventConstructor.h:

(V8TestEventConstructor):

  • bindings/scripts/test/V8/V8TestEventTarget.cpp:

(WebCore):

  • bindings/scripts/test/V8/V8TestEventTarget.h:

(V8TestEventTarget):

  • bindings/scripts/test/V8/V8TestException.cpp:

(WebCore):

  • bindings/scripts/test/V8/V8TestException.h:

(V8TestException):

  • bindings/scripts/test/V8/V8TestInterface.cpp:

(WebCore):

  • bindings/scripts/test/V8/V8TestInterface.h:

(V8TestInterface):

  • bindings/scripts/test/V8/V8TestMediaQueryListListener.cpp:

(WebCore):

  • bindings/scripts/test/V8/V8TestMediaQueryListListener.h:

(V8TestMediaQueryListListener):

  • bindings/scripts/test/V8/V8TestNamedConstructor.cpp:

(WebCore):

  • bindings/scripts/test/V8/V8TestNamedConstructor.h:

(V8TestNamedConstructor):

  • bindings/scripts/test/V8/V8TestNode.cpp:

(WebCore):

  • bindings/scripts/test/V8/V8TestNode.h:

(V8TestNode):

  • bindings/scripts/test/V8/V8TestObj.cpp:

(WebCore):

  • bindings/scripts/test/V8/V8TestObj.h:

(V8TestObj):

  • bindings/scripts/test/V8/V8TestSerializedScriptValueInterface.cpp:

(WebCore):

  • bindings/scripts/test/V8/V8TestSerializedScriptValueInterface.h:

(V8TestSerializedScriptValueInterface):

  • bindings/v8/NPV8Object.cpp:

(WebCore::npObjectTypeInfo):

  • bindings/v8/V8GCController.cpp:

(WebCore::GrouperVisitor::visitDOMWrapper):

  • bindings/v8/WrapperTypeInfo.h:

(WebCore):
(WrapperTypeInfo):

  • bindings/v8/custom/V8CSSStyleSheetCustom.cpp: Removed.
  • bindings/v8/custom/V8DOMStringMapCustom.cpp:
  • bindings/v8/custom/V8DOMTokenListCustom.cpp: Removed.
  • bindings/v8/custom/V8HTMLImageElementConstructor.cpp:

(WebCore):

  • bindings/v8/custom/V8NamedNodeMapCustom.cpp:
  • bindings/v8/custom/V8StyleSheetCustom.cpp:

(WebCore::toV8):

  • bindings/v8/custom/V8TextTrackListCustom.cpp: Removed.
  • css/CSSStyleSheet.idl:
  • css/StyleSheet.idl:
  • dom/DOMStringMap.idl:
  • dom/NamedNodeMap.idl:
  • html/DOMTokenList.idl:
  • html/track/TextTrackList.idl:
Location:
trunk/Source/WebCore
Files:
3 deleted
44 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r120967 r120968  
     12012-06-21  Erik Arvidsson  <arv@chromium.org>
     2
     3        [V8] Use v8::V8::AddImplicitReferences instead of SetHiddenValue
     4        https://bugs.webkit.org/show_bug.cgi?id=80880
     5
     6        Reviewed by Adam Barth.
     7
     8        We used to add a hidden property in the getter to the returned wrapper.
     9        With this patch we instead handle the liveness of the wrapper in the GC phase by
     10        calling v8::V8::AddHiddenReference.
     11
     12        To reduce the amount of custom code we need, the V8 code generator now supports
     13        GenerateIsReachable (as well as CustomIsReachable) which, even though different
     14        from the JSC attribute, is used in the same cases and takes the same values (even though
     15        at the moment not all JSC values are supported by V8). Interfaces that have *IsReachable
     16        also have a dependent life time (just like if V8DependentLifetime was present).
     17
     18        No new tests. Covered by existing tests.
     19
     20        * Target.pri:
     21        * UseV8.cmake:
     22        * WebCore.gypi:
     23        * bindings/scripts/CodeGeneratorJS.pm:
     24        (GetGenerateIsReachable): Abstracted GenerateIsReachable and JSGenerateIsReachable.
     25        (GetCustomIsReachable): Ditto.
     26        (GenerateHeader):
     27        (GenerateImplementation):
     28        * bindings/scripts/CodeGeneratorV8.pm:
     29        (NeedsToVisitDOMWrapper):
     30        (GetGenerateIsReachable):
     31        (GetCustomIsReachable):
     32        (GenerateVisitDOMWrapper):
     33        (GenerateHeader):
     34        (GenerateNamedConstructorCallback):
     35        (GenerateImplementation):
     36        * bindings/scripts/IDLAttributes.txt:
     37        * bindings/scripts/test/V8/V8Float64Array.cpp:
     38        (WebCore):
     39        * bindings/scripts/test/V8/V8Float64Array.h:
     40        (V8Float64Array):
     41        * bindings/scripts/test/V8/V8TestActiveDOMObject.cpp:
     42        (WebCore):
     43        * bindings/scripts/test/V8/V8TestActiveDOMObject.h:
     44        (V8TestActiveDOMObject):
     45        * bindings/scripts/test/V8/V8TestCustomNamedGetter.cpp:
     46        (WebCore):
     47        * bindings/scripts/test/V8/V8TestCustomNamedGetter.h:
     48        (V8TestCustomNamedGetter):
     49        * bindings/scripts/test/V8/V8TestEventConstructor.cpp:
     50        (WebCore):
     51        * bindings/scripts/test/V8/V8TestEventConstructor.h:
     52        (V8TestEventConstructor):
     53        * bindings/scripts/test/V8/V8TestEventTarget.cpp:
     54        (WebCore):
     55        * bindings/scripts/test/V8/V8TestEventTarget.h:
     56        (V8TestEventTarget):
     57        * bindings/scripts/test/V8/V8TestException.cpp:
     58        (WebCore):
     59        * bindings/scripts/test/V8/V8TestException.h:
     60        (V8TestException):
     61        * bindings/scripts/test/V8/V8TestInterface.cpp:
     62        (WebCore):
     63        * bindings/scripts/test/V8/V8TestInterface.h:
     64        (V8TestInterface):
     65        * bindings/scripts/test/V8/V8TestMediaQueryListListener.cpp:
     66        (WebCore):
     67        * bindings/scripts/test/V8/V8TestMediaQueryListListener.h:
     68        (V8TestMediaQueryListListener):
     69        * bindings/scripts/test/V8/V8TestNamedConstructor.cpp:
     70        (WebCore):
     71        * bindings/scripts/test/V8/V8TestNamedConstructor.h:
     72        (V8TestNamedConstructor):
     73        * bindings/scripts/test/V8/V8TestNode.cpp:
     74        (WebCore):
     75        * bindings/scripts/test/V8/V8TestNode.h:
     76        (V8TestNode):
     77        * bindings/scripts/test/V8/V8TestObj.cpp:
     78        (WebCore):
     79        * bindings/scripts/test/V8/V8TestObj.h:
     80        (V8TestObj):
     81        * bindings/scripts/test/V8/V8TestSerializedScriptValueInterface.cpp:
     82        (WebCore):
     83        * bindings/scripts/test/V8/V8TestSerializedScriptValueInterface.h:
     84        (V8TestSerializedScriptValueInterface):
     85        * bindings/v8/NPV8Object.cpp:
     86        (WebCore::npObjectTypeInfo):
     87        * bindings/v8/V8GCController.cpp:
     88        (WebCore::GrouperVisitor::visitDOMWrapper):
     89        * bindings/v8/WrapperTypeInfo.h:
     90        (WebCore):
     91        (WrapperTypeInfo):
     92        * bindings/v8/custom/V8CSSStyleSheetCustom.cpp: Removed.
     93        * bindings/v8/custom/V8DOMStringMapCustom.cpp:
     94        * bindings/v8/custom/V8DOMTokenListCustom.cpp: Removed.
     95        * bindings/v8/custom/V8HTMLImageElementConstructor.cpp:
     96        (WebCore):
     97        * bindings/v8/custom/V8NamedNodeMapCustom.cpp:
     98        * bindings/v8/custom/V8StyleSheetCustom.cpp:
     99        (WebCore::toV8):
     100        * bindings/v8/custom/V8TextTrackListCustom.cpp: Removed.
     101        * css/CSSStyleSheet.idl:
     102        * css/StyleSheet.idl:
     103        * dom/DOMStringMap.idl:
     104        * dom/NamedNodeMap.idl:
     105        * html/DOMTokenList.idl:
     106        * html/track/TextTrackList.idl:
     107
    11082012-06-21  Alec Flett  <alecflett@chromium.org>
    2109
  • trunk/Source/WebCore/Target.pri

    r120962 r120968  
    159159        bindings/v8/custom/V8CSSRuleCustom.cpp \
    160160        bindings/v8/custom/V8CSSStyleDeclarationCustom.cpp \
    161         bindings/v8/custom/V8CSSStyleSheetCustom.cpp \
    162161        bindings/v8/custom/V8CSSValueCustom.cpp \
    163162        bindings/v8/custom/V8CanvasRenderingContext2DCustom.cpp \
     
    168167        bindings/v8/custom/V8InjectedScriptManager.cpp \
    169168        bindings/v8/custom/V8InspectorFrontendHostCustom.cpp \
    170         bindings/v8/custom/V8DOMStringMapCustom.cpp \
    171         bindings/v8/custom/V8DOMTokenListCustom.cpp
     169        bindings/v8/custom/V8DOMStringMapCustom.cpp
    172170
    173171    SOURCES += \
     
    217215        bindings/v8/custom/V8StyleSheetCustom.cpp \
    218216        bindings/v8/custom/V8StyleSheetListCustom.cpp \
    219         bindings/v8/custom/V8TextTrackListCustom.cpp \
    220217        bindings/v8/custom/V8WebKitAnimationCustom.cpp \
    221218        bindings/v8/custom/V8WebKitMutationObserverCustom.cpp \
  • trunk/Source/WebCore/UseV8.cmake

    r120962 r120968  
    7575    bindings/v8/custom/V8CSSRuleCustom.cpp
    7676    bindings/v8/custom/V8CSSStyleDeclarationCustom.cpp
    77     bindings/v8/custom/V8CSSStyleSheetCustom.cpp
    7877    bindings/v8/custom/V8CSSValueCustom.cpp
    7978    bindings/v8/custom/V8CanvasRenderingContext2DCustom.cpp
     
    8685    bindings/v8/custom/V8DOMFormDataCustom.cpp
    8786    bindings/v8/custom/V8DOMStringMapCustom.cpp
    88     bindings/v8/custom/V8DOMTokenListCustom.cpp
    8987    bindings/v8/custom/V8DOMWindowCustom.cpp
    9088    bindings/v8/custom/V8DataViewCustom.cpp
     
    149147    bindings/v8/custom/V8StyleSheetCustom.cpp
    150148    bindings/v8/custom/V8StyleSheetListCustom.cpp
    151     bindings/v8/custom/V8TextTrackListCustom.cpp
    152149    bindings/v8/custom/V8Uint16ArrayCustom.cpp
    153150    bindings/v8/custom/V8Uint32ArrayCustom.cpp
  • trunk/Source/WebCore/WebCore.gypi

    r120962 r120968  
    22642264            'bindings/v8/custom/V8CSSRuleCustom.cpp',
    22652265            'bindings/v8/custom/V8CSSStyleDeclarationCustom.cpp',
    2266             'bindings/v8/custom/V8CSSStyleSheetCustom.cpp',
    22672266            'bindings/v8/custom/V8CSSValueCustom.cpp',
    22682267            'bindings/v8/custom/V8CanvasRenderingContext2DCustom.cpp',
     
    22772276            'bindings/v8/custom/V8DOMFormDataCustom.cpp',
    22782277            'bindings/v8/custom/V8DOMStringMapCustom.cpp',
    2279             'bindings/v8/custom/V8DOMTokenListCustom.cpp',
    22802278            'bindings/v8/custom/V8DOMWindowCustom.cpp',
    22812279            'bindings/v8/custom/V8DataViewCustom.cpp',
     
    23512349            'bindings/v8/custom/V8StyleSheetCustom.cpp',
    23522350            'bindings/v8/custom/V8StyleSheetListCustom.cpp',
    2353             'bindings/v8/custom/V8TextTrackListCustom.cpp',
    23542351            'bindings/v8/custom/V8TrackEventCustom.cpp',
    23552352            'bindings/v8/custom/V8Uint16ArrayCustom.cpp',
  • trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm

    r120866 r120968  
    385385}
    386386
     387sub GetGenerateIsReachable
     388{
     389    my $dataNode = shift;
     390    return $dataNode->extendedAttributes->{"GenerateIsReachable"} || $dataNode->extendedAttributes->{"JSGenerateIsReachable"};
     391}
     392
     393sub GetCustomIsReachable
     394{
     395    my $dataNode = shift;
     396    return $dataNode->extendedAttributes->{"CustomIsReachable"} || $dataNode->extendedAttributes->{"JSCustomIsReachable"};
     397}
     398
    387399sub GenerateGetOwnPropertySlotBody
    388400{
     
    9941006
    9951007    if (!$hasParent ||
    996         $dataNode->extendedAttributes->{"JSGenerateIsReachable"} ||
    997         $dataNode->extendedAttributes->{"JSCustomIsReachable"} ||
     1008        GetGenerateIsReachable($dataNode) ||
     1009        GetCustomIsReachable($dataNode) ||
    9981010        $dataNode->extendedAttributes->{"JSCustomFinalize"} ||
    9991011        $dataNode->extendedAttributes->{"ActiveDOMObject"}) {
     
    22862298    }
    22872299
    2288     if ((!$hasParent && !$dataNode->extendedAttributes->{"JSCustomIsReachable"})|| $dataNode->extendedAttributes->{"JSGenerateIsReachable"} || $dataNode->extendedAttributes->{"ActiveDOMObject"}) {
     2300    if ((!$hasParent && !GetCustomIsReachable($dataNode))|| GetGenerateIsReachable($dataNode) || $dataNode->extendedAttributes->{"ActiveDOMObject"}) {
    22892301        push(@implContent, "static inline bool isObservable(JS${implClassName}* js${implClassName})\n");
    22902302        push(@implContent, "{\n");
     
    23142326        push(@implContent, "    if (!isObservable(js${implClassName}))\n");
    23152327        push(@implContent, "        return false;\n");
    2316         if ($dataNode->extendedAttributes->{"JSGenerateIsReachable"}) {
     2328        if (GetGenerateIsReachable($dataNode)) {
    23172329            my $rootString;
    2318             if ($dataNode->extendedAttributes->{"JSGenerateIsReachable"} eq "Impl") {
     2330            if (GetGenerateIsReachable($dataNode) eq "Impl") {
    23192331                $rootString  = "    ${implType}* root = js${implClassName}->impl();\n";
    2320             } elsif ($dataNode->extendedAttributes->{"JSGenerateIsReachable"} eq "ImplContext") {
     2332            } elsif (GetGenerateIsReachable($dataNode) eq "ImplContext") {
    23212333                $rootString  = "    WebGLRenderingContext* root = js${implClassName}->impl()->context();\n";
    2322             } elsif ($dataNode->extendedAttributes->{"JSGenerateIsReachable"} eq "ImplFrame") {
     2334            } elsif (GetGenerateIsReachable($dataNode) eq "ImplFrame") {
    23232335                $rootString  = "    Frame* root = js${implClassName}->impl()->frame();\n";
    23242336                $rootString .= "    if (!root)\n";
    23252337                $rootString .= "        return false;\n";
    2326             } elsif ($dataNode->extendedAttributes->{"JSGenerateIsReachable"} eq "ImplDocument") {
     2338            } elsif (GetGenerateIsReachable($dataNode) eq "ImplDocument") {
    23272339                $rootString  = "    Document* root = js${implClassName}->impl()->document();\n";
    23282340                $rootString .= "    if (!root)\n";
    23292341                $rootString .= "        return false;\n";
    2330             } elsif ($dataNode->extendedAttributes->{"JSGenerateIsReachable"} eq "ImplElementRoot") {
     2342            } elsif (GetGenerateIsReachable($dataNode) eq "ImplElementRoot") {
    23312343                $rootString  = "    Element* element = js${implClassName}->impl()->element();\n";
    23322344                $rootString .= "    if (!element)\n";
     
    23522364    if (!$dataNode->extendedAttributes->{"JSCustomFinalize"} &&
    23532365        (!$hasParent ||
    2354          $dataNode->extendedAttributes->{"JSGenerateIsReachable"} ||
    2355          $dataNode->extendedAttributes->{"JSCustomIsReachable"} ||
     2366         GetGenerateIsReachable($dataNode) ||
     2367         GetCustomIsReachable($dataNode) ||
    23562368         $dataNode->extendedAttributes->{"ActiveDOMObject"})) {
    23572369        push(@implContent, "void JS${implClassName}Owner::finalize(JSC::Handle<JSC::Unknown> handle, void* context)\n");
  • trunk/Source/WebCore/bindings/scripts/CodeGeneratorV8.pm

    r120866 r120968  
    182182}
    183183
     184sub NeedsToVisitDOMWrapper
     185{
     186    my $dataNode = shift;
     187    return GetGenerateIsReachable($dataNode) || GetCustomIsReachable($dataNode);
     188}
     189
     190sub GetGenerateIsReachable
     191{
     192    my $dataNode = shift;
     193    return $dataNode->extendedAttributes->{"GenerateIsReachable"} || $dataNode->extendedAttributes->{"V8GenerateIsReachable"} || ""
     194}
     195
     196sub GetCustomIsReachable
     197{
     198    my $dataNode = shift;
     199    return $dataNode->extendedAttributes->{"CustomIsReachable"} || $dataNode->extendedAttributes->{"V8CustomIsReachable"};
     200}
     201
     202sub GenerateVisitDOMWrapper
     203{
     204    my ($dataNode, $implClassName) = @_;
     205
     206    if (GetCustomIsReachable($dataNode)) {
     207        return;
     208    }
     209
     210    push(@implContent, <<END);
     211void V8${implClassName}::visitDOMWrapper(DOMDataStore* store, void* object, v8::Persistent<v8::Object> wrapper)
     212{
     213    ${implClassName}* impl = static_cast<${implClassName}*>(object);
     214END
     215    if (GetGenerateIsReachable($dataNode) eq  "ImplElementRoot" ||
     216        GetGenerateIsReachable($dataNode) eq  "ImplOwnerRoot" ||
     217        GetGenerateIsReachable($dataNode) eq  "ImplOwnerNodeRoot") {
     218
     219        my $methodName;
     220        $methodName = "element" if (GetGenerateIsReachable($dataNode) eq "ImplElementRoot");
     221        $methodName = "owner" if (GetGenerateIsReachable($dataNode) eq "ImplOwnerRoot");
     222        $methodName = "ownerNode" if (GetGenerateIsReachable($dataNode) eq "ImplOwnerNodeRoot");
     223
     224        push(@implContent, <<END);
     225    if (Node* owner = impl->${methodName}()) {
     226        v8::Persistent<v8::Object> ownerWrapper = store->domNodeMap().get(owner);
     227        if (!ownerWrapper.IsEmpty()) {
     228            v8::Persistent<v8::Value> value = wrapper;
     229            v8::V8::AddImplicitReferences(ownerWrapper, &value, 1);
     230        }
     231    }
     232END
     233    }
     234
     235    push(@implContent, <<END);
     236}
     237
     238END
     239}
     240
    184241sub GetSVGPropertyTypes
    185242{
     
    236293    $codeGenerator->LinkOverloadedFunctions($dataNode);
    237294
    238     my $hasDependentLifetime = $dataNode->extendedAttributes->{"V8DependentLifetime"} || $dataNode->extendedAttributes->{"ActiveDOMObject"} || $className =~ /SVG/;
     295    my $hasDependentLifetime = $dataNode->extendedAttributes->{"V8DependentLifetime"} || $dataNode->extendedAttributes->{"ActiveDOMObject"}
     296         || GetGenerateIsReachable($dataNode) || $className =~ /SVG/;
    239297    if (!$hasDependentLifetime) {
    240298        foreach (@{$dataNode->parents}) {
     
    330388    inline static v8::Handle<v8::Object> wrap(${nativeType}*, v8::Isolate* = 0${forceNewObjectParameter});
    331389    static void derefObject(void*);
     390    static void visitDOMWrapper(DOMDataStore*, void*, v8::Persistent<v8::Object>);
    332391    static WrapperTypeInfo info;
    333392END
     
    18721931    if ($dataNode->extendedAttributes->{"ActiveDOMObject"}) {
    18731932        push(@implContent, <<END);
    1874 WrapperTypeInfo V8${implClassName}Constructor::info = { V8${implClassName}Constructor::GetTemplate, V8${implClassName}::derefObject, V8${implClassName}::toActiveDOMObject, 0, WrapperTypeObjectPrototype };
     1933WrapperTypeInfo V8${implClassName}Constructor::info = { V8${implClassName}Constructor::GetTemplate, V8${implClassName}::derefObject, V8${implClassName}::toActiveDOMObject, 0, 0, WrapperTypeObjectPrototype };
    18751934
    18761935END
    18771936    } else {
    18781937        push(@implContent, <<END);
    1879 WrapperTypeInfo V8${implClassName}Constructor::info = { V8${implClassName}Constructor::GetTemplate, 0, 0, 0, WrapperTypeObjectPrototype };
     1938WrapperTypeInfo V8${implClassName}Constructor::info = { V8${implClassName}Constructor::GetTemplate, 0, 0, 0, 0, WrapperTypeObjectPrototype };
    18801939
    18811940END
     
    24292488
    24302489    my $toActive = $dataNode->extendedAttributes->{"ActiveDOMObject"} ? "${className}::toActiveDOMObject" : "0";
     2490    my $domVisitor = NeedsToVisitDOMWrapper($dataNode) ? "${className}::visitDOMWrapper" : "0";
    24312491
    24322492    # Find the super descriptor.
     
    24482508    my $WrapperTypePrototype = $dataNode->isException ? "WrapperTypeErrorPrototype" : "WrapperTypeObjectPrototype";
    24492509
    2450     push(@implContentDecls, "WrapperTypeInfo ${className}::info = { ${className}::GetTemplate, ${className}::derefObject, $toActive, $parentClassInfo, $WrapperTypePrototype };\n\n");
     2510    push(@implContentDecls, "WrapperTypeInfo ${className}::info = { ${className}::GetTemplate, ${className}::derefObject, $toActive, $domVisitor, $parentClassInfo, $WrapperTypePrototype };\n\n");
    24512511    push(@implContentDecls, "namespace ${interfaceName}V8Internal {\n\n");
    24522512
     
    25002560    if ($hasConstructors) {
    25012561        GenerateConstructorGetter($dataNode, $implClassName);
     2562    }
     2563
     2564    if (NeedsToVisitDOMWrapper($dataNode)) {
     2565        GenerateVisitDOMWrapper($dataNode, $implClassName);
    25022566    }
    25032567
  • trunk/Source/WebCore/bindings/scripts/IDLAttributes.txt

    r120866 r120968  
    3939CustomGetter
    4040CustomIndexedSetter
     41CustomIsReachable
    4142CustomNamedGetter
    4243CustomNamedSetter
     
    5253EventTarget
    5354ExtendsDOMGlobalObject
     55GenerateIsReachable=|Impl|ImplContext|ImplDocument|ImplElementRoot|ImplFrame
    5456Immutable
    5557ImplementedAs=*
    5658IndexedGetter
     59InitializedByEventConstructor
    5760InterfaceName=*
    58 InitializedByEventConstructor
    5961IsIndex
    6062IsWorkerContext
     
    108110V8CustomConstructor
    109111V8CustomGetter
     112V8CustomIsReachable
    110113V8CustomSetter
    111114V8CustomToJSObject
     
    114117V8EnabledAtRuntime=*
    115118V8EnabledPerContext=*
     119V8GenerateIsReachable=|ImplElementRoot|ImplOwnerRoot|ImplOwnerNodeRoot
    116120V8ReadOnly
    117121V8Unforgeable
  • trunk/Source/WebCore/bindings/scripts/test/V8/V8Float64Array.cpp

    r120866 r120968  
    4444namespace WebCore {
    4545
    46 WrapperTypeInfo V8Float64Array::info = { V8Float64Array::GetTemplate, V8Float64Array::derefObject, 0, &V8ArrayBufferView::info, WrapperTypeObjectPrototype };
     46WrapperTypeInfo V8Float64Array::info = { V8Float64Array::GetTemplate, V8Float64Array::derefObject, 0, 0, &V8ArrayBufferView::info, WrapperTypeObjectPrototype };
    4747
    4848namespace Float64ArrayV8Internal {
  • trunk/Source/WebCore/bindings/scripts/test/V8/V8Float64Array.h

    r120866 r120968  
    4545    inline static v8::Handle<v8::Object> wrap(Float64Array*, v8::Isolate* = 0);
    4646    static void derefObject(void*);
     47    static void visitDOMWrapper(DOMDataStore*, void*, v8::Persistent<v8::Object>);
    4748    static WrapperTypeInfo info;
    4849    static v8::Handle<v8::Value> constructorCallback(const v8::Arguments&);
  • trunk/Source/WebCore/bindings/scripts/test/V8/V8TestActiveDOMObject.cpp

    r120866 r120968  
    3636namespace WebCore {
    3737
    38 WrapperTypeInfo V8TestActiveDOMObject::info = { V8TestActiveDOMObject::GetTemplate, V8TestActiveDOMObject::derefObject, 0, 0, WrapperTypeObjectPrototype };
     38WrapperTypeInfo V8TestActiveDOMObject::info = { V8TestActiveDOMObject::GetTemplate, V8TestActiveDOMObject::derefObject, 0, 0, 0, WrapperTypeObjectPrototype };
    3939
    4040namespace TestActiveDOMObjectV8Internal {
  • trunk/Source/WebCore/bindings/scripts/test/V8/V8TestActiveDOMObject.h

    r120866 r120968  
    4444    inline static v8::Handle<v8::Object> wrap(TestActiveDOMObject*, v8::Isolate* = 0);
    4545    static void derefObject(void*);
     46    static void visitDOMWrapper(DOMDataStore*, void*, v8::Persistent<v8::Object>);
    4647    static WrapperTypeInfo info;
    4748    static const int internalFieldCount = v8DefaultWrapperInternalFieldCount + 0;
  • trunk/Source/WebCore/bindings/scripts/test/V8/V8TestCustomNamedGetter.cpp

    r120866 r120968  
    3535namespace WebCore {
    3636
    37 WrapperTypeInfo V8TestCustomNamedGetter::info = { V8TestCustomNamedGetter::GetTemplate, V8TestCustomNamedGetter::derefObject, 0, 0, WrapperTypeObjectPrototype };
     37WrapperTypeInfo V8TestCustomNamedGetter::info = { V8TestCustomNamedGetter::GetTemplate, V8TestCustomNamedGetter::derefObject, 0, 0, 0, WrapperTypeObjectPrototype };
    3838
    3939namespace TestCustomNamedGetterV8Internal {
  • trunk/Source/WebCore/bindings/scripts/test/V8/V8TestCustomNamedGetter.h

    r120866 r120968  
    4444    inline static v8::Handle<v8::Object> wrap(TestCustomNamedGetter*, v8::Isolate* = 0);
    4545    static void derefObject(void*);
     46    static void visitDOMWrapper(DOMDataStore*, void*, v8::Persistent<v8::Object>);
    4647    static WrapperTypeInfo info;
    4748    static v8::Handle<v8::Value> namedPropertyGetter(v8::Local<v8::String>, const v8::AccessorInfo&);
  • trunk/Source/WebCore/bindings/scripts/test/V8/V8TestEventConstructor.cpp

    r120866 r120968  
    3535namespace WebCore {
    3636
    37 WrapperTypeInfo V8TestEventConstructor::info = { V8TestEventConstructor::GetTemplate, V8TestEventConstructor::derefObject, 0, 0, WrapperTypeObjectPrototype };
     37WrapperTypeInfo V8TestEventConstructor::info = { V8TestEventConstructor::GetTemplate, V8TestEventConstructor::derefObject, 0, 0, 0, WrapperTypeObjectPrototype };
    3838
    3939namespace TestEventConstructorV8Internal {
  • trunk/Source/WebCore/bindings/scripts/test/V8/V8TestEventConstructor.h

    r120866 r120968  
    4545    inline static v8::Handle<v8::Object> wrap(TestEventConstructor*, v8::Isolate* = 0);
    4646    static void derefObject(void*);
     47    static void visitDOMWrapper(DOMDataStore*, void*, v8::Persistent<v8::Object>);
    4748    static WrapperTypeInfo info;
    4849    static v8::Handle<v8::Value> constructorCallback(const v8::Arguments&);
  • trunk/Source/WebCore/bindings/scripts/test/V8/V8TestEventTarget.cpp

    r120866 r120968  
    3838namespace WebCore {
    3939
    40 WrapperTypeInfo V8TestEventTarget::info = { V8TestEventTarget::GetTemplate, V8TestEventTarget::derefObject, 0, 0, WrapperTypeObjectPrototype };
     40WrapperTypeInfo V8TestEventTarget::info = { V8TestEventTarget::GetTemplate, V8TestEventTarget::derefObject, 0, 0, 0, WrapperTypeObjectPrototype };
    4141
    4242namespace TestEventTargetV8Internal {
  • trunk/Source/WebCore/bindings/scripts/test/V8/V8TestEventTarget.h

    r120866 r120968  
    4444    inline static v8::Handle<v8::Object> wrap(TestEventTarget*, v8::Isolate* = 0);
    4545    static void derefObject(void*);
     46    static void visitDOMWrapper(DOMDataStore*, void*, v8::Persistent<v8::Object>);
    4647    static WrapperTypeInfo info;
    4748    static v8::Handle<v8::Value> indexedPropertyGetter(uint32_t, const v8::AccessorInfo&);
  • trunk/Source/WebCore/bindings/scripts/test/V8/V8TestException.cpp

    r120866 r120968  
    3333namespace WebCore {
    3434
    35 WrapperTypeInfo V8TestException::info = { V8TestException::GetTemplate, V8TestException::derefObject, 0, 0, WrapperTypeErrorPrototype };
     35WrapperTypeInfo V8TestException::info = { V8TestException::GetTemplate, V8TestException::derefObject, 0, 0, 0, WrapperTypeErrorPrototype };
    3636
    3737namespace TestExceptionV8Internal {
  • trunk/Source/WebCore/bindings/scripts/test/V8/V8TestException.h

    r120866 r120968  
    4444    inline static v8::Handle<v8::Object> wrap(TestException*, v8::Isolate* = 0);
    4545    static void derefObject(void*);
     46    static void visitDOMWrapper(DOMDataStore*, void*, v8::Persistent<v8::Object>);
    4647    static WrapperTypeInfo info;
    4748    static const int internalFieldCount = v8DefaultWrapperInternalFieldCount + 0;
  • trunk/Source/WebCore/bindings/scripts/test/V8/V8TestInterface.cpp

    r120866 r120968  
    4343namespace WebCore {
    4444
    45 WrapperTypeInfo V8TestInterface::info = { V8TestInterface::GetTemplate, V8TestInterface::derefObject, V8TestInterface::toActiveDOMObject, 0, WrapperTypeObjectPrototype };
     45WrapperTypeInfo V8TestInterface::info = { V8TestInterface::GetTemplate, V8TestInterface::derefObject, V8TestInterface::toActiveDOMObject, 0, 0, WrapperTypeObjectPrototype };
    4646
    4747namespace TestInterfaceV8Internal {
  • trunk/Source/WebCore/bindings/scripts/test/V8/V8TestInterface.h

    r120866 r120968  
    4646    inline static v8::Handle<v8::Object> wrap(TestInterface*, v8::Isolate* = 0);
    4747    static void derefObject(void*);
     48    static void visitDOMWrapper(DOMDataStore*, void*, v8::Persistent<v8::Object>);
    4849    static WrapperTypeInfo info;
    4950    static ActiveDOMObject* toActiveDOMObject(v8::Handle<v8::Object>);
  • trunk/Source/WebCore/bindings/scripts/test/V8/V8TestMediaQueryListListener.cpp

    r120866 r120968  
    3636namespace WebCore {
    3737
    38 WrapperTypeInfo V8TestMediaQueryListListener::info = { V8TestMediaQueryListListener::GetTemplate, V8TestMediaQueryListListener::derefObject, 0, 0, WrapperTypeObjectPrototype };
     38WrapperTypeInfo V8TestMediaQueryListListener::info = { V8TestMediaQueryListListener::GetTemplate, V8TestMediaQueryListListener::derefObject, 0, 0, 0, WrapperTypeObjectPrototype };
    3939
    4040namespace TestMediaQueryListListenerV8Internal {
  • trunk/Source/WebCore/bindings/scripts/test/V8/V8TestMediaQueryListListener.h

    r120866 r120968  
    4444    inline static v8::Handle<v8::Object> wrap(TestMediaQueryListListener*, v8::Isolate* = 0);
    4545    static void derefObject(void*);
     46    static void visitDOMWrapper(DOMDataStore*, void*, v8::Persistent<v8::Object>);
    4647    static WrapperTypeInfo info;
    4748    static const int internalFieldCount = v8DefaultWrapperInternalFieldCount + 0;
  • trunk/Source/WebCore/bindings/scripts/test/V8/V8TestNamedConstructor.cpp

    r120866 r120968  
    3535namespace WebCore {
    3636
    37 WrapperTypeInfo V8TestNamedConstructor::info = { V8TestNamedConstructor::GetTemplate, V8TestNamedConstructor::derefObject, V8TestNamedConstructor::toActiveDOMObject, 0, WrapperTypeObjectPrototype };
     37WrapperTypeInfo V8TestNamedConstructor::info = { V8TestNamedConstructor::GetTemplate, V8TestNamedConstructor::derefObject, V8TestNamedConstructor::toActiveDOMObject, 0, 0, WrapperTypeObjectPrototype };
    3838
    3939namespace TestNamedConstructorV8Internal {
     
    4343} // namespace TestNamedConstructorV8Internal
    4444
    45 WrapperTypeInfo V8TestNamedConstructorConstructor::info = { V8TestNamedConstructorConstructor::GetTemplate, V8TestNamedConstructor::derefObject, V8TestNamedConstructor::toActiveDOMObject, 0, WrapperTypeObjectPrototype };
     45WrapperTypeInfo V8TestNamedConstructorConstructor::info = { V8TestNamedConstructorConstructor::GetTemplate, V8TestNamedConstructor::derefObject, V8TestNamedConstructor::toActiveDOMObject, 0, 0, WrapperTypeObjectPrototype };
    4646
    4747static v8::Handle<v8::Value> V8TestNamedConstructorConstructorCallback(const v8::Arguments& args)
  • trunk/Source/WebCore/bindings/scripts/test/V8/V8TestNamedConstructor.h

    r120866 r120968  
    5050    inline static v8::Handle<v8::Object> wrap(TestNamedConstructor*, v8::Isolate* = 0);
    5151    static void derefObject(void*);
     52    static void visitDOMWrapper(DOMDataStore*, void*, v8::Persistent<v8::Object>);
    5253    static WrapperTypeInfo info;
    5354    static ActiveDOMObject* toActiveDOMObject(v8::Handle<v8::Object>);
  • trunk/Source/WebCore/bindings/scripts/test/V8/V8TestNode.cpp

    r120866 r120968  
    3434namespace WebCore {
    3535
    36 WrapperTypeInfo V8TestNode::info = { V8TestNode::GetTemplate, V8TestNode::derefObject, 0, &V8Node::info, WrapperTypeObjectPrototype };
     36WrapperTypeInfo V8TestNode::info = { V8TestNode::GetTemplate, V8TestNode::derefObject, 0, 0, &V8Node::info, WrapperTypeObjectPrototype };
    3737
    3838namespace TestNodeV8Internal {
  • trunk/Source/WebCore/bindings/scripts/test/V8/V8TestNode.h

    r120866 r120968  
    4444    inline static v8::Handle<v8::Object> wrap(TestNode*, v8::Isolate* = 0);
    4545    static void derefObject(void*);
     46    static void visitDOMWrapper(DOMDataStore*, void*, v8::Persistent<v8::Object>);
    4647    static WrapperTypeInfo info;
    4748    static v8::Handle<v8::Value> constructorCallback(const v8::Arguments&);
  • trunk/Source/WebCore/bindings/scripts/test/V8/V8TestObj.cpp

    r120866 r120968  
    7777namespace WebCore {
    7878
    79 WrapperTypeInfo V8TestObj::info = { V8TestObj::GetTemplate, V8TestObj::derefObject, 0, 0, WrapperTypeObjectPrototype };
     79WrapperTypeInfo V8TestObj::info = { V8TestObj::GetTemplate, V8TestObj::derefObject, 0, 0, 0, WrapperTypeObjectPrototype };
    8080
    8181namespace TestObjV8Internal {
  • trunk/Source/WebCore/bindings/scripts/test/V8/V8TestObj.h

    r120866 r120968  
    4444    inline static v8::Handle<v8::Object> wrap(TestObj*, v8::Isolate* = 0);
    4545    static void derefObject(void*);
     46    static void visitDOMWrapper(DOMDataStore*, void*, v8::Persistent<v8::Object>);
    4647    static WrapperTypeInfo info;
    4748    static v8::Handle<v8::Value> customMethodCallback(const v8::Arguments&);
  • trunk/Source/WebCore/bindings/scripts/test/V8/V8TestSerializedScriptValueInterface.cpp

    r120866 r120968  
    4141namespace WebCore {
    4242
    43 WrapperTypeInfo V8TestSerializedScriptValueInterface::info = { V8TestSerializedScriptValueInterface::GetTemplate, V8TestSerializedScriptValueInterface::derefObject, 0, 0, WrapperTypeObjectPrototype };
     43WrapperTypeInfo V8TestSerializedScriptValueInterface::info = { V8TestSerializedScriptValueInterface::GetTemplate, V8TestSerializedScriptValueInterface::derefObject, 0, 0, 0, WrapperTypeObjectPrototype };
    4444
    4545namespace TestSerializedScriptValueInterfaceV8Internal {
  • trunk/Source/WebCore/bindings/scripts/test/V8/V8TestSerializedScriptValueInterface.h

    r120866 r120968  
    4646    inline static v8::Handle<v8::Object> wrap(TestSerializedScriptValueInterface*, v8::Isolate* = 0);
    4747    static void derefObject(void*);
     48    static void visitDOMWrapper(DOMDataStore*, void*, v8::Persistent<v8::Object>);
    4849    static WrapperTypeInfo info;
    4950    static v8::Handle<v8::Value> constructorCallback(const v8::Arguments&);
  • trunk/Source/WebCore/bindings/v8/NPV8Object.cpp

    r120866 r120968  
    5454WrapperTypeInfo* npObjectTypeInfo()
    5555{
    56     static WrapperTypeInfo typeInfo = { 0, 0, 0, 0, WrapperTypeObjectPrototype };
     56    static WrapperTypeInfo typeInfo = { 0, 0, 0, 0, 0, WrapperTypeObjectPrototype };
    5757    return &typeInfo;
    5858}
  • trunk/Source/WebCore/bindings/v8/V8GCController.cpp

    r120866 r120968  
    341341    void visitDOMWrapper(DOMDataStore* store, void* object, v8::Persistent<v8::Object> wrapper)
    342342    {
     343        WrapperTypeInfo* info = V8DOMWrapper::domWrapperType(wrapper);
     344        if (info->domWrapperVisitorFunction)
     345            info->domWrapperVisitorFunction(store, object, wrapper);
    343346    }
    344347
  • trunk/Source/WebCore/bindings/v8/WrapperTypeInfo.h

    r120866 r120968  
    3737   
    3838    class ActiveDOMObject;
     39    class DOMDataStore;
    3940   
    4041    static const int v8DOMWrapperTypeIndex = 0;
     
    4748    typedef void (*DerefObjectFunction)(void*);
    4849    typedef ActiveDOMObject* (*ToActiveDOMObjectFunction)(v8::Handle<v8::Object>);
     50    typedef void (*DOMWrapperVisitorFunction)(DOMDataStore*, void*, v8::Persistent<v8::Object>);
    4951
    5052    enum WrapperTypePrototype {
     
    9799        const DerefObjectFunction derefObjectFunction;
    98100        const ToActiveDOMObjectFunction toActiveDOMObjectFunction;
     101        const DOMWrapperVisitorFunction domWrapperVisitorFunction;
    99102        const WrapperTypeInfo* parentClass;
    100103        const WrapperTypePrototype wrapperTypePrototype;
  • trunk/Source/WebCore/bindings/v8/custom/V8DOMStringMapCustom.cpp

    r120866 r120968  
    8585}
    8686
    87 v8::Handle<v8::Value> toV8(DOMStringMap* impl, v8::Isolate* isolate)
    88 {
    89     if (!impl)
    90         return v8NullWithCheck(isolate);
    91     v8::Handle<v8::Object> wrapper = V8DOMStringMap::wrap(impl, isolate);
    92     // Add a hidden reference from the element to the DOMStringMap.
    93     Element* element = impl->element();
    94     if (!wrapper.IsEmpty() && element) {
    95         v8::Handle<v8::Value> elementValue = toV8(element, isolate);
    96         if (!elementValue.IsEmpty() && elementValue->IsObject())
    97             elementValue.As<v8::Object>()->SetHiddenValue(V8HiddenPropertyName::domStringMap(), wrapper);
    98     }
    99     return wrapper;
    100 }
    101 
    10287} // namespace WebCore
  • trunk/Source/WebCore/bindings/v8/custom/V8HTMLImageElementConstructor.cpp

    r120866 r120968  
    4545namespace WebCore {
    4646
    47 WrapperTypeInfo V8HTMLImageElementConstructor::info = { V8HTMLImageElementConstructor::GetTemplate, 0, 0, 0, WrapperTypeObjectPrototype };
     47WrapperTypeInfo V8HTMLImageElementConstructor::info = { V8HTMLImageElementConstructor::GetTemplate, 0, 0, 0, 0, WrapperTypeObjectPrototype };
    4848
    4949static v8::Handle<v8::Value> v8HTMLImageElementConstructorCallback(const v8::Arguments& args)
  • trunk/Source/WebCore/bindings/v8/custom/V8NamedNodeMapCustom.cpp

    r120866 r120968  
    7272}
    7373
    74 v8::Handle<v8::Value> toV8(NamedNodeMap* impl, v8::Isolate* isolate)
    75 {
    76     if (!impl)
    77         return v8NullWithCheck(isolate);
    78     v8::Handle<v8::Object> wrapper = V8NamedNodeMap::wrap(impl, isolate);
    79     // Add a hidden reference from named node map to its owner node.
    80     Element* element = impl->element();
    81     if (!wrapper.IsEmpty() && element)
    82         wrapper->SetHiddenValue(V8HiddenPropertyName::ownerNode(), toV8(element, isolate));
    83     return wrapper;
    84 }
    85 
    8674} // namespace WebCore
  • trunk/Source/WebCore/bindings/v8/custom/V8StyleSheetCustom.cpp

    r120866 r120968  
    4343        return v8NullWithCheck(isolate);
    4444    if (impl->isCSSStyleSheet())
    45         return toV8(static_cast<CSSStyleSheet*>(impl), isolate);
    46     v8::Handle<v8::Object> wrapper = V8StyleSheet::wrap(impl, isolate);
    47     // Add a hidden reference from stylesheet object to its owner node.
    48     Node* ownerNode = impl->ownerNode();
    49     if (ownerNode && !wrapper.IsEmpty())
    50         V8DOMWrapper::setNamedHiddenReference(wrapper, "ownerNode", toV8(ownerNode, isolate));
    51     return wrapper;
     45        return toV8(static_cast<CSSStyleSheet*>(impl));
     46    return V8StyleSheet::wrap(impl, isolate);
    5247}
    5348
  • trunk/Source/WebCore/css/CSSStyleSheet.idl

    r120866 r120968  
    2323    // Introduced in DOM Level 2:
    2424    interface [
    25         V8CustomToJSObject
     25        V8GenerateIsReachable=ImplOwnerNodeRoot
    2626    ] CSSStyleSheet : StyleSheet {
    2727        readonly attribute CSSRule          ownerRule;
  • trunk/Source/WebCore/css/StyleSheet.idl

    r120866 r120968  
    2727        CustomToJSObject,
    2828        ObjCPolymorphic,
    29         V8DependentLifetime
     29        V8GenerateIsReachable=ImplOwnerNodeRoot
    3030    ] StyleSheet {
    3131        readonly attribute [TreatReturnedNullStringAs=Null] DOMString        type;
  • trunk/Source/WebCore/dom/DOMStringMap.idl

    r120866 r120968  
    2727
    2828    interface [
    29         JSGenerateIsReachable=ImplElementRoot,
     29        GenerateIsReachable=ImplElementRoot,
    3030        NamedGetter,
    3131        CustomDeleteProperty,
    3232        CustomEnumerateProperty,
    33         CustomNamedSetter,
    34         V8CustomToJSObject
     33        CustomNamedSetter
    3534    ] DOMStringMap {
    3635    };
  • trunk/Source/WebCore/dom/NamedNodeMap.idl

    r120866 r120968  
    2222
    2323    interface [
    24         JSGenerateIsReachable=ImplElementRoot,
     24        GenerateIsReachable=ImplElementRoot,
     25        IndexedGetter,
    2526        JSCustomMarkFunction,
    26         IndexedGetter,
    27         NamedGetter,
    28         V8CustomToJSObject
     27        NamedGetter
    2928    ] NamedNodeMap {
    3029
  • trunk/Source/WebCore/html/DOMTokenList.idl

    r120866 r120968  
    2626
    2727    interface [
    28         JSGenerateIsReachable=ImplElementRoot,
    29         IndexedGetter,
    30         V8CustomToJSObject
     28        GenerateIsReachable=ImplElementRoot,
     29        IndexedGetter
    3130    ] DOMTokenList {
    3231        readonly attribute unsigned long length;
  • trunk/Source/WebCore/html/track/TextTrackList.idl

    r120866 r120968  
    2929        Conditional=VIDEO_TRACK,
    3030        V8EnabledAtRuntime=webkitVideoTrack,
    31         V8CustomToJSObject,
    3231        IndexedGetter,
    3332        EventTarget,
    3433        JSCustomMarkFunction,
    35         JSCustomIsReachable
     34        JSCustomIsReachable,
     35        V8GenerateIsReachable=ImplOwnerRoot
    3636    ] TextTrackList {
    3737        readonly attribute unsigned long length;
Note: See TracChangeset for help on using the changeset viewer.