Ignore:
Timestamp:
Jul 25, 2012, 5:12:58 PM (13 years ago)
Author:
[email protected]
Message:

Remove JSObject::m_inheritorID
https://bugs.webkit.org/show_bug.cgi?id=88378

Reviewed by Filip Pizlo.

This is rarely used, and not performance critical (the commonly accessed copy is cached on JSFunction),
and most objects don't need an inheritorID (this value is only used if the object is used as a prototype).
Instead use a private named value in the object's property storage.

  • dfg/DFGSpeculativeJIT.h:

(JSC::DFG::SpeculativeJIT::emitAllocateBasicJSObject): No need m_inheritorID to initialize!

  • jit/JITInlineMethods.h:

(JSC::JIT::emitAllocateBasicJSObject): No need m_inheritorID to initialize!

  • llint/LowLevelInterpreter.asm: No need m_inheritorID to initialize!
  • runtime/JSGlobalData.h:

(JSGlobalData): Added private name 'm_inheritorIDKey'.

  • runtime/JSGlobalThis.cpp:

(JSC::JSGlobalThis::setUnwrappedObject): resetInheritorID is now passed a JSGlobalData&.

  • runtime/JSObject.cpp:

(JSC::JSObject::visitChildren): No m_inheritorID to be marked.
(JSC::JSFinalObject::visitChildren): No m_inheritorID to be marked.
(JSC::JSObject::createInheritorID): Store the newly created inheritorID in the property map. Make sure
it's got the DontEnum attribute!!

  • runtime/JSObject.h:

(JSObject):
(JSC::JSObject::resetInheritorID): Remove the inheritorID from property storage.
(JSC):
(JSC::JSObject::inheritorID): Read the inheritorID from property storage.

File:
1 edited

Legend:

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

    r123417 r123682  
    108108    }
    109109
    110     if (thisObject->m_inheritorID)
    111         visitor.append(&thisObject->m_inheritorID);
    112 
    113110#if !ASSERT_DISABLED
    114111    visitor.m_isCheckingForDefaultMarkViolation = wasCheckingForDefaultMarkViolation;
     
    137134        thisObject->m_outOfLineStorage.set(storage, StorageBarrier::Unchecked);
    138135    }
    139 
    140     if (thisObject->m_inheritorID)
    141         visitor.append(&thisObject->m_inheritorID);
    142136
    143137    size_t storageSize = thisObject->structure()->inlineSizeForKnownFinalObject();
     
    581575Structure* JSObject::createInheritorID(JSGlobalData& globalData)
    582576{
     577    ASSERT(!getDirectLocation(globalData, globalData.m_inheritorIDKey));
     578
    583579    JSGlobalObject* globalObject;
    584580    if (isGlobalThis())
     
    587583        globalObject = structure()->globalObject();
    588584    ASSERT(globalObject);
    589     m_inheritorID.set(globalData, this, createEmptyObjectStructure(globalData, globalObject, this));
    590     ASSERT(m_inheritorID->isEmpty());
    591     return m_inheritorID.get();
     585
     586    Structure* inheritorID = createEmptyObjectStructure(globalData, globalObject, this);
     587    ASSERT(inheritorID->isEmpty());
     588
     589    PutPropertySlot slot;
     590    putDirectInternal<PutModeDefineOwnProperty>(globalData, globalData.m_inheritorIDKey, inheritorID, DontEnum, slot, 0);
     591    return inheritorID;
    592592}
    593593
Note: See TracChangeset for help on using the changeset viewer.