Changeset 49835 in webkit


Ignore:
Timestamp:
Oct 19, 2009 9:05:05 PM (15 years ago)
Author:
oliver@apple.com
Message:

REGRESSION: Dromaeo DOM test is 14% slower
https://bugs.webkit.org/show_bug.cgi?id=30273

Reviewed by Gavin Barraclough.

Make DOM bindings automatically inherit correct structure
flags rather than being needlessly conservative. This is
done by making the bindings generator use the same model
for TypeInfo flags that we now use in JSC.

This gains us about 1% of this regression back.

Location:
trunk/WebCore
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r49833 r49835  
     12009-10-19  Oliver Hunt  <oliver@apple.com>
     2
     3        Reviewed by Gavin Barraclough.
     4
     5        REGRESSION: Dromaeo DOM test is 14% slower
     6        https://bugs.webkit.org/show_bug.cgi?id=30273
     7
     8        Make DOM bindings automatically inherit correct structure
     9        flags rather than being needlessly conservative.  This is
     10        done by making the bindings generator use the same model
     11        for TypeInfo flags that we now use in JSC.
     12
     13        This gains us about 1% of this regression back.
     14
     15        * bindings/js/JSDOMBinding.h:
     16        (WebCore::DOMObjectWithGlobalPointer::createStructure):
     17        (WebCore::DOMConstructorObject::createStructure):
     18        * bindings/js/JSDOMWindowShell.h:
     19        (WebCore::JSDOMWindowShell::createStructure):
     20        * bindings/js/JSHTMLAllCollection.h:
     21        (WebCore::JSHTMLAllCollection::createStructure):
     22        * bindings/js/JSQuarantinedObjectWrapper.h:
     23        (WebCore::JSQuarantinedObjectWrapper::createStructure):
     24        * bindings/scripts/CodeGeneratorJS.pm:
     25        * bridge/objc/objc_runtime.h:
     26        (JSC::Bindings::ObjcFallbackObjectImp::createStructure):
     27        * bridge/runtime_array.h:
     28        (JSC::RuntimeArray::createStructure):
     29        * bridge/runtime_method.h:
     30        (JSC::RuntimeMethod::createStructure):
     31        * bridge/runtime_object.h:
     32        (JSC::RuntimeObjectImp::createStructure):
     33
    1342009-10-19  Robin Qiu  <robin.qiu@torchmobile.com.cn>
    235
  • trunk/WebCore/bindings/js/JSDOMBinding.h

    r49649 r49835  
    7777        static PassRefPtr<JSC::Structure> createStructure(JSC::JSValue prototype)
    7878        {
    79             return JSC::Structure::create(prototype, JSC::TypeInfo(JSC::ObjectType, JSC::OverridesMarkChildren));
     79            return JSC::Structure::create(prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags));
    8080        }
    8181
    8282    protected:
     83        static const unsigned StructureFlags = JSC::OverridesMarkChildren | DOMObject::StructureFlags;
     84
    8385        DOMObjectWithGlobalPointer(NonNullPassRefPtr<JSC::Structure> structure, JSDOMGlobalObject* globalObject)
    8486            : DOMObject(structure)
     
    107109        static PassRefPtr<JSC::Structure> createStructure(JSC::JSValue prototype)
    108110        {
    109             return JSC::Structure::create(prototype, JSC::TypeInfo(JSC::ObjectType, JSC::ImplementsHasInstance | JSC::OverridesMarkChildren));
     111            return JSC::Structure::create(prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags));
    110112        }
    111113
    112114    protected:
     115        static const unsigned StructureFlags = JSC::ImplementsHasInstance | JSC::OverridesMarkChildren | DOMObjectWithGlobalPointer::StructureFlags;
    113116        DOMConstructorObject(NonNullPassRefPtr<JSC::Structure> structure, JSDOMGlobalObject* globalObject)
    114117            : DOMObjectWithGlobalPointer(structure, globalObject)
  • trunk/WebCore/bindings/js/JSDOMWindowShell.h

    r49694 r49835  
    6161        static PassRefPtr<JSC::Structure> createStructure(JSC::JSValue prototype)
    6262        {
    63             return JSC::Structure::create(prototype, JSC::TypeInfo(JSC::ObjectType, JSC::OverridesGetOwnPropertySlot | JSC::OverridesMarkChildren | JSC::OverridesGetPropertyNames));
     63            return JSC::Structure::create(prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags));
    6464        }
    6565
    6666    private:
     67        static const unsigned StructureFlags = JSC::OverridesGetOwnPropertySlot | JSC::OverridesMarkChildren | JSC::OverridesGetPropertyNames | DOMObject::StructureFlags;
     68
    6769        virtual void markChildren(JSC::MarkStack&);
    6870        virtual JSC::UString className() const;
  • trunk/WebCore/bindings/js/JSHTMLAllCollection.h

    r49694 r49835  
    4343        static PassRefPtr<JSC::Structure> createStructure(JSC::JSValue proto)
    4444        {
    45             return JSC::Structure::create(proto, JSC::TypeInfo(JSC::ObjectType, JSC::OverridesGetOwnPropertySlot | JSC::MasqueradesAsUndefined | JSC::OverridesMarkChildren | JSC::OverridesGetPropertyNames));
     45            return JSC::Structure::create(proto, JSC::TypeInfo(JSC::ObjectType, StructureFlags));
    4646        }
    4747
    4848        static const JSC::ClassInfo s_info;
     49    protected:
     50        static const unsigned StructureFlags = JSC::OverridesGetOwnPropertySlot | JSC::MasqueradesAsUndefined | JSC::OverridesMarkChildren | JSC::OverridesGetPropertyNames | JSHTMLCollection::StructureFlags;
    4951
    5052    private:
  • trunk/WebCore/bindings/js/JSQuarantinedObjectWrapper.h

    r49694 r49835  
    4848        static PassRefPtr<JSC::Structure> createStructure(JSC::JSValue proto)
    4949        {
    50             return JSC::Structure::create(proto, JSC::TypeInfo(JSC::ObjectType, JSC::OverridesGetOwnPropertySlot | JSC::ImplementsHasInstance | JSC::OverridesHasInstance | JSC::OverridesMarkChildren | JSC::OverridesGetPropertyNames));
     50            return JSC::Structure::create(proto, JSC::TypeInfo(JSC::ObjectType, StructureFlags));
    5151        }
    5252
    5353    protected:
     54        static const unsigned StructureFlags = JSC::OverridesGetOwnPropertySlot | JSC::ImplementsHasInstance | JSC::OverridesHasInstance | JSC::OverridesMarkChildren | JSC::OverridesGetPropertyNames | JSC::JSObject::StructureFlags;
     55
    5456        JSQuarantinedObjectWrapper(JSC::ExecState* unwrappedExec, JSC::JSObject* unwrappedObject, NonNullPassRefPtr<JSC::Structure>);
    5557
  • trunk/WebCore/bindings/scripts/CodeGeneratorJS.pm

    r49694 r49835  
    464464    my $implClassName = $interfaceName;
    465465    my @ancestorInterfaceNames = ();
     466    my %structureFlags = ();
    466467
    467468    # We only support multiple parents with SVG (for now).
     
    575576        push(@headerContent, "    bool getOwnPropertySlotDelegate(JSC::ExecState*, const JSC::Identifier&, JSC::PropertySlot&);\n") if $dataNode->extendedAttributes->{"DelegatingGetOwnPropertySlot"};
    576577        push(@headerContent, "    bool getOwnPropertyDescriptorDelegate(JSC::ExecState*, const JSC::Identifier&, JSC::PropertyDescriptor&);\n") if $dataNode->extendedAttributes->{"DelegatingGetOwnPropertySlot"};
     578        $structureFlags{"JSC::OverridesGetOwnPropertySlot"} = 1;
    577579    }
    578580
     
    603605    # Structure ID
    604606    if ($interfaceName eq "DOMWindow") {
    605         push(@headerContent,
    606             "    static PassRefPtr<JSC::Structure> createStructure(JSC::JSValue prototype)\n" .
    607             "    {\n" .
    608             "        return JSC::Structure::create(prototype, JSC::TypeInfo(JSC::ObjectType, JSC::OverridesGetOwnPropertySlot | JSC::ImplementsHasInstance | JSC::NeedsThisConversion | JSC::OverridesMarkChildren | JSC::OverridesGetPropertyNames));\n" .
    609             "    }\n\n");
    610     } elsif ($hasGetter) {
    611         push(@headerContent,
    612             "    static PassRefPtr<JSC::Structure> createStructure(JSC::JSValue prototype)\n" .
    613             "    {\n" .
    614             "        return JSC::Structure::create(prototype, JSC::TypeInfo(JSC::ObjectType, JSC::OverridesGetOwnPropertySlot | JSC::OverridesMarkChildren | JSC::OverridesGetPropertyNames));\n" .
    615             "    }\n\n");
    616     }
     607        $structureFlags{"JSC::ImplementsHasInstance"} = 1;
     608        $structureFlags{"JSC::NeedsThisConversion"} = 1;
     609    }
     610    push(@headerContent,
     611        "    static PassRefPtr<JSC::Structure> createStructure(JSC::JSValue prototype)\n" .
     612        "    {\n" .
     613        "        return JSC::Structure::create(prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags));\n" .
     614        "    }\n\n");
    617615
    618616    # markChildren function
    619     push(@headerContent, "    virtual void markChildren(JSC::MarkStack&);\n\n") if $needsMarkChildren;
     617    if ($needsMarkChildren) {
     618        push(@headerContent, "    virtual void markChildren(JSC::MarkStack&);\n\n");
     619        $structureFlags{"JSC::OverridesMarkChildren"} = 1;
     620    }
    620621
    621622    # Custom pushEventHandlerScope function
     
    629630
    630631    # Custom getPropertyNames function exists on DOMWindow
    631     push(@headerContent, "    virtual void getPropertyNames(JSC::ExecState*, JSC::PropertyNameArray&);\n") if $interfaceName eq "DOMWindow";
     632    if ($interfaceName eq "DOMWindow") {
     633        push(@headerContent, "    virtual void getPropertyNames(JSC::ExecState*, JSC::PropertyNameArray&);\n");
     634        $structureFlags{"JSC::OverridesGetPropertyNames"} = 1;
     635    }
    632636
    633637    # Custom defineProperty function exists on DOMWindow
     
    635639
    636640    # Custom getOwnPropertyNames function
    637     push(@headerContent, "    virtual void getOwnPropertyNames(JSC::ExecState*, JSC::PropertyNameArray&);\n") if ($dataNode->extendedAttributes->{"CustomGetPropertyNames"} || $dataNode->extendedAttributes->{"HasIndexGetter"} || $dataNode->extendedAttributes->{"HasCustomIndexGetter"} || $dataNode->extendedAttributes->{"HasNumericIndexGetter"});   
     641    if ($dataNode->extendedAttributes->{"CustomGetPropertyNames"} || $dataNode->extendedAttributes->{"HasIndexGetter"} || $dataNode->extendedAttributes->{"HasCustomIndexGetter"} || $dataNode->extendedAttributes->{"HasNumericIndexGetter"}) {
     642        push(@headerContent, "    virtual void getOwnPropertyNames(JSC::ExecState*, JSC::PropertyNameArray&);\n");
     643        $structureFlags{"JSC::OverridesGetPropertyNames"} = 1;       
     644    }
    638645
    639646    # Custom getPropertyAttributes function
     
    713720        push(@headerContent, "    }\n");
    714721    }
     722   
     723    # structure flags
     724    push(@headerContent, "protected:\n");
     725    push(@headerContent, "    static const unsigned StructureFlags = ");
     726    foreach my $structureFlag (keys %structureFlags) {
     727        push(@headerContent, $structureFlag . " | ");
     728    }
     729    push(@headerContent, "Base::StructureFlags;\n");
    715730
    716731    # Index getter
     
    720735    if ($dataNode->extendedAttributes->{"HasCustomIndexGetter"} || $dataNode->extendedAttributes->{"HasNumericIndexGetter"}) {
    721736        push(@headerContent, "    JSC::JSValue getByIndex(JSC::ExecState*, unsigned index);\n");
     737       
    722738    }
    723739   
     
    771787
    772788    # Add prototype declaration.
     789    %structureFlags = ();
    773790    push(@headerContent, "class ${className}Prototype : public JSC::JSObject {\n");
    774791    push(@headerContent, "    typedef JSC::JSObject Base;\n");
     
    788805        push(@headerContent, "    bool getOwnPropertySlotDelegate(JSC::ExecState*, const JSC::Identifier&, JSC::PropertySlot&);\n") if $dataNode->extendedAttributes->{"DelegatingPrototypeGetOwnPropertySlot"};
    789806        push(@headerContent, "    bool getOwnPropertyDescriptorDelegate(JSC::ExecState*, const JSC::Identifier&, JSC::PropertyDescriptor&);\n") if $dataNode->extendedAttributes->{"DelegatingPrototypeGetOwnPropertySlot"};
    790 
    791         push(@headerContent,
    792             "    static PassRefPtr<JSC::Structure> createStructure(JSC::JSValue prototype)\n" .
    793             "    {\n" .
    794             "        return JSC::Structure::create(prototype, JSC::TypeInfo(JSC::ObjectType, JSC::OverridesGetOwnPropertySlot" . ($needsMarkChildren ? " | JSC::OverridesMarkChildren" : "") . " | JSC::OverridesGetPropertyNames));\n" .
    795             "    }\n");
    796     } elsif ($dataNode->extendedAttributes->{"CustomMarkFunction"}) {
    797         push(@headerContent,
    798             "    static PassRefPtr<JSC::Structure> createStructure(JSC::JSValue prototype)\n" .
    799             "    {\n" .
    800             "        return JSC::Structure::create(prototype, JSC::TypeInfo(JSC::ObjectType, JSC::OverridesGetOwnPropertySlot | JSC::OverridesMarkChildren | JSC::OverridesGetPropertyNames));\n" .
    801             "    }\n");
    802     }
     807        $structureFlags{"JSC::OverridesGetOwnPropertySlot"} = 1;
     808    }
     809    if ($dataNode->extendedAttributes->{"CustomMarkFunction"} or $needsMarkChildren) {
     810        $structureFlags{"JSC::OverridesMarkChildren"} = 1;
     811    }
     812    push(@headerContent,
     813        "    static PassRefPtr<JSC::Structure> createStructure(JSC::JSValue prototype)\n" .
     814        "    {\n" .
     815        "        return JSC::Structure::create(prototype, JSC::TypeInfo(JSC::ObjectType, JSC::OverridesGetOwnPropertySlot" . ($needsMarkChildren ? " | JSC::OverridesMarkChildren" : "") . " | JSC::OverridesGetPropertyNames));\n" .
     816        "    }\n");
    803817    if ($dataNode->extendedAttributes->{"DelegatingPrototypePutFunction"}) {
    804818        push(@headerContent, "    virtual void put(JSC::ExecState*, const JSC::Identifier& propertyName, JSC::JSValue, JSC::PutPropertySlot&);\n");
     
    810824
    811825    push(@headerContent, "    ${className}Prototype(NonNullPassRefPtr<JSC::Structure> structure) : JSC::JSObject(structure) { }\n");
     826
     827    # structure flags
     828    push(@headerContent, "protected:\n");
     829    push(@headerContent, "    static const unsigned StructureFlags = ");
     830    foreach my $structureFlag (keys %structureFlags) {
     831        push(@headerContent, $structureFlag . " | ");
     832    }
     833    push(@headerContent, "Base::StructureFlags;\n");
    812834
    813835    push(@headerContent, "};\n\n");
     
    22542276    static PassRefPtr<Structure> createStructure(JSValue proto)
    22552277    {
    2256         return Structure::create(proto, TypeInfo(ObjectType, OverridesGetOwnPropertySlot | ImplementsHasInstance | OverridesMarkChildren | OverridesGetPropertyNames));
    2257     }
     2278        return Structure::create(proto, TypeInfo(ObjectType, StructureFlags));
     2279    }
     2280   
     2281protected:
     2282    static const unsigned StructureFlags = OverridesGetOwnPropertySlot | ImplementsHasInstance | DOMConstructorObject::StructureFlags;
    22582283EOF
    22592284
  • trunk/WebCore/bridge/objc/objc_runtime.h

    r49607 r49835  
    105105    static PassRefPtr<Structure> createStructure(JSValue prototype)
    106106    {
    107         return Structure::create(prototype, TypeInfo(ObjectType, OverridesGetOwnPropertySlot));
     107        return Structure::create(prototype, TypeInfo(ObjectType, StructureFlags));
    108108    }
    109109
    110110private:
     111    static const unsigned StructureFlags = OverridesGetOwnPropertySlot | JSObject::StructureFlags;
    111112    virtual bool getOwnPropertySlot(ExecState*, const Identifier&, PropertySlot&);
    112113    virtual bool getOwnPropertyDescriptor(ExecState*, const Identifier&, PropertyDescriptor&);
  • trunk/WebCore/bridge/runtime_array.h

    r49694 r49835  
    6060    static PassRefPtr<Structure> createStructure(JSValue prototype)
    6161    {
    62         return Structure::create(prototype, TypeInfo(ObjectType, OverridesGetOwnPropertySlot | OverridesGetPropertyNames));
     62        return Structure::create(prototype, TypeInfo(ObjectType, StructureFlags));
    6363    }
    6464
    6565private:
     66    static const unsigned StructureFlags = OverridesGetOwnPropertySlot | OverridesGetPropertyNames | JSObject::StructureFlags;
    6667    static JSValue lengthGetter(ExecState*, const Identifier&, const PropertySlot&);
    6768    static JSValue indexGetter(ExecState*, const Identifier&, const PropertySlot&);
  • trunk/WebCore/bridge/runtime_method.h

    r49649 r49835  
    4848    static PassRefPtr<Structure> createStructure(JSValue prototype)
    4949    {
    50         return Structure::create(prototype, TypeInfo(ObjectType, OverridesGetOwnPropertySlot | ImplementsHasInstance | OverridesMarkChildren));
     50        return Structure::create(prototype, TypeInfo(ObjectType, StructureFlags));
    5151    }
    5252
    5353private:
     54    static const unsigned StructureFlags = OverridesGetOwnPropertySlot | ImplementsHasInstance | OverridesMarkChildren | InternalFunction::StructureFlags;
    5455    static JSValue lengthGetter(ExecState*, const Identifier&, const PropertySlot&);
    5556    virtual bool getOwnPropertySlot(ExecState*, const Identifier&, PropertySlot&);
  • trunk/WebCore/bridge/runtime_object.h

    r49694 r49835  
    6363    static PassRefPtr<Structure> createStructure(JSValue prototype)
    6464    {
    65         return Structure::create(prototype, TypeInfo(ObjectType, OverridesGetOwnPropertySlot | OverridesGetPropertyNames));
     65        return Structure::create(prototype, TypeInfo(ObjectType, StructureFlags));
    6666    }
    6767
    6868protected:
     69    static const unsigned StructureFlags = OverridesGetOwnPropertySlot | OverridesGetPropertyNames | JSObject::StructureFlags;
    6970    RuntimeObjectImp(ExecState*, NonNullPassRefPtr<Structure>, PassRefPtr<Bindings::Instance>);
    7071
Note: See TracChangeset for help on using the changeset viewer.