Changeset 43531 in webkit for trunk/JavaScriptCore/jit/JITPropertyAccess.cpp
- Timestamp:
- May 11, 2009, 6:06:58 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/jit/JITPropertyAccess.cpp
r43516 r43531 45 45 namespace JSC { 46 46 47 void JIT::emit_op_put_by_id(Instruction* currentInstruction) 48 { 49 compilePutByIdHotPath(currentInstruction[1].u.operand, &(m_codeBlock->identifier(currentInstruction[2].u.operand)), currentInstruction[3].u.operand, m_propertyAccessInstructionIndex++); 50 } 51 52 void JIT::emit_op_get_by_id(Instruction* currentInstruction) 53 { 54 compileGetByIdHotPath(currentInstruction[1].u.operand, currentInstruction[2].u.operand, &(m_codeBlock->identifier(currentInstruction[3].u.operand)), m_propertyAccessInstructionIndex++); 55 } 56 57 void JIT::emit_op_get_by_val(Instruction* currentInstruction) 58 { 59 emitGetVirtualRegisters(currentInstruction[2].u.operand, regT0, currentInstruction[3].u.operand, regT1); 60 emitJumpSlowCaseIfNotImmediateInteger(regT1); 61 #if USE(ALTERNATE_JSIMMEDIATE) 62 // This is technically incorrect - we're zero-extending an int32. On the hot path this doesn't matter. 63 // We check the value as if it was a uint32 against the m_fastAccessCutoff - which will always fail if 64 // number was signed since m_fastAccessCutoff is always less than intmax (since the total allocation 65 // size is always less than 4Gb). As such zero extending wil have been correct (and extending the value 66 // to 64-bits is necessary since it's used in the address calculation. We zero extend rather than sign 67 // extending since it makes it easier to re-tag the value in the slow case. 68 zeroExtend32ToPtr(regT1, regT1); 69 #else 70 emitFastArithImmToInt(regT1); 71 #endif 72 emitJumpSlowCaseIfNotJSCell(regT0); 73 addSlowCase(branchPtr(NotEqual, Address(regT0), ImmPtr(m_globalData->jsArrayVPtr))); 74 75 // This is an array; get the m_storage pointer into ecx, then check if the index is below the fast cutoff 76 loadPtr(Address(regT0, FIELD_OFFSET(JSArray, m_storage)), regT2); 77 addSlowCase(branch32(AboveOrEqual, regT1, Address(regT0, FIELD_OFFSET(JSArray, m_fastAccessCutoff)))); 78 79 // Get the value from the vector 80 loadPtr(BaseIndex(regT2, regT1, ScalePtr, FIELD_OFFSET(ArrayStorage, m_vector[0])), regT0); 81 emitPutVirtualRegister(currentInstruction[1].u.operand); 82 } 83 84 void JIT::emit_op_put_by_val(Instruction* currentInstruction) 85 { 86 emitGetVirtualRegisters(currentInstruction[1].u.operand, regT0, currentInstruction[2].u.operand, regT1); 87 emitJumpSlowCaseIfNotImmediateInteger(regT1); 88 #if USE(ALTERNATE_JSIMMEDIATE) 89 // See comment in op_get_by_val. 90 zeroExtend32ToPtr(regT1, regT1); 91 #else 92 emitFastArithImmToInt(regT1); 93 #endif 94 emitJumpSlowCaseIfNotJSCell(regT0); 95 addSlowCase(branchPtr(NotEqual, Address(regT0), ImmPtr(m_globalData->jsArrayVPtr))); 96 97 // This is an array; get the m_storage pointer into ecx, then check if the index is below the fast cutoff 98 loadPtr(Address(regT0, FIELD_OFFSET(JSArray, m_storage)), regT2); 99 Jump inFastVector = branch32(Below, regT1, Address(regT0, FIELD_OFFSET(JSArray, m_fastAccessCutoff))); 100 // No; oh well, check if the access if within the vector - if so, we may still be okay. 101 addSlowCase(branch32(AboveOrEqual, regT1, Address(regT2, FIELD_OFFSET(ArrayStorage, m_vectorLength)))); 102 103 // This is a write to the slow part of the vector; first, we have to check if this would be the first write to this location. 104 // FIXME: should be able to handle initial write to array; increment the the number of items in the array, and potentially update fast access cutoff. 105 addSlowCase(branchTestPtr(Zero, BaseIndex(regT2, regT1, ScalePtr, FIELD_OFFSET(ArrayStorage, m_vector[0])))); 106 107 // All good - put the value into the array. 108 inFastVector.link(this); 109 emitGetVirtualRegister(currentInstruction[3].u.operand, regT0); 110 storePtr(regT0, BaseIndex(regT2, regT1, ScalePtr, FIELD_OFFSET(ArrayStorage, m_vector[0]))); 111 } 112 113 void JIT::emit_op_put_by_index(Instruction* currentInstruction) 114 { 115 JITStubCall stubCall(this, JITStubs::cti_op_put_by_index); 116 stubCall.addArgument(currentInstruction[1].u.operand, regT2); 117 stubCall.addArgument(Imm32(currentInstruction[2].u.operand)); 118 stubCall.addArgument(currentInstruction[3].u.operand, regT2); 119 stubCall.call(); 120 } 121 122 void JIT::emit_op_put_getter(Instruction* currentInstruction) 123 { 124 JITStubCall stubCall(this, JITStubs::cti_op_put_getter); 125 stubCall.addArgument(currentInstruction[1].u.operand, regT2); 126 stubCall.addArgument(ImmPtr(&m_codeBlock->identifier(currentInstruction[2].u.operand))); 127 stubCall.addArgument(currentInstruction[3].u.operand, regT2); 128 stubCall.call(); 129 } 130 131 void JIT::emit_op_put_setter(Instruction* currentInstruction) 132 { 133 JITStubCall stubCall(this, JITStubs::cti_op_put_setter); 134 stubCall.addArgument(currentInstruction[1].u.operand, regT2); 135 stubCall.addArgument(ImmPtr(&m_codeBlock->identifier(currentInstruction[2].u.operand))); 136 stubCall.addArgument(currentInstruction[3].u.operand, regT2); 137 stubCall.call(); 138 } 139 140 void JIT::emit_op_del_by_id(Instruction* currentInstruction) 141 { 142 JITStubCall stubCall(this, JITStubs::cti_op_del_by_id); 143 stubCall.addArgument(currentInstruction[2].u.operand, regT2); 144 stubCall.addArgument(ImmPtr(&m_codeBlock->identifier(currentInstruction[3].u.operand))); 145 stubCall.call(currentInstruction[1].u.operand); 146 } 147 47 148 #if !ENABLE(JIT_OPTIMIZE_PROPERTY_ACCESS) 48 149
Note:
See TracChangeset
for help on using the changeset viewer.