Changeset 78732 in webkit for trunk/Source/JavaScriptCore/jit/JITPropertyAccess.cpp
- Timestamp:
- Feb 16, 2011, 1:35:19 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/jit/JITPropertyAccess.cpp
r70750 r78732 139 139 } 140 140 141 void JIT::compileGetDirectOffset(RegisterID base, RegisterID result, RegisterID structure, RegisterID offset, RegisterID scratch) 142 { 143 ASSERT(sizeof(((Structure*)0)->m_propertyStorageCapacity) == sizeof(int32_t)); 144 ASSERT(sizeof(JSObject::inlineStorageCapacity) == sizeof(int32_t)); 145 146 Jump notUsingInlineStorage = branch32(NotEqual, Address(structure, OBJECT_OFFSETOF(Structure, m_propertyStorageCapacity)), Imm32(JSObject::inlineStorageCapacity)); 147 loadPtr(BaseIndex(base, offset, ScalePtr, OBJECT_OFFSETOF(JSObject, m_inlineStorage)), result); 148 Jump finishedLoad = jump(); 149 notUsingInlineStorage.link(this); 150 loadPtr(Address(base, OBJECT_OFFSETOF(JSObject, m_externalStorage)), scratch); 141 void JIT::compileGetDirectOffset(RegisterID base, RegisterID result, RegisterID offset, RegisterID scratch) 142 { 143 loadPtr(Address(base, OBJECT_OFFSETOF(JSObject, m_propertyStorage)), scratch); 151 144 loadPtr(BaseIndex(scratch, offset, ScalePtr, 0), result); 152 finishedLoad.link(this);153 145 } 154 146 … … 173 165 sub32(Imm32(1), regT3); 174 166 addSlowCase(branch32(AboveOrEqual, regT3, Address(regT1, OBJECT_OFFSETOF(JSPropertyNameIterator, m_numCacheableSlots)))); 175 compileGetDirectOffset(regT0, regT0, regT 2, regT3, regT1);167 compileGetDirectOffset(regT0, regT0, regT3, regT1); 176 168 177 169 emitPutVirtualRegister(dst, regT0); … … 428 420 ASSERT_JIT_OFFSET(differenceBetween(hotPathBegin, structureCheck), patchOffsetGetByIdBranchToSlowCase) 429 421 430 Label externalLoad = loadPtrWithPatchToLEA(Address(regT0, OBJECT_OFFSETOF(JSObject, m_externalStorage)), regT0); 431 Label externalLoadComplete(this); 432 ASSERT_JIT_OFFSET(differenceBetween(hotPathBegin, externalLoad), patchOffsetGetByIdExternalLoad); 433 ASSERT_JIT_OFFSET(differenceBetween(externalLoad, externalLoadComplete), patchLengthGetByIdExternalLoad); 434 422 loadPtr(Address(regT0, OBJECT_OFFSETOF(JSObject, m_propertyStorage)), regT0); 435 423 DataLabel32 displacementLabel = loadPtrWithAddressOffsetPatch(Address(regT0, patchGetByIdDefaultOffset), regT0); 436 424 ASSERT_JIT_OFFSET(differenceBetween(hotPathBegin, displacementLabel), patchOffsetGetByIdPropertyMapOffset); … … 508 496 ASSERT_JIT_OFFSET(differenceBetween(hotPathBegin, structureToCompare), patchOffsetPutByIdStructure); 509 497 510 // Plant a load from a bogus ofset in the object's property map; we will patch this later, if it is to be used. 511 Label externalLoad = loadPtrWithPatchToLEA(Address(regT0, OBJECT_OFFSETOF(JSObject, m_externalStorage)), regT0); 512 Label externalLoadComplete(this); 513 ASSERT_JIT_OFFSET(differenceBetween(hotPathBegin, externalLoad), patchOffsetPutByIdExternalLoad); 514 ASSERT_JIT_OFFSET(differenceBetween(externalLoad, externalLoadComplete), patchLengthPutByIdExternalLoad); 515 498 loadPtr(Address(regT0, OBJECT_OFFSETOF(JSObject, m_propertyStorage)), regT0); 516 499 DataLabel32 displacementLabel = storePtrWithAddressOffsetPatch(regT1, Address(regT0, patchGetByIdDefaultOffset)); 517 500 … … 548 531 int offset = cachedOffset * sizeof(JSValue); 549 532 if (structure->isUsingInlineStorage()) 550 offset += OBJECT_OFFSETOF(JSObject, m_inlineStorage);533 offset += JSObject::offsetOfInlineStorage(); 551 534 else 552 loadPtr(Address(base, OBJECT_OFFSETOF(JSObject, m_ externalStorage)), base);535 loadPtr(Address(base, OBJECT_OFFSETOF(JSObject, m_propertyStorage)), base); 553 536 storePtr(value, Address(base, offset)); 554 537 } … … 558 541 { 559 542 int offset = cachedOffset * sizeof(JSValue); 560 if (structure->isUsingInlineStorage()) 561 offset += OBJECT_OFFSETOF(JSObject, m_inlineStorage); 562 else 563 loadPtr(Address(base, OBJECT_OFFSETOF(JSObject, m_externalStorage)), base); 564 loadPtr(Address(base, offset), result); 565 } 566 567 void JIT::compileGetDirectOffset(JSObject* base, RegisterID temp, RegisterID result, size_t cachedOffset) 568 { 569 if (base->isUsingInlineStorage()) 570 loadPtr(static_cast<void*>(&base->m_inlineStorage[cachedOffset]), result); 571 else { 572 PropertyStorage* protoPropertyStorage = &base->m_externalStorage; 573 loadPtr(static_cast<void*>(protoPropertyStorage), temp); 574 loadPtr(Address(temp, cachedOffset * sizeof(JSValue)), result); 575 } 543 if (structure->isUsingInlineStorage()) { 544 offset += JSObject::offsetOfInlineStorage(); 545 loadPtr(Address(base, offset), result); 546 } else { 547 loadPtr(Address(base, OBJECT_OFFSETOF(JSObject, m_propertyStorage)), result); 548 loadPtr(Address(result, offset), result); 549 } 550 } 551 552 void JIT::compileGetDirectOffset(JSObject* base, RegisterID result, size_t cachedOffset) 553 { 554 loadPtr(static_cast<void*>(&base->m_propertyStorage[cachedOffset]), result); 576 555 } 577 556 … … 669 648 int offset = sizeof(JSValue) * cachedOffset; 670 649 671 // If we're patching to use inline storage, convert the initial load to a lea; this avoids the extra load672 // and makes the subsequent load's offset automatically correct673 if (structure->isUsingInlineStorage())674 repatchBuffer.repatchLoadPtrToLEA(stubInfo->hotPathBegin.instructionAtOffset(patchOffsetGetByIdExternalLoad));675 676 650 // Patch the offset into the propoerty map to load from, then patch the Structure to look for. 677 651 repatchBuffer.repatch(stubInfo->hotPathBegin.dataLabelPtrAtOffset(patchOffsetGetByIdStructure), structure); … … 708 682 709 683 int offset = sizeof(JSValue) * cachedOffset; 710 711 // If we're patching to use inline storage, convert the initial load to a lea; this avoids the extra load712 // and makes the subsequent load's offset automatically correct713 if (structure->isUsingInlineStorage())714 repatchBuffer.repatchLoadPtrToLEA(stubInfo->hotPathBegin.instructionAtOffset(patchOffsetPutByIdExternalLoad));715 684 716 685 // Patch the offset into the propoerty map to load from, then patch the Structure to look for. … … 780 749 if (slot.cachedPropertyType() == PropertySlot::Getter) { 781 750 needsStubLink = true; 782 compileGetDirectOffset(protoObject, regT1, regT1,cachedOffset);751 compileGetDirectOffset(protoObject, regT1, cachedOffset); 783 752 JITStubCall stubCall(this, cti_op_get_by_id_getter_stub); 784 753 stubCall.addArgument(regT1); … … 795 764 stubCall.call(); 796 765 } else 797 compileGetDirectOffset(protoObject, regT 1, regT0, cachedOffset);766 compileGetDirectOffset(protoObject, regT0, cachedOffset); 798 767 Jump success = jump(); 799 768 LinkBuffer patchBuffer(this, m_codeBlock->executablePool(), 0); … … 832 801 if (slot.cachedPropertyType() == PropertySlot::Getter) { 833 802 needsStubLink = true; 834 if (!structure->isUsingInlineStorage()) { 835 move(regT0, regT1); 836 compileGetDirectOffset(regT1, regT1, structure, cachedOffset); 837 } else 838 compileGetDirectOffset(regT0, regT1, structure, cachedOffset); 803 compileGetDirectOffset(regT0, regT1, structure, cachedOffset); 839 804 JITStubCall stubCall(this, cti_op_get_by_id_getter_stub); 840 805 stubCall.addArgument(regT1); … … 906 871 if (slot.cachedPropertyType() == PropertySlot::Getter) { 907 872 needsStubLink = true; 908 compileGetDirectOffset(protoObject, regT1, regT1,cachedOffset);873 compileGetDirectOffset(protoObject, regT1, cachedOffset); 909 874 JITStubCall stubCall(this, cti_op_get_by_id_getter_stub); 910 875 stubCall.addArgument(regT1); … … 921 886 stubCall.call(); 922 887 } else 923 compileGetDirectOffset(protoObject, regT 1, regT0, cachedOffset);888 compileGetDirectOffset(protoObject, regT0, cachedOffset); 924 889 925 890 Jump success = jump(); … … 976 941 if (slot.cachedPropertyType() == PropertySlot::Getter) { 977 942 needsStubLink = true; 978 compileGetDirectOffset(protoObject, regT1, regT1,cachedOffset);943 compileGetDirectOffset(protoObject, regT1, cachedOffset); 979 944 JITStubCall stubCall(this, cti_op_get_by_id_getter_stub); 980 945 stubCall.addArgument(regT1); … … 991 956 stubCall.call(); 992 957 } else 993 compileGetDirectOffset(protoObject, regT 1, regT0, cachedOffset);958 compileGetDirectOffset(protoObject, regT0, cachedOffset); 994 959 Jump success = jump(); 995 960 … … 1046 1011 if (slot.cachedPropertyType() == PropertySlot::Getter) { 1047 1012 needsStubLink = true; 1048 compileGetDirectOffset(protoObject, regT1, regT1,cachedOffset);1013 compileGetDirectOffset(protoObject, regT1, cachedOffset); 1049 1014 JITStubCall stubCall(this, cti_op_get_by_id_getter_stub); 1050 1015 stubCall.addArgument(regT1); … … 1061 1026 stubCall.call(); 1062 1027 } else 1063 compileGetDirectOffset(protoObject, regT 1, regT0, cachedOffset);1028 compileGetDirectOffset(protoObject, regT0, cachedOffset); 1064 1029 Jump success = jump(); 1065 1030
Note:
See TracChangeset
for help on using the changeset viewer.