Ignore:
Timestamp:
Nov 7, 2017, 10:29:31 PM (8 years ago)
Author:
[email protected]
Message:

Only cage double butterfly accesses
https://bugs.webkit.org/show_bug.cgi?id=179202

Reviewed by Mark Lam.

This patch removes caging from all butterfly accesses except double loads/stores.
This is a performance vs security tradeoff. Double loads/stores are the only butterfly
loads/stores that can write arbitrary bit patterns, so we choose to keep them safe
by caging. The other load/stores we are no longer caging to get back performance on
various benchmarks.

  • bytecode/AccessCase.cpp:

(JSC::AccessCase::generateImpl):

  • bytecode/InlineAccess.cpp:

(JSC::InlineAccess::dumpCacheSizesAndCrash):
(JSC::InlineAccess::generateSelfPropertyAccess):
(JSC::InlineAccess::generateSelfPropertyReplace):
(JSC::InlineAccess::generateArrayLength):

  • dfg/DFGFixedButterflyAccessUncagingPhase.cpp:
  • dfg/DFGSpeculativeJIT.cpp:

(JSC::DFG::SpeculativeJIT::compileCreateRest):
(JSC::DFG::SpeculativeJIT::compileSpread):
(JSC::DFG::SpeculativeJIT::compileNewArrayWithSpread):

  • dfg/DFGSpeculativeJIT64.cpp:

(JSC::DFG::SpeculativeJIT::compile):

  • ftl/FTLLowerDFGToB3.cpp:

(JSC::FTL::DFG::LowerDFGToB3::compileGetDirectPname):

  • jit/JITPropertyAccess.cpp:

(JSC::JIT::emitContiguousLoad):
(JSC::JIT::emitArrayStorageLoad):
(JSC::JIT::emitGenericContiguousPutByVal):
(JSC::JIT::emitArrayStoragePutByVal):
(JSC::JIT::emit_op_get_from_scope):
(JSC::JIT::emit_op_put_to_scope):

  • llint/LowLevelInterpreter64.asm:
  • runtime/AuxiliaryBarrier.h:

(JSC::AuxiliaryBarrier::operator-> const):

  • runtime/Butterfly.h:

(JSC::Butterfly::caged):
(JSC::Butterfly::contiguousDouble):

  • runtime/JSArray.cpp:

(JSC::JSArray::setLength):
(JSC::JSArray::pop):
(JSC::JSArray::shiftCountWithAnyIndexingType):
(JSC::JSArray::unshiftCountWithAnyIndexingType):
(JSC::JSArray::fillArgList):
(JSC::JSArray::copyToArguments):

  • runtime/JSArrayInlines.h:

(JSC::JSArray::pushInline):

  • runtime/JSObject.cpp:

(JSC::JSObject::heapSnapshot):
(JSC::JSObject::createInitialIndexedStorage):
(JSC::JSObject::createArrayStorage):
(JSC::JSObject::convertUndecidedToInt32):
(JSC::JSObject::ensureLengthSlow):
(JSC::JSObject::reallocateAndShrinkButterfly):
(JSC::JSObject::allocateMoreOutOfLineStorage):

  • runtime/JSObject.h:

(JSC::JSObject::canGetIndexQuickly):
(JSC::JSObject::getIndexQuickly):
(JSC::JSObject::tryGetIndexQuickly const):
(JSC::JSObject::canSetIndexQuickly):
(JSC::JSObject::butterfly const):
(JSC::JSObject::butterfly):

File:
1 edited

Legend:

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

    r223746 r224564  
    256256    bool canGetIndexQuickly(unsigned i)
    257257    {
    258         Butterfly* butterfly = m_butterfly.getMayBeNull();
     258        Butterfly* butterfly = this->butterfly();
    259259        switch (indexingType()) {
    260260        case ALL_BLANK_INDEXING_TYPES:
     
    282282    JSValue getIndexQuickly(unsigned i)
    283283    {
    284         Butterfly* butterfly = m_butterfly.get();
     284        Butterfly* butterfly = this->butterfly();
    285285        switch (indexingType()) {
    286286        case ALL_INT32_INDEXING_TYPES:
     
    300300    JSValue tryGetIndexQuickly(unsigned i) const
    301301    {
    302         Butterfly* butterfly = m_butterfly.getMayBeNull();
     302        Butterfly* butterfly = const_cast<JSObject*>(this)->butterfly();
    303303        switch (indexingType()) {
    304304        case ALL_BLANK_INDEXING_TYPES:
     
    354354    bool canSetIndexQuickly(unsigned i)
    355355    {
    356         Butterfly* butterfly = m_butterfly.getMayBeNull();
     356        Butterfly* butterfly = this->butterfly();
    357357        switch (indexingType()) {
    358358        case ALL_BLANK_INDEXING_TYPES:
     
    670670    }
    671671       
    672     const Butterfly* butterfly() const { return m_butterfly.getMayBeNull(); }
    673     Butterfly* butterfly() { return m_butterfly.getMayBeNull(); }
     672    const Butterfly* butterfly() const { return m_butterfly.get(); }
     673    Butterfly* butterfly() { return m_butterfly.get(); }
    674674   
    675675    ConstPropertyStorage outOfLineStorage() const { return m_butterfly->propertyStorage(); }
     
    10531053
    10541054protected:
    1055     CagedBarrierPtr<Gigacage::JSValue, Butterfly> m_butterfly;
     1055    AuxiliaryBarrier<Butterfly*> m_butterfly;
    10561056#if USE(JSVALUE32_64)
    10571057private:
Note: See TracChangeset for help on using the changeset viewer.