Changeset 96831 in webkit for trunk/Source/JavaScriptCore


Ignore:
Timestamp:
Oct 6, 2011, 10:42:50 AM (14 years ago)
Author:
[email protected]
Message:

JSC objects need to know their own cell size at runtime.
https://bugs.webkit.org/show_bug.cgi?id=69390

Reviewed by Geoffrey Garen.

Added the cellSize field to ClassInfo and the static calculation of
size of each class to the CREATE_METHOD_TABLE macro, which will be
renamed in a followup patch to make its name match its broader use.

Also added a few ClassInfo structs so that each object that is allocated has its
correct size.

Changed JSByteArray s_defaultInfo to s_info so that the template will get the
correct ClassInfo struct from it when it's allocated.

  • runtime/JSByteArray.cpp:
  • runtime/JSByteArray.h:
  • runtime/JSCell.h:

(JSC::allocateCell):

  • runtime/JSNotAnObject.cpp:
  • runtime/JSNotAnObject.h:
  • runtime/JSObject.cpp:
  • runtime/JSObject.h:

(JSC::JSCell::cellSize):

  • runtime/JSStaticScopeObject.cpp:
  • runtime/JSStaticScopeObject.h:
  • runtime/StrictEvalActivation.cpp:
  • runtime/StrictEvalActivation.h:
Location:
trunk/Source/JavaScriptCore
Files:
15 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/ChangeLog

    r96809 r96831  
     12011-10-06  Mark Hahnenberg  <[email protected]>
     2
     3        JSC objects need to know their own cell size at runtime.
     4        https://bugs.webkit.org/show_bug.cgi?id=69390
     5
     6        Reviewed by Geoffrey Garen.
     7
     8        Added the cellSize field to ClassInfo and the static calculation of
     9        size of each class to the CREATE_METHOD_TABLE macro, which will be
     10        renamed in a followup patch to make its name match its broader use.
     11
     12        Also added a few ClassInfo structs so that each object that is allocated has its
     13        correct size. 
     14
     15        * JavaScriptCore.exp:
     16        * runtime/ClassInfo.h:
     17
     18        Changed JSByteArray s_defaultInfo to s_info so that the template will get the
     19        correct ClassInfo struct from it when it's allocated.
     20        * runtime/JSByteArray.cpp:
     21        * runtime/JSByteArray.h:
     22        * runtime/JSCell.h:
     23        (JSC::allocateCell):
     24        * runtime/JSNotAnObject.cpp:
     25        * runtime/JSNotAnObject.h:
     26        * runtime/JSObject.cpp:
     27        * runtime/JSObject.h:
     28        (JSC::JSCell::cellSize):
     29        * runtime/JSStaticScopeObject.cpp:
     30        * runtime/JSStaticScopeObject.h:
     31        * runtime/StrictEvalActivation.cpp:
     32        * runtime/StrictEvalActivation.h:
     33
    1342011-10-06  Gavin Peters  <[email protected]>
    235
  • trunk/Source/JavaScriptCore/JavaScriptCore.exp

    r96809 r96831  
    116116__ZN3JSC10throwErrorEPNS_9ExecStateENS_7JSValueE
    117117__ZN3JSC10throwErrorEPNS_9ExecStateEPNS_8JSObjectE
    118 __ZN3JSC11JSByteArray13s_defaultInfoE
    119118__ZN3JSC11JSByteArray15createStructureERNS_12JSGlobalDataEPNS_14JSGlobalObjectENS_7JSValueEPKNS_9ClassInfoE
     119__ZN3JSC11JSByteArray6s_infoE
    120120__ZN3JSC11JSByteArrayC1EPNS_9ExecStateEPNS_9StructureEPN3WTF9ByteArrayE
    121121__ZN3JSC11ParserArena5resetEv
     
    156156__ZN3JSC12StringObject6s_infoE
    157157__ZN3JSC12StringObjectC2ERNS_12JSGlobalDataEPNS_9StructureE
     158__ZN3JSC13JSFinalObject6s_infoE
    158159__ZN3JSC13SamplingFlags4stopEv
    159160__ZN3JSC13SamplingFlags5startEv
     
    331332__ZN3JSC8JSObject3putEPNS_9ExecStateEjNS_7JSValueE
    332333__ZN3JSC8JSObject6s_infoE
     334__ZN3JSC8JSString6s_infoE
    333335__ZN3JSC8Profiler13stopProfilingEPNS_9ExecStateERKNS_7UStringE
    334336__ZN3JSC8Profiler14startProfilingEPNS_9ExecStateERKNS_7UStringE
  • trunk/Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def

    r96809 r96831  
    304304    ?retrieveCaller@Interpreter@JSC@@QBE?AVJSValue@2@PAVExecState@2@PAVJSFunction@2@@Z
    305305    ?retrieveLastCaller@Interpreter@JSC@@QBEXPAVExecState@2@AAH1AAVUString@2@AAVJSValue@2@@Z
     306    ?s_info@JSAPIValueWrapper@JSC@@2UClassInfo@2@B
     307    ?s_info@JSByteArray@JSC@@2UClassInfo@2@B
     308    ?s_info@JSFinalObject@JSC@@2UClassInfo@2@B
    306309    ?setAccessorDescriptor@PropertyDescriptor@JSC@@QAEXVJSValue@2@0I@Z
    307310    ?setConfigurable@PropertyDescriptor@JSC@@QAEX_N@Z
  • trunk/Source/JavaScriptCore/runtime/ClassInfo.h

    r96406 r96831  
    4242        &ClassName::visitChildren, \
    4343        &ClassName::getCallData \
    44     }
     44    }, \
     45    sizeof(ClassName)
    4546
    4647    struct ClassInfo {
     
    8081
    8182        MethodTable methodTable;
     83
     84        size_t cellSize;
    8285    };
    8386
  • trunk/Source/JavaScriptCore/runtime/JSByteArray.cpp

    r95936 r96831  
    3434namespace JSC {
    3535
    36 const ClassInfo JSByteArray::s_defaultInfo = { "ByteArray", &Base::s_info, 0, 0, CREATE_METHOD_TABLE(JSByteArray) };
     36const ClassInfo JSByteArray::s_info = { "ByteArray", &Base::s_info, 0, 0, CREATE_METHOD_TABLE(JSByteArray) };
    3737
    3838JSByteArray::JSByteArray(ExecState* exec, Structure* structure, ByteArray* storage)
  • trunk/Source/JavaScriptCore/runtime/JSByteArray.h

    r95901 r96831  
    8787        }
    8888
    89         static Structure* createStructure(JSGlobalData&, JSGlobalObject*, JSValue prototype, const JSC::ClassInfo* = &s_defaultInfo);
     89        static Structure* createStructure(JSGlobalData&, JSGlobalObject*, JSValue prototype, const JSC::ClassInfo* = &s_info);
    9090
    9191        virtual bool getOwnPropertySlot(JSC::ExecState*, const JSC::Identifier& propertyName, JSC::PropertySlot&);
     
    9797        virtual void getOwnPropertyNames(JSC::ExecState*, JSC::PropertyNameArray&, EnumerationMode mode = ExcludeDontEnumProperties);
    9898
    99         static const ClassInfo s_defaultInfo;
     99        static const ClassInfo s_info;
    100100       
    101101        size_t length() const { return m_storage->length(); }
  • trunk/Source/JavaScriptCore/runtime/JSCell.h

    r96673 r96831  
    320320    {
    321321#if ENABLE(GC_VALIDATION)
     322        ASSERT(sizeof(T) == T::s_info.cellSize);
    322323        ASSERT(!heap.globalData()->isInitializingObject());
    323324        heap.globalData()->setInitializingObject(true);
  • trunk/Source/JavaScriptCore/runtime/JSNotAnObject.cpp

    r96381 r96831  
    3636
    3737ASSERT_CLASS_FITS_IN_CELL(JSNotAnObject);
     38
     39const ClassInfo JSNotAnObject::s_info = { "Object", &Base::s_info, 0, 0, CREATE_METHOD_TABLE(JSNotAnObject) };
    3840
    3941// JSValue methods
  • trunk/Source/JavaScriptCore/runtime/JSNotAnObject.h

    r96381 r96831  
    5959        }
    6060
     61        static const ClassInfo s_info;
     62
    6163     private:
    6264       
  • trunk/Source/JavaScriptCore/runtime/JSObject.cpp

    r96446 r96831  
    4949
    5050const ClassInfo JSObject::s_info = { "Object", 0, 0, 0, CREATE_METHOD_TABLE(JSObject) };
     51
     52const ClassInfo JSFinalObject::s_info = { "Object", &Base::s_info, 0, 0, CREATE_METHOD_TABLE(JSFinalObject) };
    5153
    5254static inline void getClassPropertyNames(ExecState* exec, const ClassInfo* classInfo, PropertyNameArray& propertyNames, EnumerationMode mode)
  • trunk/Source/JavaScriptCore/runtime/JSObject.h

    r96755 r96831  
    366366        }
    367367
     368        static const ClassInfo s_info;
     369
    368370    protected:
    369371        void finishCreation(JSGlobalData& globalData)
  • trunk/Source/JavaScriptCore/runtime/JSStaticScopeObject.cpp

    r96446 r96831  
    3232namespace JSC {
    3333ASSERT_CLASS_FITS_IN_CELL(JSStaticScopeObject);
     34
     35const ClassInfo JSStaticScopeObject::s_info = { "Object", &Base::s_info, 0, 0, CREATE_METHOD_TABLE(JSStaticScopeObject) };
    3436
    3537void JSStaticScopeObject::visitChildren(JSCell* cell, SlotVisitor& visitor)
  • trunk/Source/JavaScriptCore/runtime/JSStaticScopeObject.h

    r96446 r96831  
    5151        static Structure* createStructure(JSGlobalData& globalData, JSGlobalObject* globalObject, JSValue proto) { return Structure::create(globalData, globalObject, proto, TypeInfo(ObjectType, StructureFlags), &s_info); }
    5252
     53        static const ClassInfo s_info;
     54
    5355    protected:
    5456        void finishCreation(ExecState* exec, const Identifier& identifier, JSValue value, unsigned attributes)
  • trunk/Source/JavaScriptCore/runtime/StrictEvalActivation.cpp

    r96446 r96831  
    2929namespace JSC {
    3030
     31const ClassInfo StrictEvalActivation::s_info = { "Object", &Base::s_info, 0, 0, CREATE_METHOD_TABLE(StrictEvalActivation) };
     32
    3133StrictEvalActivation::StrictEvalActivation(ExecState* exec)
    3234    : JSNonFinalObject(exec->globalData(), exec->globalData().strictEvalActivationStructure.get())
  • trunk/Source/JavaScriptCore/runtime/StrictEvalActivation.h

    r96446 r96831  
    5050    }
    5151   
     52    static const ClassInfo s_info;
     53
    5254protected:
    5355    static const unsigned StructureFlags = IsEnvironmentRecord | JSNonFinalObject::StructureFlags;
Note: See TracChangeset for help on using the changeset viewer.