Changeset 92085 in webkit


Ignore:
Timestamp:
Jul 31, 2011, 1:13:37 PM (14 years ago)
Author:
fpizlo@apple.com
Message:

DFG non-speculative JIT does not optimize PutByVal
https://bugs.webkit.org/show_bug.cgi?id=65424

Reviewed by Gavin Barraclough.

Added code to emit PutByVal inline fast path.

  • dfg/DFGNonSpeculativeJIT.cpp:

(JSC::DFG::NonSpeculativeJIT::compile):

Location:
trunk/Source/JavaScriptCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/ChangeLog

    r92084 r92085  
     12011-07-31  Filip Pizlo  <fpizlo@apple.com>
     2
     3        DFG non-speculative JIT does not optimize PutByVal
     4        https://bugs.webkit.org/show_bug.cgi?id=65424
     5
     6        Reviewed by Gavin Barraclough.
     7       
     8        Added code to emit PutByVal inline fast path.
     9
     10        * dfg/DFGNonSpeculativeJIT.cpp:
     11        (JSC::DFG::NonSpeculativeJIT::compile):
     12
    1132011-07-31  Filip Pizlo  <fpizlo@apple.com>
    214
  • trunk/Source/JavaScriptCore/dfg/DFGNonSpeculativeJIT.cpp

    r91804 r92085  
    820820    case PutByVal:
    821821    case PutByValAlias: {
    822         JSValueOperand arg1(this, node.child1());
    823         JSValueOperand arg2(this, node.child2());
    824         JSValueOperand arg3(this, node.child3());
    825         GPRReg arg1GPR = arg1.gpr();
    826         GPRReg arg2GPR = arg2.gpr();
    827         GPRReg arg3GPR = arg3.gpr();
    828        
    829         arg1.use();
    830         arg2.use();
    831         arg3.use();
    832         flushRegisters();
    833 
    834         callOperation(m_jit.codeBlock()->isStrictMode() ? operationPutByValStrict : operationPutByValNonStrict, arg1GPR, arg2GPR, arg3GPR);
     822        JSValueOperand base(this, node.child1());
     823        JSValueOperand property(this, node.child2());
     824        JSValueOperand value(this, node.child3());
     825        GPRTemporary storage(this);
     826        GPRTemporary cleanIndex(this);
     827        GPRReg baseGPR = base.gpr();
     828        GPRReg propertyGPR = property.gpr();
     829        GPRReg valueGPR = value.gpr();
     830        GPRReg storageGPR = storage.gpr();
     831        GPRReg cleanIndexGPR = cleanIndex.gpr();
     832       
     833        base.use();
     834        property.use();
     835        value.use();
     836       
     837        writeBarrier(m_jit, baseGPR, storageGPR);
     838       
     839        JITCompiler::Jump baseNotCell = m_jit.branchTestPtr(MacroAssembler::NonZero, baseGPR, GPRInfo::tagMaskRegister);
     840
     841        JITCompiler::Jump propertyNotInt = m_jit.branchPtr(MacroAssembler::Below, propertyGPR, GPRInfo::tagTypeNumberRegister);
     842
     843        m_jit.loadPtr(MacroAssembler::Address(baseGPR, JSArray::storageOffset()), storageGPR);
     844
     845        JITCompiler::Jump baseNotArray = m_jit.branchPtr(MacroAssembler::NotEqual, MacroAssembler::Address(baseGPR), MacroAssembler::TrustedImmPtr(m_jit.globalData()->jsArrayVPtr));
     846
     847        m_jit.zeroExtend32ToPtr(propertyGPR, cleanIndexGPR);
     848
     849        JITCompiler::Jump outOfBounds = m_jit.branch32(MacroAssembler::AboveOrEqual, cleanIndexGPR, MacroAssembler::Address(baseGPR, JSArray::vectorLengthOffset()));
     850       
     851        JITCompiler::Jump notHoleValue = m_jit.branchTestPtr(MacroAssembler::NonZero, MacroAssembler::BaseIndex(storageGPR, cleanIndexGPR, MacroAssembler::ScalePtr, OBJECT_OFFSETOF(ArrayStorage, m_vector[0])));
     852       
     853        JITCompiler::Jump lengthDoesNotNeedUpdate = m_jit.branch32(MacroAssembler::Below, cleanIndexGPR, MacroAssembler::Address(storageGPR, OBJECT_OFFSETOF(ArrayStorage, m_length)));
     854       
     855        m_jit.add32(TrustedImm32(1), cleanIndexGPR);
     856        m_jit.store32(cleanIndexGPR, MacroAssembler::Address(storageGPR, OBJECT_OFFSETOF(ArrayStorage, m_length)));
     857        m_jit.zeroExtend32ToPtr(propertyGPR, cleanIndexGPR);
     858       
     859        lengthDoesNotNeedUpdate.link(&m_jit);
     860        notHoleValue.link(&m_jit);
     861       
     862        m_jit.storePtr(valueGPR, MacroAssembler::BaseIndex(storageGPR, cleanIndexGPR, MacroAssembler::ScalePtr, OBJECT_OFFSETOF(ArrayStorage, m_vector[0])));
     863       
     864        JITCompiler::Jump done = m_jit.jump();
     865       
     866        baseNotCell.link(&m_jit);
     867        propertyNotInt.link(&m_jit);
     868        baseNotArray.link(&m_jit);
     869        outOfBounds.link(&m_jit);
     870       
     871        silentSpillAllRegisters(InvalidGPRReg);
     872        setupStubArguments(baseGPR, propertyGPR, valueGPR);
     873        m_jit.move(GPRInfo::callFrameRegister, GPRInfo::argumentGPR0);
     874        JITCompiler::Call functionCall = appendCallWithExceptionCheck(m_jit.codeBlock()->isStrictMode() ? operationPutByValStrict : operationPutByValNonStrict);
     875        silentFillAllRegisters(InvalidGPRReg);
     876       
     877        done.link(&m_jit);
    835878
    836879        noResult(m_compileIndex, UseChildrenCalledExplicitly);
Note: See TracChangeset for help on using the changeset viewer.