Changeset 36285 in webkit for trunk/JavaScriptCore/VM/CTI.cpp


Ignore:
Timestamp:
Sep 8, 2008, 11:55:39 PM (17 years ago)
Author:
[email protected]
Message:

JavaScriptCore:

2008-09-08 Sam Weinig <[email protected]>

Reviewed by Maciej Stachowiak and Oliver Hunt.

Split storage of properties out of the PropertyMap and into the JSObject
to allow sharing PropertyMap on the StructureID. In order to get this
function correctly, the StructureID's transition mappings were changed to
transition based on property name and attribute pairs, instead of just
property name.

  • Removes the single property optimization now that the PropertyMap is shared. This will be replaced by in-lining some values on the JSObject.

This is a wash on Sunspider and a 6.7% win on the v8 test suite.

  • JavaScriptCore.base.exp:
  • VM/CTI.cpp: (JSC::CTI::privateCompileGetByIdSelf): Get the storage directly off the JSObject. (JSC::CTI::privateCompileGetByIdProto): Ditto. (JSC::CTI::privateCompileGetByIdChain): Ditto. (JSC::CTI::privateCompilePutByIdReplace): Ditto.
  • kjs/JSObject.cpp: (JSC::JSObject::mark): Mark the PropertyStorage. (JSC::JSObject::put): Update to get the propertyMap of the StructureID. (JSC::JSObject::deleteProperty): Ditto. (JSC::JSObject::defineGetter): Return early if the property is already a getter/setter. (JSC::JSObject::defineSetter): Ditto. (JSC::JSObject::getPropertyAttributes): Update to get the propertyMap of the StructureID (JSC::JSObject::getPropertyNames): Ditto. (JSC::JSObject::removeDirect): Ditto.
  • kjs/JSObject.h: Remove PropertyMap and add PropertyStorage. (JSC::JSObject::propertyStorage): return the PropertyStorage. (JSC::JSObject::getDirect): Update to get the propertyMap of the StructureID. (JSC::JSObject::getDirectLocation): Ditto. (JSC::JSObject::offsetForLocation): Compute location directly. (JSC::JSObject::hasCustomProperties): Update to get the propertyMap of the StructureID. (JSC::JSObject::hasGetterSetterProperties): Ditto. (JSC::JSObject::getDirectOffset): Get by indexing into PropertyStorage. (JSC::JSObject::putDirectOffset): Put by indexing into PropertyStorage. (JSC::JSObject::getOwnPropertySlotForWrite): Update to get the propertyMap of the StructureID. (JSC::JSObject::getOwnPropertySlot): Ditto. (JSC::JSObject::putDirect): Move putting into the StructureID unless the property already exists.
  • kjs/PropertyMap.cpp: Use the propertyStorage as the storage for the JSValues. (JSC::PropertyMap::checkConsistency): (JSC::PropertyMap::operator=): (JSC::PropertyMap::~PropertyMap): (JSC::PropertyMap::get): (JSC::PropertyMap::getLocation): (JSC::PropertyMap::put): (JSC::PropertyMap::getOffset): (JSC::PropertyMap::insert): (JSC::PropertyMap::expand): (JSC::PropertyMap::rehash): (JSC::PropertyMap::createTable): (JSC::PropertyMap::resizePropertyStorage): Resize the storage to match the size of the map (JSC::PropertyMap::remove): (JSC::PropertyMap::getEnumerablePropertyNames):
  • kjs/PropertyMap.h: (JSC::PropertyMapEntry::PropertyMapEntry): (JSC::PropertyMap::isEmpty): (JSC::PropertyMap::size): (JSC::PropertyMap::makingCount): (JSC::PropertyMap::PropertyMap):
  • kjs/StructureID.cpp: (JSC::StructureID::addPropertyTransition): Transitions now are based off the property name and attributes. (JSC::StructureID::toDictionaryTransition): Copy the map. (JSC::StructureID::changePrototypeTransition): Copy the map. (JSC::StructureID::getterSetterTransition): Copy the map. (JSC::StructureID::~StructureID):
  • kjs/StructureID.h: (JSC::TransitionTableHash::hash): Custom hash for transition map. (JSC::TransitionTableHash::equal): Ditto. (JSC::TransitionTableHashTraits::emptyValue): Custom traits for transition map (JSC::TransitionTableHashTraits::constructDeletedValue): Ditto. (JSC::TransitionTableHashTraits::isDeletedValue): Ditto. (JSC::StructureID::propertyMap): Added.

JavaScriptGlue:

2008-09-08 Sam Weinig <[email protected]>

Reviewed by Maciej Stachowiak and Oliver Hunt.

Add forwarding headers.

  • ForwardingHeaders/wtf/HashFunctions.h: Added.
  • ForwardingHeaders/wtf/HashTraits.h: Added.

WebCore:

2008-09-08 Sam Weinig <[email protected]>

Reviewed by Maciej Stachowiak and Oliver Hunt.

Add forwarding headers.

  • ForwardingHeaders/wtf/HashFunctions.h: Added.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/VM/CTI.cpp

    r36282 r36285  
    16581658
    16591659    // Checks out okay! - getDirectOffset
    1660     m_jit.emitMovl_mr(OBJECT_OFFSET(JSObject, m_propertyMap) + OBJECT_OFFSET(PropertyMap, m_u.table), MacroAssembler::eax, MacroAssembler::eax);
    1661     m_jit.emitMovl_mr(OBJECT_OFFSET(PropertyMapHashTable, entryIndices[0]) + (cachedOffset * sizeof(JSValue*)), MacroAssembler::eax, MacroAssembler::eax);
     1660    m_jit.emitMovl_mr(OBJECT_OFFSET(JSObject, m_propertyStorage), MacroAssembler::eax, MacroAssembler::eax);
     1661    m_jit.emitMovl_mr(cachedOffset * sizeof(JSValue*), MacroAssembler::eax, MacroAssembler::eax);
    16621662    m_jit.emitRet();
    16631663
     
    16781678    // referencing the prototype object - let's speculatively load it's table nice and early!)
    16791679    JSObject* protoObject = static_cast<JSObject*>(structureID->prototype());
    1680     PropertyMapHashTable** protoTableAddress = &(protoObject->m_propertyMap.m_u.table);
    1681     m_jit.emitMovl_mr(static_cast<void*>(protoTableAddress), MacroAssembler::edx);
     1680    OwnArrayPtr<JSValue*>* protoPropertyStorage = &protoObject->m_propertyStorage;
     1681    m_jit.emitMovl_mr(static_cast<void*>(protoPropertyStorage), MacroAssembler::edx);
    16821682
    16831683    // check eax is an object of the right StructureID.
     
    16931693
    16941694    // Checks out okay! - getDirectOffset
    1695 
    1696     m_jit.emitMovl_mr(OBJECT_OFFSET(PropertyMapHashTable, entryIndices[0]) + (cachedOffset * sizeof(JSValue*)), MacroAssembler::edx, MacroAssembler::eax);
     1695    m_jit.emitMovl_mr(cachedOffset * sizeof(JSValue*), MacroAssembler::edx, MacroAssembler::eax);
    16971696
    16981697    m_jit.emitRet();
     
    17361735    ASSERT(protoObject);
    17371736 
    1738     PropertyMapHashTable** protoTableAddress = &(reinterpret_cast<JSObject*>(protoObject)->m_propertyMap.m_u.table);
    1739     m_jit.emitMovl_mr(static_cast<void*>(protoTableAddress), MacroAssembler::edx);
    1740     m_jit.emitMovl_mr(OBJECT_OFFSET(PropertyMapHashTable, entryIndices[0]) + (cachedOffset * sizeof(JSValue*)), MacroAssembler::edx, MacroAssembler::eax);
     1737    OwnArrayPtr<JSValue*>* protoPropertyStorage = &static_cast<JSObject*>(protoObject)->m_propertyStorage;
     1738    m_jit.emitMovl_mr(static_cast<void*>(protoPropertyStorage), MacroAssembler::edx);
     1739    m_jit.emitMovl_mr(cachedOffset * sizeof(JSValue*), MacroAssembler::edx, MacroAssembler::eax);
    17411740    m_jit.emitRet();
    17421741
     
    17611760
    17621761    // checks out okay! - putDirectOffset
    1763     m_jit.emitMovl_mr(OBJECT_OFFSET(JSObject, m_propertyMap) + OBJECT_OFFSET(PropertyMap, m_u.table), MacroAssembler::eax, MacroAssembler::eax);
    1764     m_jit.emitMovl_rm(MacroAssembler::edx, OBJECT_OFFSET(PropertyMapHashTable, entryIndices[0]) + (cachedOffset * sizeof(JSValue*)), MacroAssembler::eax);
     1762    m_jit.emitMovl_mr(OBJECT_OFFSET(JSObject, m_propertyStorage), MacroAssembler::eax, MacroAssembler::eax);
     1763    m_jit.emitMovl_rm(MacroAssembler::edx, cachedOffset * sizeof(JSValue*), MacroAssembler::eax);
    17651764    m_jit.emitRet();
    17661765
Note: See TracChangeset for help on using the changeset viewer.