Changeset 87063 in webkit


Ignore:
Timestamp:
May 23, 2011 1:48:35 AM (13 years ago)
Author:
vitalyr@chromium.org
Message:

2011-05-19 Vitaly Repeshko <vitalyr@chromium.org>

Reviewed by Adam Barth.

[V8] Explicitly mark objects with complex GC rules.
https://bugs.webkit.org/show_bug.cgi?id=61131

From the GC point view there are two kinds of objects: the ones
that may participate in object grouping (i.e. their lifetime
depends on other objects) and the ones that never participate in
grouping (independent). V8 added support for marking persistent
handles as independent so that the GC can process the objects they
hold faster. The motivating use case here is typed arrays.

This patch adds V8-specific inherited IDL attribute
V8DependentLifetime to types used in V8GCController, which is
exactly the set of types with object lifetimes depending on other
objects. The handles for the types that are not marked with the
new attribute can be marked as independent and GC-ed faster.

  • bindings/scripts/CodeGeneratorV8.pm: Added proccessing of the new attribute.

Updated test output:

  • bindings/scripts/test/V8/V8TestInterface.cpp: (WebCore::V8TestInterface::wrapSlow):
  • bindings/scripts/test/V8/V8TestInterface.h:
  • bindings/scripts/test/V8/V8TestMediaQueryListListener.cpp: (WebCore::V8TestMediaQueryListListener::wrapSlow):
  • bindings/scripts/test/V8/V8TestMediaQueryListListener.h:
  • bindings/scripts/test/V8/V8TestObj.cpp: (WebCore::V8TestObj::wrapSlow):
  • bindings/scripts/test/V8/V8TestObj.h:
  • bindings/scripts/test/V8/V8TestSerializedScriptValueInterface.cpp: (WebCore::V8TestSerializedScriptValueInterface::wrapSlow):
  • bindings/scripts/test/V8/V8TestSerializedScriptValueInterface.h:

Added the new attribute:

  • css/CSSRule.idl:
  • css/CSSRuleList.idl:
  • css/CSSStyleDeclaration.idl:
  • css/CSSValue.idl:
  • css/StyleSheet.idl:
  • css/StyleSheetList.idl:
  • dom/DOMImplementation.idl:
  • dom/Node.idl:
Location:
trunk/Source/WebCore
Files:
18 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r87062 r87063  
     12011-05-19  Vitaly Repeshko  <vitalyr@chromium.org>
     2
     3        Reviewed by Adam Barth.
     4
     5        [V8] Explicitly mark objects with complex GC rules.
     6        https://bugs.webkit.org/show_bug.cgi?id=61131
     7
     8        From the GC point view there are two kinds of objects: the ones
     9        that may participate in object grouping (i.e. their lifetime
     10        depends on other objects) and the ones that never participate in
     11        grouping (independent). V8 added support for marking persistent
     12        handles as independent so that the GC can process the objects they
     13        hold faster. The motivating use case here is typed arrays.
     14
     15        This patch adds V8-specific inherited IDL attribute
     16        V8DependentLifetime to types used in V8GCController, which is
     17        exactly the set of types with object lifetimes depending on other
     18        objects. The handles for the types that are not marked with the
     19        new attribute can be marked as independent and GC-ed faster.
     20
     21        * bindings/scripts/CodeGeneratorV8.pm: Added proccessing of the new attribute.
     22
     23        Updated test output:
     24        * bindings/scripts/test/V8/V8TestInterface.cpp:
     25        (WebCore::V8TestInterface::wrapSlow):
     26        * bindings/scripts/test/V8/V8TestInterface.h:
     27        * bindings/scripts/test/V8/V8TestMediaQueryListListener.cpp:
     28        (WebCore::V8TestMediaQueryListListener::wrapSlow):
     29        * bindings/scripts/test/V8/V8TestMediaQueryListListener.h:
     30        * bindings/scripts/test/V8/V8TestObj.cpp:
     31        (WebCore::V8TestObj::wrapSlow):
     32        * bindings/scripts/test/V8/V8TestObj.h:
     33        * bindings/scripts/test/V8/V8TestSerializedScriptValueInterface.cpp:
     34        (WebCore::V8TestSerializedScriptValueInterface::wrapSlow):
     35        * bindings/scripts/test/V8/V8TestSerializedScriptValueInterface.h:
     36
     37        Added the new attribute:
     38        * css/CSSRule.idl:
     39        * css/CSSRuleList.idl:
     40        * css/CSSStyleDeclaration.idl:
     41        * css/CSSValue.idl:
     42        * css/StyleSheet.idl:
     43        * css/StyleSheetList.idl:
     44        * dom/DOMImplementation.idl:
     45        * dom/Node.idl:
     46
    1472011-05-23  Sheriff Bot  <webkit.review.bot@gmail.com>
    248
  • trunk/Source/WebCore/bindings/scripts/CodeGeneratorV8.pm

    r86765 r87063  
    233233    $codeGenerator->AddMethodsConstantsAndAttributesFromParentClasses($dataNode, \@allParents, 1);
    234234
     235    my $hasDependentLifetime = $dataNode->extendedAttributes->{"V8DependentLifetime"} || IsActiveDomType($interfaceName) || $className =~ /SVG/;
     236    if (!$hasDependentLifetime) {
     237        foreach (@{$dataNode->parents}) {
     238            my $parent = $codeGenerator->StripModule($_);
     239            next if $parent eq "EventTarget";
     240            $headerIncludes{"V8${parent}.h"} = 1;
     241        }
     242    }
     243
    235244    my $hasLegacyParent = $dataNode->extendedAttributes->{"LegacyParent"};
    236245
     
    269278    push(@headerContent, "\nclass FloatRect;\n") if $svgPropertyType && $svgPropertyType eq "FloatRect";
    270279    push(@headerContent, "\nclass $className {\n");
     280    push(@headerContent, "public:\n");
     281
     282    push(@headerContent, "    static const bool hasDependentLifetime = ");
     283    if ($hasDependentLifetime) {
     284        push(@headerContent, "true;\n");
     285    } elsif (@{$dataNode->parents}) {
     286        # Even if this type doesn't have the V8DependentLifetime attribute its parents may.
     287        # Let the compiler statically determine this for us.
     288        my $separator = "";
     289        foreach (@{$dataNode->parents}) {
     290            my $parent = $codeGenerator->StripModule($_);
     291            next if $parent eq "EventTarget";
     292            $headerIncludes{"V8${parent}.h"} = 1;
     293            push(@headerContent, "${separator}V8${parent}::hasDependentLifetime");
     294            $separator = " || ";
     295        }
     296        push(@headerContent, ";\n");
     297    } else {
     298        push(@headerContent, "false;\n");
     299    }
    271300
    272301    my $nativeType = GetNativeTypeForConversions($dataNode, $interfaceName);
     
    277306
    278307    push(@headerContent, <<END);
    279 
    280 public:
    281308    static bool HasInstance(v8::Handle<v8::Value> value);
    282309    static v8::Persistent<v8::FunctionTemplate> GetRawTemplate();
     
    25272554    push(@implContent, <<END);
    25282555    v8::Persistent<v8::Object> wrapperHandle = v8::Persistent<v8::Object>::New(wrapper);
     2556    if (!hasDependentLifetime)
     2557        wrapperHandle.MarkIndependent();
    25292558END
    25302559    if (IsNodeSubType($dataNode)) {
  • trunk/Source/WebCore/bindings/scripts/test/V8/V8TestInterface.cpp

    r81789 r87063  
    8989    impl->ref();
    9090    v8::Persistent<v8::Object> wrapperHandle = v8::Persistent<v8::Object>::New(wrapper);
     91    if (!hasDependentLifetime)
     92        wrapperHandle.MarkIndependent();
    9193    getDOMObjectMap().set(impl, wrapperHandle);
    9294    return wrapper;
  • trunk/Source/WebCore/bindings/scripts/test/V8/V8TestInterface.h

    r80072 r87063  
    3434
    3535class V8TestInterface {
    36 
    3736public:
     37    static const bool hasDependentLifetime = false;
    3838    static bool HasInstance(v8::Handle<v8::Value> value);
    3939    static v8::Persistent<v8::FunctionTemplate> GetRawTemplate();
  • trunk/Source/WebCore/bindings/scripts/test/V8/V8TestMediaQueryListListener.cpp

    r81789 r87063  
    9696    impl->ref();
    9797    v8::Persistent<v8::Object> wrapperHandle = v8::Persistent<v8::Object>::New(wrapper);
     98    if (!hasDependentLifetime)
     99        wrapperHandle.MarkIndependent();
    98100    getDOMObjectMap().set(impl, wrapperHandle);
    99101    return wrapper;
  • trunk/Source/WebCore/bindings/scripts/test/V8/V8TestMediaQueryListListener.h

    r80072 r87063  
    3232
    3333class V8TestMediaQueryListListener {
    34 
    3534public:
     35    static const bool hasDependentLifetime = false;
    3636    static bool HasInstance(v8::Handle<v8::Value> value);
    3737    static v8::Persistent<v8::FunctionTemplate> GetRawTemplate();
  • trunk/Source/WebCore/bindings/scripts/test/V8/V8TestObj.cpp

    r81789 r87063  
    13821382    impl->ref();
    13831383    v8::Persistent<v8::Object> wrapperHandle = v8::Persistent<v8::Object>::New(wrapper);
     1384    if (!hasDependentLifetime)
     1385        wrapperHandle.MarkIndependent();
    13841386    getDOMObjectMap().set(impl, wrapperHandle);
    13851387    return wrapper;
  • trunk/Source/WebCore/bindings/scripts/test/V8/V8TestObj.h

    r80072 r87063  
    3232
    3333class V8TestObj {
    34 
    3534public:
     35    static const bool hasDependentLifetime = false;
    3636    static bool HasInstance(v8::Handle<v8::Value> value);
    3737    static v8::Persistent<v8::FunctionTemplate> GetRawTemplate();
  • trunk/Source/WebCore/bindings/scripts/test/V8/V8TestSerializedScriptValueInterface.cpp

    r81789 r87063  
    8585    SerializedScriptValue::deserializeAndSetProperty(wrapper, "value", static_cast<v8::PropertyAttribute>(v8::DontDelete | v8::ReadOnly), impl->value());
    8686    v8::Persistent<v8::Object> wrapperHandle = v8::Persistent<v8::Object>::New(wrapper);
     87    if (!hasDependentLifetime)
     88        wrapperHandle.MarkIndependent();
    8789    getDOMObjectMap().set(impl, wrapperHandle);
    8890    return wrapper;
  • trunk/Source/WebCore/bindings/scripts/test/V8/V8TestSerializedScriptValueInterface.h

    r80072 r87063  
    3434
    3535class V8TestSerializedScriptValueInterface {
    36 
    3736public:
     37    static const bool hasDependentLifetime = false;
    3838    static bool HasInstance(v8::Handle<v8::Value> value);
    3939    static v8::Persistent<v8::FunctionTemplate> GetRawTemplate();
  • trunk/Source/WebCore/css/CSSRule.idl

    r84764 r87063  
    2626        GenerateIsReachable,
    2727        CustomToJS,
    28         Polymorphic
     28        Polymorphic,
     29        V8DependentLifetime
    2930    ] CSSRule {
    3031
  • trunk/Source/WebCore/css/CSSRuleList.idl

    r84699 r87063  
    2929    interface [
    3030        CustomIsReachable,
    31         HasIndexGetter
     31        HasIndexGetter,
     32        V8DependentLifetime
    3233    ] CSSRuleList {
    3334        readonly attribute unsigned long    length;
  • trunk/Source/WebCore/css/CSSStyleDeclaration.idl

    r84764 r87063  
    2727        DelegatingPutFunction,
    2828        HasNameGetter,
    29         HasIndexGetter
     29        HasIndexGetter,
     30        V8DependentLifetime
    3031    ] CSSStyleDeclaration {
    3132                 attribute [ConvertNullStringTo=Null, ConvertNullToNullString] DOMString        cssText
  • trunk/Source/WebCore/css/CSSValue.idl

    r84699 r87063  
    2525        CustomIsReachable,
    2626        CustomFinalize,
    27         Polymorphic
     27        Polymorphic,
     28        V8DependentLifetime
    2829    ] CSSValue {
    2930
  • trunk/Source/WebCore/css/StyleSheet.idl

    r84764 r87063  
    2626        GenerateIsReachable,
    2727        CustomToJS,
    28         Polymorphic
     28        Polymorphic,
     29        V8DependentLifetime
    2930    ] StyleSheet {
    3031        readonly attribute [ConvertNullStringTo=Null] DOMString        type;
  • trunk/Source/WebCore/css/StyleSheetList.idl

    r84764 r87063  
    2525        GenerateIsReachable=ImplDocument,
    2626        HasIndexGetter,
    27         HasNameGetter
     27        HasNameGetter,
     28        V8DependentLifetime
    2829    ] StyleSheetList {
    2930        readonly attribute unsigned long    length;
  • trunk/Source/WebCore/dom/DOMImplementation.idl

    r84764 r87063  
    2222
    2323    interface [
    24         GenerateIsReachable=ImplDocument
     24        GenerateIsReachable=ImplDocument,
     25        V8DependentLifetime
    2526    ] DOMImplementation {
    2627
  • trunk/Source/WebCore/dom/Node.idl

    r84699 r87063  
    3131        GenerateNativeConverter,
    3232        InlineGetOwnPropertySlot,
    33         Polymorphic
     33        Polymorphic,
     34        V8DependentLifetime
    3435    ] Node
    3536#if defined(LANGUAGE_OBJECTIVE_C) && LANGUAGE_OBJECTIVE_C
Note: See TracChangeset for help on using the changeset viewer.