Ignore:
Timestamp:
Jun 11, 2017, 10:02:25 AM (8 years ago)
Author:
Yusuke Suzuki
Message:

[JSC] Shrink Structure size
https://bugs.webkit.org/show_bug.cgi?id=173239

Reviewed by Mark Lam.

We find that the size of our Structure is slightly enlarged due to paddings.
By changing the order of members, we can reduce the size from 120 to 112.
This is good because 120 and 112 are categorized into different size classes.
For 120, we allocate 128 bytes. And for 112, we allocate 112 bytes.
We now save 16 bytes per Structure for free.

  • runtime/ConcurrentJSLock.h:
  • runtime/Structure.cpp:

(JSC::Structure::Structure):

  • runtime/Structure.h:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/runtime/Structure.cpp

    r217108 r218070  
    182182    , m_blob(vm.heap.structureIDTable().allocateID(this), indexingType, typeInfo)
    183183    , m_outOfLineTypeFlags(typeInfo.outOfLineTypeFlags())
     184    , m_inlineCapacity(inlineCapacity)
     185    , m_bitField(0)
    184186    , m_globalObject(vm, this, globalObject, WriteBarrier<JSGlobalObject>::MayBeNull)
    185187    , m_prototype(vm, this, prototype)
     
    187189    , m_transitionWatchpointSet(IsWatched)
    188190    , m_offset(invalidOffset)
    189     , m_inlineCapacity(inlineCapacity)
    190     , m_bitField(0)
    191191{
    192192    setDictionaryKind(NoneDictionaryKind);
     
    215215Structure::Structure(VM& vm)
    216216    : JSCell(CreatingEarlyCell)
     217    , m_inlineCapacity(0)
     218    , m_bitField(0)
    217219    , m_prototype(vm, this, jsNull())
    218220    , m_classInfo(info())
    219221    , m_transitionWatchpointSet(IsWatched)
    220222    , m_offset(invalidOffset)
    221     , m_inlineCapacity(0)
    222     , m_bitField(0)
    223223{
    224224    setDictionaryKind(NoneDictionaryKind);
     
    246246Structure::Structure(VM& vm, Structure* previous, DeferredStructureTransitionWatchpointFire* deferred)
    247247    : JSCell(vm, vm.structureStructure.get())
     248    , m_inlineCapacity(previous->m_inlineCapacity)
     249    , m_bitField(0)
    248250    , m_prototype(vm, this, previous->storedPrototype())
    249251    , m_classInfo(previous->m_classInfo)
    250252    , m_transitionWatchpointSet(IsWatched)
    251253    , m_offset(invalidOffset)
    252     , m_inlineCapacity(previous->m_inlineCapacity)
    253     , m_bitField(0)
    254254{
    255255    setDictionaryKind(previous->dictionaryKind());
Note: See TracChangeset for help on using the changeset viewer.