Changeset 233253 in webkit


Ignore:
Timestamp:
Jun 27, 2018 4:19:46 AM (6 years ago)
Author:
mark.lam@apple.com
Message:

DFG's compileReallocatePropertyStorage() and compileAllocatePropertyStorage() slow paths should also clear unused properties.
https://bugs.webkit.org/show_bug.cgi?id=187091
<rdar://problem/41395624>

Reviewed by Yusuke Suzuki.

JSTests:

  • stress/regress-187091.js: Added.

Source/JavaScriptCore:

Previously, when compileReallocatePropertyStorage() and compileAllocatePropertyStorage()
take their slow paths, the slow path would jump back to the fast path right after
the emitted code which clears the unused property values. As a result, the
unused properties are not initialized. We've fixed this by adding the slow path
generators before we emit the code to clear the unused properties.

  • dfg/DFGSpeculativeJIT.cpp:

(JSC::DFG::SpeculativeJIT::compileAllocatePropertyStorage):
(JSC::DFG::SpeculativeJIT::compileReallocatePropertyStorage):

Location:
trunk
Files:
1 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/JSTests/ChangeLog

    r233252 r233253  
     12018-06-27  Mark Lam  <mark.lam@apple.com>
     2
     3        DFG's compileReallocatePropertyStorage() and compileAllocatePropertyStorage() slow paths should also clear unused properties.
     4        https://bugs.webkit.org/show_bug.cgi?id=187091
     5        <rdar://problem/41395624>
     6
     7        Reviewed by Yusuke Suzuki.
     8
     9        * stress/regress-187091.js: Added.
     10
    1112018-06-27  Yusuke Suzuki  <utatane.tea@gmail.com>
    212
  • trunk/Source/JavaScriptCore/ChangeLog

    r233252 r233253  
     12018-06-27  Mark Lam  <mark.lam@apple.com>
     2
     3        DFG's compileReallocatePropertyStorage() and compileAllocatePropertyStorage() slow paths should also clear unused properties.
     4        https://bugs.webkit.org/show_bug.cgi?id=187091
     5        <rdar://problem/41395624>
     6
     7        Reviewed by Yusuke Suzuki.
     8
     9        Previously, when compileReallocatePropertyStorage() and compileAllocatePropertyStorage()
     10        take their slow paths, the slow path would jump back to the fast path right after
     11        the emitted code which clears the unused property values.  As a result, the
     12        unused properties are not initialized.  We've fixed this by adding the slow path
     13        generators before we emit the code to clear the unused properties.
     14
     15        * dfg/DFGSpeculativeJIT.cpp:
     16        (JSC::DFG::SpeculativeJIT::compileAllocatePropertyStorage):
     17        (JSC::DFG::SpeculativeJIT::compileReallocatePropertyStorage):
     18
    1192018-06-27  Yusuke Suzuki  <utatane.tea@gmail.com>
    220
  • trunk/Source/JavaScriptCore/dfg/DFGSpeculativeJIT.cpp

    r232461 r233253  
    89378937    m_jit.emitAllocate(scratchGPR1, JITAllocator::constant(allocator), scratchGPR2, scratchGPR3, slowPath);
    89388938    m_jit.addPtr(JITCompiler::TrustedImm32(size + sizeof(IndexingHeader)), scratchGPR1);
    8939    
     8939
     8940    addSlowPathGenerator(
     8941        slowPathCall(slowPath, this, operationAllocateSimplePropertyStorageWithInitialCapacity, scratchGPR1));
     8942
    89408943    for (ptrdiff_t offset = 0; offset < static_cast<ptrdiff_t>(size); offset += sizeof(void*))
    89418944        m_jit.storePtr(TrustedImmPtr(nullptr), JITCompiler::Address(scratchGPR1, -(offset + sizeof(JSValue) + sizeof(void*))));
    8942        
    8943     addSlowPathGenerator(
    8944         slowPathCall(slowPath, this, operationAllocateSimplePropertyStorageWithInitialCapacity, scratchGPR1));
    89458945
    89468946    storageResult(scratchGPR1, node);
     
    89748974    GPRTemporary scratch2(this);
    89758975    GPRTemporary scratch3(this);
    8976        
     8976
    89778977    GPRReg oldStorageGPR = oldStorage.gpr();
    89788978    GPRReg scratchGPR1 = scratch1.gpr();
     
    89848984   
    89858985    m_jit.addPtr(JITCompiler::TrustedImm32(newSize + sizeof(IndexingHeader)), scratchGPR1);
    8986        
     8986
     8987    addSlowPathGenerator(
     8988        slowPathCall(slowPath, this, operationAllocateSimplePropertyStorage, scratchGPR1, newSize / sizeof(JSValue)));
     8989
    89878990    for (ptrdiff_t offset = oldSize; offset < static_cast<ptrdiff_t>(newSize); offset += sizeof(void*))
    89888991        m_jit.storePtr(TrustedImmPtr(nullptr), JITCompiler::Address(scratchGPR1, -(offset + sizeof(JSValue) + sizeof(void*))));
    8989 
    8990     addSlowPathGenerator(
    8991         slowPathCall(slowPath, this, operationAllocateSimplePropertyStorage, scratchGPR1, newSize / sizeof(JSValue)));
    89928992
    89938993    // We have scratchGPR1 = new storage, scratchGPR2 = scratch
     
    89968996        m_jit.storePtr(scratchGPR2, JITCompiler::Address(scratchGPR1, -(offset + sizeof(JSValue) + sizeof(void*))));
    89978997    }
    8998        
     8998
    89998999    storageResult(scratchGPR1, node);
    90009000}
Note: See TracChangeset for help on using the changeset viewer.