Changeset 49721 in webkit


Ignore:
Timestamp:
Oct 16, 2009, 6:06:40 PM (16 years ago)
Author:
[email protected]
Message:

structure typeinfo flags should be inherited.
https://bugs.webkit.org/show_bug.cgi?id=30468

Reviewed by Gavin Barraclough.

Add StructureFlag constant to the various JSC classes and use
it for the TypeInfo construction. This allows us to simply
accumulate flags by basing each classes StructureInfo on its parents.

Location:
trunk/JavaScriptCore
Files:
30 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/API/JSCallbackConstructor.h

    r49694 r49721  
    4242    static PassRefPtr<Structure> createStructure(JSValue proto)
    4343    {
    44         return Structure::create(proto, TypeInfo(ObjectType, ImplementsHasInstance));
     44        return Structure::create(proto, TypeInfo(ObjectType, StructureFlags));
    4545    }
     46
     47protected:
     48    static const unsigned StructureFlags = ImplementsHasInstance | JSObject::StructureFlags;
    4649
    4750private:
  • trunk/JavaScriptCore/API/JSCallbackFunction.h

    r49649 r49721  
    4242    static PassRefPtr<Structure> createStructure(JSValue proto)
    4343    {
    44         return Structure::create(proto, TypeInfo(ObjectType));
     44        return Structure::create(proto, TypeInfo(ObjectType, StructureFlags));
    4545    }
    4646
  • trunk/JavaScriptCore/API/JSCallbackObject.h

    r49694 r49721  
    5151    static PassRefPtr<Structure> createStructure(JSValue proto)
    5252    {
    53         return Structure::create(proto, TypeInfo(ObjectType, OverridesGetOwnPropertySlot | ImplementsHasInstance | OverridesHasInstance | OverridesMarkChildren | OverridesGetPropertyNames));
     53        return Structure::create(proto, TypeInfo(ObjectType, StructureFlags));
    5454    }
     55
     56protected:
     57    static const unsigned StructureFlags = OverridesGetOwnPropertySlot | ImplementsHasInstance | OverridesHasInstance | OverridesMarkChildren | OverridesGetPropertyNames | Base::StructureFlags;
    5558
    5659private:
  • trunk/JavaScriptCore/ChangeLog

    r49717 r49721  
     12009-10-16  Oliver Hunt  <[email protected]>
     2
     3        Reviewed by Gavin Barraclough.
     4
     5        structure typeinfo flags should be inherited.
     6        https://bugs.webkit.org/show_bug.cgi?id=30468
     7
     8        Add StructureFlag constant to the various JSC classes and use
     9        it for the TypeInfo construction.  This allows us to simply
     10        accumulate flags by basing each classes StructureInfo on its parents.
     11
     12        * API/JSCallbackConstructor.h:
     13        (JSC::JSCallbackConstructor::createStructure):
     14        * API/JSCallbackFunction.h:
     15        (JSC::JSCallbackFunction::createStructure):
     16        * API/JSCallbackObject.h:
     17        (JSC::JSCallbackObject::createStructure):
     18        * debugger/DebuggerActivation.h:
     19        (JSC::DebuggerActivation::createStructure):
     20        * runtime/Arguments.h:
     21        (JSC::Arguments::createStructure):
     22        * runtime/BooleanObject.h:
     23        (JSC::BooleanObject::createStructure):
     24        * runtime/DatePrototype.h:
     25        (JSC::DatePrototype::createStructure):
     26        * runtime/FunctionPrototype.h:
     27        (JSC::FunctionPrototype::createStructure):
     28        * runtime/GlobalEvalFunction.h:
     29        (JSC::GlobalEvalFunction::createStructure):
     30        * runtime/InternalFunction.h:
     31        (JSC::InternalFunction::createStructure):
     32        * runtime/JSActivation.h:
     33        (JSC::JSActivation::createStructure):
     34        * runtime/JSArray.h:
     35        (JSC::JSArray::createStructure):
     36        * runtime/JSByteArray.cpp:
     37        (JSC::JSByteArray::createStructure):
     38        * runtime/JSByteArray.h:
     39        * runtime/JSFunction.h:
     40        (JSC::JSFunction::createStructure):
     41        * runtime/JSGlobalObject.h:
     42        (JSC::JSGlobalObject::createStructure):
     43        * runtime/JSNotAnObject.h:
     44        (JSC::JSNotAnObject::createStructure):
     45        * runtime/JSONObject.h:
     46        (JSC::JSONObject::createStructure):
     47        * runtime/JSObject.h:
     48        (JSC::JSObject::createStructure):
     49        * runtime/JSStaticScopeObject.h:
     50        (JSC::JSStaticScopeObject::createStructure):
     51        * runtime/JSVariableObject.h:
     52        (JSC::JSVariableObject::createStructure):
     53        * runtime/JSWrapperObject.h:
     54        (JSC::JSWrapperObject::createStructure):
     55        * runtime/MathObject.h:
     56        (JSC::MathObject::createStructure):
     57        * runtime/NumberConstructor.h:
     58        (JSC::NumberConstructor::createStructure):
     59        * runtime/NumberObject.h:
     60        (JSC::NumberObject::createStructure):
     61        * runtime/RegExpConstructor.h:
     62        (JSC::RegExpConstructor::createStructure):
     63        * runtime/RegExpObject.h:
     64        (JSC::RegExpObject::createStructure):
     65        * runtime/StringObject.h:
     66        (JSC::StringObject::createStructure):
     67        * runtime/StringObjectThatMasqueradesAsUndefined.h:
     68        (JSC::StringObjectThatMasqueradesAsUndefined::createStructure):
     69
    1702009-10-16  Geoffrey Garen  <[email protected]>
    271
  • trunk/JavaScriptCore/debugger/DebuggerActivation.h

    r49694 r49721  
    5252        static PassRefPtr<Structure> createStructure(JSValue prototype)
    5353        {
    54             return Structure::create(prototype, TypeInfo(ObjectType, OverridesGetOwnPropertySlot | OverridesMarkChildren));
     54            return Structure::create(prototype, TypeInfo(ObjectType, StructureFlags));
    5555        }
     56
     57    protected:
     58        static const unsigned StructureFlags = OverridesGetOwnPropertySlot | OverridesMarkChildren | JSObject::StructureFlags;
    5659
    5760    private:
  • trunk/JavaScriptCore/runtime/Arguments.h

    r49694 r49721  
    8686        static PassRefPtr<Structure> createStructure(JSValue prototype)
    8787        {
    88             return Structure::create(prototype, TypeInfo(ObjectType, OverridesGetOwnPropertySlot | OverridesMarkChildren | OverridesGetPropertyNames));
    89         }
     88            return Structure::create(prototype, TypeInfo(ObjectType, StructureFlags));
     89        }
     90
     91    protected:
     92        static const unsigned StructureFlags = OverridesGetOwnPropertySlot | OverridesMarkChildren | OverridesGetPropertyNames | JSObject::StructureFlags;
    9093
    9194    private:
  • trunk/JavaScriptCore/runtime/BooleanObject.h

    r49694 r49721  
    3535        static PassRefPtr<Structure> createStructure(JSValue prototype)
    3636        {
    37             return Structure::create(prototype, TypeInfo(ObjectType));
     37            return Structure::create(prototype, TypeInfo(ObjectType, StructureFlags));
    3838        }
    3939    };
  • trunk/JavaScriptCore/runtime/DatePrototype.h

    r49694 r49721  
    4040        static PassRefPtr<Structure> createStructure(JSValue prototype)
    4141        {
    42             return Structure::create(prototype, TypeInfo(ObjectType, OverridesGetOwnPropertySlot | OverridesMarkChildren));
     42            return Structure::create(prototype, TypeInfo(ObjectType, StructureFlags));
    4343        }
     44
     45    protected:
     46        static const unsigned StructureFlags = OverridesGetOwnPropertySlot | OverridesMarkChildren | DateInstance::StructureFlags;
     47
    4448    };
    4549
  • trunk/JavaScriptCore/runtime/FunctionPrototype.h

    r49694 r49721  
    3535        static PassRefPtr<Structure> createStructure(JSValue proto)
    3636        {
    37             return Structure::create(proto, TypeInfo(ObjectType));
     37            return Structure::create(proto, TypeInfo(ObjectType, StructureFlags));
    3838        }
    3939
  • trunk/JavaScriptCore/runtime/GlobalEvalFunction.h

    r49694 r49721  
    3838        static PassRefPtr<Structure> createStructure(JSValue prototype)
    3939        {
    40             return Structure::create(prototype, TypeInfo(ObjectType, ImplementsHasInstance | OverridesMarkChildren | OverridesGetPropertyNames));
     40            return Structure::create(prototype, TypeInfo(ObjectType, StructureFlags));
    4141        }
     42
     43    protected:
     44        static const unsigned StructureFlags = ImplementsHasInstance | OverridesMarkChildren | OverridesGetPropertyNames | PrototypeFunction::StructureFlags;
    4245
    4346    private:
  • trunk/JavaScriptCore/runtime/InternalFunction.h

    r49649 r49721  
    4343        static PassRefPtr<Structure> createStructure(JSValue proto)
    4444        {
    45             return Structure::create(proto, TypeInfo(ObjectType, ImplementsHasInstance));
     45            return Structure::create(proto, TypeInfo(ObjectType, StructureFlags));
    4646        }
    4747
    4848    protected:
     49        static const unsigned StructureFlags = ImplementsHasInstance | JSObject::StructureFlags;
     50
    4951        InternalFunction(NonNullPassRefPtr<Structure> structure) : JSObject(structure) { }
    5052        InternalFunction(JSGlobalData*, NonNullPassRefPtr<Structure>, const Identifier&);
  • trunk/JavaScriptCore/runtime/JSActivation.h

    r49694 r49721  
    6767        static const ClassInfo info;
    6868
    69         static PassRefPtr<Structure> createStructure(JSValue proto) { return Structure::create(proto, TypeInfo(ObjectType, OverridesGetOwnPropertySlot | NeedsThisConversion | OverridesMarkChildren | OverridesGetPropertyNames)); }
     69        static PassRefPtr<Structure> createStructure(JSValue proto) { return Structure::create(proto, TypeInfo(ObjectType, StructureFlags)); }
     70
     71    protected:
     72        static const unsigned StructureFlags = OverridesGetOwnPropertySlot | NeedsThisConversion | OverridesMarkChildren | OverridesGetPropertyNames | JSVariableObject::StructureFlags;
    7073
    7174    private:
  • trunk/JavaScriptCore/runtime/JSArray.h

    r49694 r49721  
    8888        static PassRefPtr<Structure> createStructure(JSValue prototype)
    8989        {
    90             return Structure::create(prototype, TypeInfo(ObjectType, OverridesGetOwnPropertySlot | OverridesMarkChildren | OverridesGetPropertyNames));
     90            return Structure::create(prototype, TypeInfo(ObjectType, StructureFlags));
    9191        }
    9292       
     
    9494
    9595    protected:
     96        static const unsigned StructureFlags = OverridesGetOwnPropertySlot | OverridesMarkChildren | OverridesGetPropertyNames | JSObject::StructureFlags;
    9697        virtual void put(ExecState*, const Identifier& propertyName, JSValue, PutPropertySlot&);
    9798        virtual bool deleteProperty(ExecState*, const Identifier& propertyName);
  • trunk/JavaScriptCore/runtime/JSByteArray.cpp

    r49694 r49721  
    4646PassRefPtr<Structure> JSByteArray::createStructure(JSValue prototype)
    4747{
    48     PassRefPtr<Structure> result = Structure::create(prototype, TypeInfo(ObjectType, OverridesGetOwnPropertySlot | OverridesGetPropertyNames));
     48    PassRefPtr<Structure> result = Structure::create(prototype, TypeInfo(ObjectType, StructureFlags));
    4949    return result;
    5050}
  • trunk/JavaScriptCore/runtime/JSByteArray.h

    r48836 r49721  
    9292        WTF::ByteArray* storage() const { return m_storage.get(); }
    9393
     94    protected:
     95        static const unsigned StructureFlags = OverridesGetOwnPropertySlot | OverridesGetPropertyNames | JSObject::StructureFlags;
     96
    9497    private:
    9598        enum VPtrStealingHackType { VPtrStealingHack };
  • trunk/JavaScriptCore/runtime/JSFunction.h

    r49694 r49721  
    6262        static PassRefPtr<Structure> createStructure(JSValue prototype)
    6363        {
    64             return Structure::create(prototype, TypeInfo(ObjectType, OverridesGetOwnPropertySlot | ImplementsHasInstance | OverridesMarkChildren | OverridesGetPropertyNames));
     64            return Structure::create(prototype, TypeInfo(ObjectType, StructureFlags));
    6565        }
    6666
     
    7272        virtual ConstructType getConstructData(ConstructData&);
    7373        virtual CallType getCallData(CallData&);
     74
     75    protected:
     76        const static unsigned StructureFlags = OverridesGetOwnPropertySlot | ImplementsHasInstance | OverridesMarkChildren | OverridesGetPropertyNames | InternalFunction::StructureFlags;
    7477
    7578    private:
  • trunk/JavaScriptCore/runtime/JSGlobalObject.h

    r49694 r49721  
    268268        static PassRefPtr<Structure> createStructure(JSValue prototype)
    269269        {
    270             return Structure::create(prototype, TypeInfo(ObjectType, OverridesGetOwnPropertySlot | OverridesMarkChildren | OverridesGetPropertyNames));
     270            return Structure::create(prototype, TypeInfo(ObjectType, StructureFlags));
    271271        }
    272272
    273273    protected:
     274
     275        static const unsigned StructureFlags = OverridesGetOwnPropertySlot | OverridesMarkChildren | OverridesGetPropertyNames | JSVariableObject::StructureFlags;
     276
    274277        struct GlobalPropertyInfo {
    275278            GlobalPropertyInfo(const Identifier& i, JSValue v, unsigned a)
  • trunk/JavaScriptCore/runtime/JSNotAnObject.h

    r49694 r49721  
    6363        static PassRefPtr<Structure> createStructure(JSValue prototype)
    6464        {
    65             return Structure::create(prototype, TypeInfo(ObjectType, OverridesGetOwnPropertySlot | OverridesMarkChildren | OverridesGetPropertyNames));
     65            return Structure::create(prototype, TypeInfo(ObjectType, StructureFlags));
    6666        }
    6767
    6868     private:
     69       
     70        static const unsigned StructureFlags = OverridesGetOwnPropertySlot | OverridesMarkChildren | OverridesGetPropertyNames | JSObject::StructureFlags;
     71
    6972        // JSValue methods
    7073        virtual JSValue toPrimitive(ExecState*, PreferredPrimitiveType) const;
  • trunk/JavaScriptCore/runtime/JSONObject.h

    r49694 r49721  
    4242        static PassRefPtr<Structure> createStructure(JSValue prototype)
    4343        {
    44             return Structure::create(prototype, TypeInfo(ObjectType, OverridesGetOwnPropertySlot));
     44            return Structure::create(prototype, TypeInfo(ObjectType, StructureFlags));
    4545        }
    4646
    4747        static void markStringifiers(MarkStack&, Stringifier*);
     48
     49    protected:
     50        static const unsigned StructureFlags = OverridesGetOwnPropertySlot | JSObject::StructureFlags;
    4851
    4952    private:
  • trunk/JavaScriptCore/runtime/JSObject.h

    r49694 r49721  
    208208        static PassRefPtr<Structure> createStructure(JSValue prototype)
    209209        {
    210             return Structure::create(prototype, TypeInfo(ObjectType));
     210            return Structure::create(prototype, TypeInfo(ObjectType, StructureFlags));
    211211        }
    212212
    213213    protected:
     214        static const unsigned StructureFlags = 0;
     215
    214216        void addAnonymousSlots(unsigned count);
    215217        void putAnonymousValue(unsigned index, JSValue value)
  • trunk/JavaScriptCore/runtime/JSStaticScopeObject.h

    r49694 r49721  
    5858        void putWithAttributes(ExecState*, const Identifier&, JSValue, unsigned attributes);
    5959
    60         static PassRefPtr<Structure> createStructure(JSValue proto) { return Structure::create(proto, TypeInfo(ObjectType, OverridesGetOwnPropertySlot | NeedsThisConversion | OverridesMarkChildren | OverridesGetPropertyNames)); }
     60        static PassRefPtr<Structure> createStructure(JSValue proto) { return Structure::create(proto, TypeInfo(ObjectType, StructureFlags)); }
     61
     62    protected:
     63        static const unsigned StructureFlags = OverridesGetOwnPropertySlot | NeedsThisConversion | OverridesMarkChildren | OverridesGetPropertyNames | JSVariableObject::StructureFlags;
    6164
    6265    private:
  • trunk/JavaScriptCore/runtime/JSVariableObject.h

    r49694 r49721  
    6161        static PassRefPtr<Structure> createStructure(JSValue prototype)
    6262        {
    63             return Structure::create(prototype, TypeInfo(ObjectType, OverridesGetPropertyNames));
     63            return Structure::create(prototype, TypeInfo(ObjectType, StructureFlags));
    6464        }
    6565       
    6666    protected:
     67        static const unsigned StructureFlags = OverridesGetPropertyNames | JSObject::StructureFlags;
    6768        // Subclasses of JSVariableObject can subclass this struct to add data
    6869        // without increasing their own size (since there's a hard limit on the
  • trunk/JavaScriptCore/runtime/JSWrapperObject.h

    r49694 r49721  
    3939        static PassRefPtr<Structure> createStructure(JSValue prototype)
    4040        {
    41             return Structure::create(prototype, TypeInfo(ObjectType));
     41            return Structure::create(prototype, TypeInfo(ObjectType, StructureFlags));
    4242        }
    4343
  • trunk/JavaScriptCore/runtime/MathObject.h

    r49694 r49721  
    3838        static PassRefPtr<Structure> createStructure(JSValue prototype)
    3939        {
    40             return Structure::create(prototype, TypeInfo(ObjectType, OverridesGetOwnPropertySlot));
     40            return Structure::create(prototype, TypeInfo(ObjectType, StructureFlags));
    4141        }
     42
     43    protected:
     44        static const unsigned StructureFlags = OverridesGetOwnPropertySlot | JSObject::StructureFlags;
    4245    };
    4346
  • trunk/JavaScriptCore/runtime/NumberConstructor.h

    r49694 r49721  
    4040        static PassRefPtr<Structure> createStructure(JSValue proto)
    4141        {
    42             return Structure::create(proto, TypeInfo(ObjectType, OverridesGetOwnPropertySlot | ImplementsHasInstance));
     42            return Structure::create(proto, TypeInfo(ObjectType, StructureFlags));
    4343        }
    4444
    4545        enum { NaNValue, NegInfinity, PosInfinity, MaxValue, MinValue };
     46
     47    protected:
     48        static const unsigned StructureFlags = OverridesGetOwnPropertySlot | ImplementsHasInstance | InternalFunction::StructureFlags;
    4649
    4750    private:
  • trunk/JavaScriptCore/runtime/NumberObject.h

    r49694 r49721  
    3131
    3232        static const ClassInfo info;
    33 #if USE(JSVALUE32)
     33
    3434        static PassRefPtr<Structure> createStructure(JSValue prototype)
    3535        {
    36             return Structure::create(prototype, TypeInfo(ObjectType, OverridesMarkChildren));
     36            return Structure::create(prototype, TypeInfo(ObjectType, StructureFlags));
    3737        }
     38
     39    protected:
     40#if USE(JSVALUE32)
     41        static const unsigned StructureFlags = OverridesMarkChildren | JSWrapperObject::StructureFlags;
    3842#else
    39         static PassRefPtr<Structure> createStructure(JSValue prototype)
    40         {
    41             return Structure::create(prototype, TypeInfo(ObjectType));
    42         }
     43        static const unsigned StructureFlags = JSWrapperObject::StructureFlags;
    4344#endif
     45
    4446    private:
    4547        virtual const ClassInfo* classInfo() const { return &info; }
  • trunk/JavaScriptCore/runtime/RegExpConstructor.h

    r49694 r49721  
    6060        static PassRefPtr<Structure> createStructure(JSValue prototype)
    6161        {
    62             return Structure::create(prototype, TypeInfo(ObjectType, OverridesGetOwnPropertySlot | ImplementsHasInstance));
     62            return Structure::create(prototype, TypeInfo(ObjectType, StructureFlags));
    6363        }
    6464
     
    8282        JSValue getLeftContext(ExecState*) const;
    8383        JSValue getRightContext(ExecState*) const;
     84
     85    protected:
     86        static const unsigned StructureFlags = OverridesGetOwnPropertySlot | ImplementsHasInstance | InternalFunction::StructureFlags;
    8487
    8588    private:
  • trunk/JavaScriptCore/runtime/RegExpObject.h

    r49694 r49721  
    5050        static PassRefPtr<Structure> createStructure(JSValue prototype)
    5151        {
    52             return Structure::create(prototype, TypeInfo(ObjectType, OverridesGetOwnPropertySlot));
     52            return Structure::create(prototype, TypeInfo(ObjectType, StructureFlags));
    5353        }
     54
     55    protected:
     56        static const unsigned StructureFlags = OverridesGetOwnPropertySlot | JSObject::StructureFlags;
    5457
    5558    private:
  • trunk/JavaScriptCore/runtime/StringObject.h

    r49694 r49721  
    4949        static PassRefPtr<Structure> createStructure(JSValue prototype)
    5050        {
    51             return Structure::create(prototype, TypeInfo(ObjectType, OverridesGetOwnPropertySlot | OverridesMarkChildren | OverridesGetPropertyNames));
     51            return Structure::create(prototype, TypeInfo(ObjectType, StructureFlags));
    5252        }
    5353
    5454    protected:
     55        static const unsigned StructureFlags = OverridesGetOwnPropertySlot | OverridesMarkChildren | OverridesGetPropertyNames | JSWrapperObject::StructureFlags;
    5556        StringObject(NonNullPassRefPtr<Structure>, JSString*);
    5657  };
  • trunk/JavaScriptCore/runtime/StringObjectThatMasqueradesAsUndefined.h

    r49694 r49721  
    4545        static PassRefPtr<Structure> createStructure(JSValue proto)
    4646        {
    47             return Structure::create(proto, TypeInfo(ObjectType, OverridesGetOwnPropertySlot | MasqueradesAsUndefined | OverridesGetPropertyNames));
     47            return Structure::create(proto, TypeInfo(ObjectType, StructureFlags));
    4848        }
     49
     50        static const unsigned StructureFlags = OverridesGetOwnPropertySlot | MasqueradesAsUndefined | OverridesGetPropertyNames | StringObject::StructureFlags;
    4951
    5052        virtual bool toBoolean(ExecState*) const { return false; }
Note: See TracChangeset for help on using the changeset viewer.