Changeset 78174 in webkit for trunk/Source/JavaScriptCore/jit


Ignore:
Timestamp:
Feb 9, 2011, 9:21:33 PM (14 years ago)
Author:
[email protected]
Message:

Bug 54164 - Optimize global_var accesses on JSVALUE64

Reviewed by Sam Weinig.

Directly embed the pointer to d->registers, optimize out the load
from the variable object, as we do already in JSVALUE32_64.

This is a ~1.5% win on sunspidey.

  • jit/JIT.cpp:
  • jit/JIT.h:
  • jit/JITOpcodes.cpp:

(JSC::JIT::emit_op_get_global_var):
(JSC::JIT::emit_op_put_global_var):
(JSC::JIT::emit_op_get_scoped_var):
(JSC::JIT::emit_op_put_scoped_var):

Location:
trunk/Source/JavaScriptCore/jit
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/jit/JIT.cpp

    r76369 r78174  
    588588}
    589589
    590 #if USE(JSVALUE64)
    591 void JIT::emitGetVariableObjectRegister(RegisterID variableObject, int index, RegisterID dst)
    592 {
    593     loadPtr(Address(variableObject, OBJECT_OFFSETOF(JSVariableObject, d)), dst);
    594     loadPtr(Address(dst, OBJECT_OFFSETOF(JSVariableObject::JSVariableObjectData, registers)), dst);
    595     loadPtr(Address(dst, index * sizeof(Register)), dst);
    596 }
    597 
    598 void JIT::emitPutVariableObjectRegister(RegisterID src, RegisterID variableObject, int index)
    599 {
    600     loadPtr(Address(variableObject, OBJECT_OFFSETOF(JSVariableObject, d)), variableObject);
    601     loadPtr(Address(variableObject, OBJECT_OFFSETOF(JSVariableObject::JSVariableObjectData, registers)), variableObject);
    602     storePtr(src, Address(variableObject, index * sizeof(Register)));
    603 }
    604 #endif
    605 
    606590#if ENABLE(JIT_OPTIMIZE_CALL)
    607591void JIT::unlinkCallOrConstruct(CallLinkInfo* callLinkInfo)
  • trunk/Source/JavaScriptCore/jit/JIT.h

    r75408 r78174  
    506506        int32_t getConstantOperandImmediateInt(unsigned src);
    507507
    508         void emitGetVariableObjectRegister(RegisterID variableObject, int index, RegisterID dst);
    509         void emitPutVariableObjectRegister(RegisterID src, RegisterID variableObject, int index);
    510        
    511508        void killLastResultRegister();
    512509
  • trunk/Source/JavaScriptCore/jit/JITOpcodes.cpp

    r75408 r78174  
    456456{
    457457    JSVariableObject* globalObject = m_codeBlock->globalObject();
    458     move(ImmPtr(globalObject), regT0);
    459     emitGetVariableObjectRegister(regT0, currentInstruction[2].u.operand, regT0);
     458    loadPtr(&globalObject->d->registers, regT0);
     459    loadPtr(Address(regT0, currentInstruction[2].u.operand * sizeof(Register)), regT0);
    460460    emitPutVirtualRegister(currentInstruction[1].u.operand);
    461461}
     
    465465    emitGetVirtualRegister(currentInstruction[2].u.operand, regT1);
    466466    JSVariableObject* globalObject = m_codeBlock->globalObject();
    467     move(ImmPtr(globalObject), regT0);
    468     emitPutVariableObjectRegister(regT1, regT0, currentInstruction[1].u.operand);
     467    loadPtr(&globalObject->d->registers, regT0);
     468    storePtr(regT1, Address(regT0, currentInstruction[1].u.operand * sizeof(Register)));
    469469}
    470470
     
    487487
    488488    loadPtr(Address(regT0, OBJECT_OFFSETOF(ScopeChainNode, object)), regT0);
    489     emitGetVariableObjectRegister(regT0, currentInstruction[2].u.operand, regT0);
     489    loadPtr(Address(regT0, OBJECT_OFFSETOF(JSVariableObject, d)), regT0);
     490    loadPtr(Address(regT0, OBJECT_OFFSETOF(JSVariableObject::JSVariableObjectData, registers)), regT0);
     491    loadPtr(Address(regT0, currentInstruction[2].u.operand * sizeof(Register)), regT0);
    490492    emitPutVirtualRegister(currentInstruction[1].u.operand);
    491493}
     
    510512
    511513    loadPtr(Address(regT1, OBJECT_OFFSETOF(ScopeChainNode, object)), regT1);
    512     emitPutVariableObjectRegister(regT0, regT1, currentInstruction[1].u.operand);
     514    loadPtr(Address(regT1, OBJECT_OFFSETOF(JSVariableObject, d)), regT1);
     515    loadPtr(Address(regT1, OBJECT_OFFSETOF(JSVariableObject::JSVariableObjectData, registers)), regT1);
     516    storePtr(regT0, Address(regT1, currentInstruction[1].u.operand * sizeof(Register)));
    513517}
    514518
Note: See TracChangeset for help on using the changeset viewer.