Changeset 40963 in webkit for trunk/JavaScriptCore/jit/JITPropertyAccess.cpp
- Timestamp:
- Feb 12, 2009, 8:22:02 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/jit/JITPropertyAccess.cpp
r40846 r40963 54 54 // to jump back to if one of these trampolies finds a match. 55 55 56 emitGetVirtualRegister(baseVReg, X86::eax);57 58 emitPutJITStubArg( X86::eax, 1);56 emitGetVirtualRegister(baseVReg, regT0); 57 58 emitPutJITStubArg(regT0, 1); 59 59 emitPutJITStubArgConstant(ident, 2); 60 60 emitCTICall(Interpreter::cti_op_get_by_id_generic); … … 74 74 // such that the Structure & offset are always at the same distance from this. 75 75 76 emitGetVirtualRegisters(baseVReg, X86::eax, valueVReg, X86::edx);76 emitGetVirtualRegisters(baseVReg, regT0, valueVReg, regT1); 77 77 78 78 emitPutJITStubArgConstant(ident, 2); 79 emitPutJITStubArg( X86::eax, 1);80 emitPutJITStubArg( X86::edx, 3);79 emitPutJITStubArg(regT0, 1); 80 emitPutJITStubArg(regT1, 3); 81 81 emitCTICall(Interpreter::cti_op_put_by_id_generic); 82 82 } … … 96 96 // to jump back to if one of these trampolies finds a match. 97 97 98 emitGetVirtualRegister(baseVReg, X86::eax);99 100 emitJumpSlowCaseIfNotJSCell( X86::eax, baseVReg);98 emitGetVirtualRegister(baseVReg, regT0); 99 100 emitJumpSlowCaseIfNotJSCell(regT0, baseVReg); 101 101 102 102 Label hotPathBegin(this); … … 104 104 105 105 DataLabelPtr structureToCompare; 106 Jump structureCheck = branchPtrWithPatch(NotEqual, Address( X86::eax, FIELD_OFFSET(JSCell, m_structure)), structureToCompare, ImmPtr(reinterpret_cast<void*>(patchGetByIdDefaultStructure)));106 Jump structureCheck = branchPtrWithPatch(NotEqual, Address(regT0, FIELD_OFFSET(JSCell, m_structure)), structureToCompare, ImmPtr(reinterpret_cast<void*>(patchGetByIdDefaultStructure))); 107 107 addSlowCase(structureCheck); 108 108 ASSERT(differenceBetween(hotPathBegin, structureToCompare) == patchOffsetGetByIdStructure); 109 109 ASSERT(differenceBetween(hotPathBegin, structureCheck) == patchOffsetGetByIdBranchToSlowCase); 110 110 111 loadPtr(Address( X86::eax, FIELD_OFFSET(JSObject, m_propertyStorage)), X86::eax);112 DataLabel32 displacementLabel = loadPtrWithAddressOffsetPatch(Address( X86::eax, patchGetByIdDefaultOffset), X86::eax);111 loadPtr(Address(regT0, FIELD_OFFSET(JSObject, m_propertyStorage)), regT0); 112 DataLabel32 displacementLabel = loadPtrWithAddressOffsetPatch(Address(regT0, patchGetByIdDefaultOffset), regT0); 113 113 ASSERT(differenceBetween(hotPathBegin, displacementLabel) == patchOffsetGetByIdPropertyMapOffset); 114 114 … … 133 133 Label coldPathBegin(this); 134 134 #endif 135 emitPutJITStubArg( X86::eax, 1);135 emitPutJITStubArg(regT0, 1); 136 136 emitPutJITStubArgConstant(ident, 2); 137 137 Call call = emitCTICall(Interpreter::cti_op_get_by_id); … … 150 150 // such that the Structure & offset are always at the same distance from this. 151 151 152 emitGetVirtualRegisters(baseVReg, X86::eax, valueVReg, X86::edx);152 emitGetVirtualRegisters(baseVReg, regT0, valueVReg, regT1); 153 153 154 154 // Jump to a slow case if either the base object is an immediate, or if the Structure does not match. 155 emitJumpSlowCaseIfNotJSCell( X86::eax, baseVReg);155 emitJumpSlowCaseIfNotJSCell(regT0, baseVReg); 156 156 157 157 Label hotPathBegin(this); … … 160 160 // It is important that the following instruction plants a 32bit immediate, in order that it can be patched over. 161 161 DataLabelPtr structureToCompare; 162 addSlowCase(branchPtrWithPatch(NotEqual, Address( X86::eax, FIELD_OFFSET(JSCell, m_structure)), structureToCompare, ImmPtr(reinterpret_cast<void*>(patchGetByIdDefaultStructure))));162 addSlowCase(branchPtrWithPatch(NotEqual, Address(regT0, FIELD_OFFSET(JSCell, m_structure)), structureToCompare, ImmPtr(reinterpret_cast<void*>(patchGetByIdDefaultStructure)))); 163 163 ASSERT(differenceBetween(hotPathBegin, structureToCompare) == patchOffsetPutByIdStructure); 164 164 165 165 // Plant a load from a bogus ofset in the object's property map; we will patch this later, if it is to be used. 166 loadPtr(Address( X86::eax, FIELD_OFFSET(JSObject, m_propertyStorage)), X86::eax);167 DataLabel32 displacementLabel = storePtrWithAddressOffsetPatch( X86::edx, Address(X86::eax, patchGetByIdDefaultOffset));166 loadPtr(Address(regT0, FIELD_OFFSET(JSObject, m_propertyStorage)), regT0); 167 DataLabel32 displacementLabel = storePtrWithAddressOffsetPatch(regT1, Address(regT0, patchGetByIdDefaultOffset)); 168 168 ASSERT(differenceBetween(hotPathBegin, displacementLabel) == patchOffsetPutByIdPropertyMapOffset); 169 169 } … … 175 175 176 176 emitPutJITStubArgConstant(ident, 2); 177 emitPutJITStubArg( X86::eax, 1);178 emitPutJITStubArg( X86::edx, 3);177 emitPutJITStubArg(regT0, 1); 178 emitPutJITStubArg(regT1, 3); 179 179 Call call = emitCTICall(Interpreter::cti_op_put_by_id); 180 180 … … 198 198 JumpList failureCases; 199 199 // Check eax is an object of the right Structure. 200 failureCases.append(emitJumpIfNotJSCell( X86::eax));201 failureCases.append(branchPtr(NotEqual, Address( X86::eax, FIELD_OFFSET(JSCell, m_structure)), ImmPtr(oldStructure)));200 failureCases.append(emitJumpIfNotJSCell(regT0)); 201 failureCases.append(branchPtr(NotEqual, Address(regT0, FIELD_OFFSET(JSCell, m_structure)), ImmPtr(oldStructure))); 202 202 JumpList successCases; 203 203 204 204 // ecx = baseObject 205 loadPtr(Address( X86::eax, FIELD_OFFSET(JSCell, m_structure)), X86::ecx);205 loadPtr(Address(regT0, FIELD_OFFSET(JSCell, m_structure)), regT2); 206 206 // proto(ecx) = baseObject->structure()->prototype() 207 failureCases.append(branch32(NotEqual, Address( X86::ecx, FIELD_OFFSET(Structure, m_typeInfo) + FIELD_OFFSET(TypeInfo, m_type)), Imm32(ObjectType)));208 209 loadPtr(Address( X86::ecx, FIELD_OFFSET(Structure, m_prototype)), X86::ecx);207 failureCases.append(branch32(NotEqual, Address(regT2, FIELD_OFFSET(Structure, m_typeInfo) + FIELD_OFFSET(TypeInfo, m_type)), Imm32(ObjectType))); 208 209 loadPtr(Address(regT2, FIELD_OFFSET(Structure, m_prototype)), regT2); 210 210 211 211 // ecx = baseObject->m_structure 212 212 for (RefPtr<Structure>* it = chain->head(); *it; ++it) { 213 213 // null check the prototype 214 successCases.append(branchPtr(Equal, X86::ecx, ImmPtr(JSValuePtr::encode(jsNull()))));214 successCases.append(branchPtr(Equal, regT2, ImmPtr(JSValuePtr::encode(jsNull())))); 215 215 216 216 // Check the structure id 217 failureCases.append(branchPtr(NotEqual, Address( X86::ecx, FIELD_OFFSET(JSCell, m_structure)), ImmPtr(it->get())));217 failureCases.append(branchPtr(NotEqual, Address(regT2, FIELD_OFFSET(JSCell, m_structure)), ImmPtr(it->get()))); 218 218 219 loadPtr(Address( X86::ecx, FIELD_OFFSET(JSCell, m_structure)), X86::ecx);220 failureCases.append(branch32(NotEqual, Address( X86::ecx, FIELD_OFFSET(Structure, m_typeInfo) + FIELD_OFFSET(TypeInfo, m_type)), Imm32(ObjectType)));221 loadPtr(Address( X86::ecx, FIELD_OFFSET(Structure, m_prototype)), X86::ecx);219 loadPtr(Address(regT2, FIELD_OFFSET(JSCell, m_structure)), regT2); 220 failureCases.append(branch32(NotEqual, Address(regT2, FIELD_OFFSET(Structure, m_typeInfo) + FIELD_OFFSET(TypeInfo, m_type)), Imm32(ObjectType))); 221 loadPtr(Address(regT2, FIELD_OFFSET(Structure, m_prototype)), regT2); 222 222 } 223 223 … … 230 230 pop(X86::ebx); 231 231 #if PLATFORM(X86_64) 232 move(Imm32(newStructure->propertyStorageCapacity()), X86::edx);232 move(Imm32(newStructure->propertyStorageCapacity()), regT1); 233 233 move(Imm32(oldStructure->propertyStorageCapacity()), X86::esi); 234 move( X86::eax, X86::edi);234 move(regT0, X86::edi); 235 235 callTarget = call(); 236 236 #else 237 237 push(Imm32(newStructure->propertyStorageCapacity())); 238 238 push(Imm32(oldStructure->propertyStorageCapacity())); 239 push( X86::eax);239 push(regT0); 240 240 callTarget = call(); 241 241 addPtr(Imm32(3 * sizeof(void*)), X86::esp); 242 242 #endif 243 emitGetJITStubArg(3, X86::edx);243 emitGetJITStubArg(3, regT1); 244 244 push(X86::ebx); 245 245 } … … 249 249 sub32(Imm32(1), AbsoluteAddress(oldStructure->addressOfCount())); 250 250 add32(Imm32(1), AbsoluteAddress(newStructure->addressOfCount())); 251 storePtr(ImmPtr(newStructure), Address( X86::eax, FIELD_OFFSET(JSCell, m_structure)));251 storePtr(ImmPtr(newStructure), Address(regT0, FIELD_OFFSET(JSCell, m_structure))); 252 252 253 253 // write the value 254 loadPtr(Address( X86::eax, FIELD_OFFSET(JSObject, m_propertyStorage)), X86::eax);255 storePtr( X86::edx, Address(X86::eax, cachedOffset * sizeof(JSValuePtr)));254 loadPtr(Address(regT0, FIELD_OFFSET(JSObject, m_propertyStorage)), regT0); 255 storePtr(regT1, Address(regT0, cachedOffset * sizeof(JSValuePtr))); 256 256 257 257 ret(); … … 310 310 311 311 // Check eax is an array 312 Jump failureCases1 = branchPtr(NotEqual, Address( X86::eax), ImmPtr(m_interpreter->m_jsArrayVptr));312 Jump failureCases1 = branchPtr(NotEqual, Address(regT0), ImmPtr(m_interpreter->m_jsArrayVptr)); 313 313 314 314 // Checks out okay! - get the length from the storage 315 loadPtr(Address( X86::eax, FIELD_OFFSET(JSArray, m_storage)), X86::ecx);316 load32(Address( X86::ecx, FIELD_OFFSET(ArrayStorage, m_length)), X86::ecx);317 318 Jump failureCases2 = branch32(Above, X86::ecx, Imm32(JSImmediate::maxImmediateInt));319 320 emitFastArithIntToImmNoCheck( X86::ecx, X86::eax);315 loadPtr(Address(regT0, FIELD_OFFSET(JSArray, m_storage)), regT2); 316 load32(Address(regT2, FIELD_OFFSET(ArrayStorage, m_length)), regT2); 317 318 Jump failureCases2 = branch32(Above, regT2, Imm32(JSImmediate::maxImmediateInt)); 319 320 emitFastArithIntToImmNoCheck(regT2, regT0); 321 321 Jump success = jump(); 322 322 … … 344 344 { 345 345 // Check eax is an object of the right Structure. 346 Jump failureCases1 = emitJumpIfNotJSCell( X86::eax);347 Jump failureCases2 = checkStructure( X86::eax, structure);346 Jump failureCases1 = emitJumpIfNotJSCell(regT0); 347 Jump failureCases2 = checkStructure(regT0, structure); 348 348 349 349 // Checks out okay! - getDirectOffset 350 loadPtr(Address( X86::eax, FIELD_OFFSET(JSObject, m_propertyStorage)), X86::eax);351 loadPtr(Address( X86::eax, cachedOffset * sizeof(JSValuePtr)), X86::eax);350 loadPtr(Address(regT0, FIELD_OFFSET(JSObject, m_propertyStorage)), regT0); 351 loadPtr(Address(regT0, cachedOffset * sizeof(JSValuePtr)), regT0); 352 352 ret(); 353 353 … … 373 373 JSObject* protoObject = asObject(structure->prototypeForLookup(callFrame)); 374 374 PropertyStorage* protoPropertyStorage = &protoObject->m_propertyStorage; 375 loadPtr(static_cast<void*>(protoPropertyStorage), X86::edx);376 377 // Check eax is an object of the right Structure. 378 Jump failureCases1 = checkStructure( X86::eax, structure);375 loadPtr(static_cast<void*>(protoPropertyStorage), regT1); 376 377 // Check eax is an object of the right Structure. 378 Jump failureCases1 = checkStructure(regT0, structure); 379 379 380 380 // Check the prototype object's Structure had not changed. 381 381 Structure** prototypeStructureAddress = &(protoObject->m_structure); 382 382 #if PLATFORM(X86_64) 383 move(ImmPtr(prototypeStructure), X86::ebx);384 Jump failureCases2 = branchPtr(NotEqual, AbsoluteAddress(prototypeStructureAddress), X86::ebx);383 move(ImmPtr(prototypeStructure), regT3); 384 Jump failureCases2 = branchPtr(NotEqual, AbsoluteAddress(prototypeStructureAddress), regT3); 385 385 #else 386 386 Jump failureCases2 = branchPtr(NotEqual, AbsoluteAddress(prototypeStructureAddress), ImmPtr(prototypeStructure)); … … 388 388 389 389 // Checks out okay! - getDirectOffset 390 loadPtr(Address( X86::edx, cachedOffset * sizeof(JSValuePtr)), X86::eax);390 loadPtr(Address(regT1, cachedOffset * sizeof(JSValuePtr)), regT0); 391 391 392 392 Jump success = jump(); … … 415 415 JSObject* protoObject = asObject(structure->prototypeForLookup(callFrame)); 416 416 PropertyStorage* protoPropertyStorage = &protoObject->m_propertyStorage; 417 loadPtr(protoPropertyStorage, X86::edx);418 419 // Check eax is an object of the right Structure. 420 Jump failureCases1 = emitJumpIfNotJSCell( X86::eax);421 Jump failureCases2 = checkStructure( X86::eax, structure);417 loadPtr(protoPropertyStorage, regT1); 418 419 // Check eax is an object of the right Structure. 420 Jump failureCases1 = emitJumpIfNotJSCell(regT0); 421 Jump failureCases2 = checkStructure(regT0, structure); 422 422 423 423 // Check the prototype object's Structure had not changed. … … 426 426 427 427 // Checks out okay! - getDirectOffset 428 loadPtr(Address( X86::edx, cachedOffset * sizeof(JSValuePtr)), X86::eax);428 loadPtr(Address(regT1, cachedOffset * sizeof(JSValuePtr)), regT0); 429 429 430 430 ret(); … … 446 446 void JIT::privateCompileGetByIdSelfList(StructureStubInfo* stubInfo, PolymorphicAccessStructureList* polymorphicStructures, int currentIndex, Structure* structure, size_t cachedOffset) 447 447 { 448 Jump failureCase = checkStructure( X86::eax, structure);449 loadPtr(Address( X86::eax, FIELD_OFFSET(JSObject, m_propertyStorage)), X86::eax);450 loadPtr(Address( X86::eax, cachedOffset * sizeof(JSValuePtr)), X86::eax);448 Jump failureCase = checkStructure(regT0, structure); 449 loadPtr(Address(regT0, FIELD_OFFSET(JSObject, m_propertyStorage)), regT0); 450 loadPtr(Address(regT0, cachedOffset * sizeof(JSValuePtr)), regT0); 451 451 Jump success = jump(); 452 452 … … 481 481 JSObject* protoObject = asObject(structure->prototypeForLookup(callFrame)); 482 482 PropertyStorage* protoPropertyStorage = &protoObject->m_propertyStorage; 483 loadPtr(protoPropertyStorage, X86::edx);484 485 // Check eax is an object of the right Structure. 486 Jump failureCases1 = checkStructure( X86::eax, structure);483 loadPtr(protoPropertyStorage, regT1); 484 485 // Check eax is an object of the right Structure. 486 Jump failureCases1 = checkStructure(regT0, structure); 487 487 488 488 // Check the prototype object's Structure had not changed. 489 489 Structure** prototypeStructureAddress = &(protoObject->m_structure); 490 490 #if PLATFORM(X86_64) 491 move(ImmPtr(prototypeStructure), X86::ebx);492 Jump failureCases2 = branchPtr(NotEqual, AbsoluteAddress(prototypeStructureAddress), X86::ebx);491 move(ImmPtr(prototypeStructure), regT3); 492 Jump failureCases2 = branchPtr(NotEqual, AbsoluteAddress(prototypeStructureAddress), regT3); 493 493 #else 494 494 Jump failureCases2 = branchPtr(NotEqual, AbsoluteAddress(prototypeStructureAddress), ImmPtr(prototypeStructure)); … … 496 496 497 497 // Checks out okay! - getDirectOffset 498 loadPtr(Address( X86::edx, cachedOffset * sizeof(JSValuePtr)), X86::eax);498 loadPtr(Address(regT1, cachedOffset * sizeof(JSValuePtr)), regT0); 499 499 500 500 Jump success = jump(); … … 529 529 530 530 // Check eax is an object of the right Structure. 531 Jump baseObjectCheck = checkStructure( X86::eax, structure);531 Jump baseObjectCheck = checkStructure(regT0, structure); 532 532 bucketsOfFail.append(baseObjectCheck); 533 533 … … 542 542 Structure** prototypeStructureAddress = &(protoObject->m_structure); 543 543 #if PLATFORM(X86_64) 544 move(ImmPtr(currStructure), X86::ebx);545 bucketsOfFail.append(branchPtr(NotEqual, AbsoluteAddress(prototypeStructureAddress), X86::ebx));544 move(ImmPtr(currStructure), regT3); 545 bucketsOfFail.append(branchPtr(NotEqual, AbsoluteAddress(prototypeStructureAddress), regT3)); 546 546 #else 547 547 bucketsOfFail.append(branchPtr(NotEqual, AbsoluteAddress(prototypeStructureAddress), ImmPtr(currStructure))); … … 551 551 552 552 PropertyStorage* protoPropertyStorage = &protoObject->m_propertyStorage; 553 loadPtr(protoPropertyStorage, X86::edx);554 loadPtr(Address( X86::edx, cachedOffset * sizeof(JSValuePtr)), X86::eax);553 loadPtr(protoPropertyStorage, regT1); 554 loadPtr(Address(regT1, cachedOffset * sizeof(JSValuePtr)), regT0); 555 555 Jump success = jump(); 556 556 … … 590 590 591 591 // Check eax is an object of the right Structure. 592 bucketsOfFail.append(checkStructure( X86::eax, structure));592 bucketsOfFail.append(checkStructure(regT0, structure)); 593 593 594 594 Structure* currStructure = structure; … … 602 602 Structure** prototypeStructureAddress = &(protoObject->m_structure); 603 603 #if PLATFORM(X86_64) 604 move(ImmPtr(currStructure), X86::ebx);605 bucketsOfFail.append(branchPtr(NotEqual, AbsoluteAddress(prototypeStructureAddress), X86::ebx));604 move(ImmPtr(currStructure), regT3); 605 bucketsOfFail.append(branchPtr(NotEqual, AbsoluteAddress(prototypeStructureAddress), regT3)); 606 606 #else 607 607 bucketsOfFail.append(branchPtr(NotEqual, AbsoluteAddress(prototypeStructureAddress), ImmPtr(currStructure))); … … 611 611 612 612 PropertyStorage* protoPropertyStorage = &protoObject->m_propertyStorage; 613 loadPtr(protoPropertyStorage, X86::edx);614 loadPtr(Address( X86::edx, cachedOffset * sizeof(JSValuePtr)), X86::eax);613 loadPtr(protoPropertyStorage, regT1); 614 loadPtr(Address(regT1, cachedOffset * sizeof(JSValuePtr)), regT0); 615 615 Jump success = jump(); 616 616 … … 637 637 638 638 // Check eax is an object of the right Structure. 639 bucketsOfFail.append(emitJumpIfNotJSCell( X86::eax));640 bucketsOfFail.append(checkStructure( X86::eax, structure));639 bucketsOfFail.append(emitJumpIfNotJSCell(regT0)); 640 bucketsOfFail.append(checkStructure(regT0, structure)); 641 641 642 642 Structure* currStructure = structure; … … 650 650 Structure** prototypeStructureAddress = &(protoObject->m_structure); 651 651 #if PLATFORM(X86_64) 652 move(ImmPtr(currStructure), X86::ebx);653 bucketsOfFail.append(branchPtr(NotEqual, X86::ebx, AbsoluteAddress(prototypeStructureAddress)));652 move(ImmPtr(currStructure), regT3); 653 bucketsOfFail.append(branchPtr(NotEqual, regT3, AbsoluteAddress(prototypeStructureAddress))); 654 654 #else 655 655 bucketsOfFail.append(branchPtr(NotEqual, AbsoluteAddress(prototypeStructureAddress), ImmPtr(currStructure))); … … 659 659 660 660 PropertyStorage* protoPropertyStorage = &protoObject->m_propertyStorage; 661 loadPtr(protoPropertyStorage, X86::edx);662 loadPtr(Address( X86::edx, cachedOffset * sizeof(JSValuePtr)), X86::eax);661 loadPtr(protoPropertyStorage, regT1); 662 loadPtr(Address(regT1, cachedOffset * sizeof(JSValuePtr)), regT0); 663 663 ret(); 664 664 … … 676 676 { 677 677 // Check eax is an object of the right Structure. 678 Jump failureCases1 = emitJumpIfNotJSCell( X86::eax);679 Jump failureCases2 = checkStructure( X86::eax, structure);678 Jump failureCases1 = emitJumpIfNotJSCell(regT0); 679 Jump failureCases2 = checkStructure(regT0, structure); 680 680 681 681 // checks out okay! - putDirectOffset 682 loadPtr(Address( X86::eax, FIELD_OFFSET(JSObject, m_propertyStorage)), X86::eax);683 storePtr( X86::edx, Address(X86::eax, cachedOffset * sizeof(JSValuePtr)));682 loadPtr(Address(regT0, FIELD_OFFSET(JSObject, m_propertyStorage)), regT0); 683 storePtr(regT1, Address(regT0, cachedOffset * sizeof(JSValuePtr))); 684 684 ret(); 685 685
Note:
See TracChangeset
for help on using the changeset viewer.