Changeset 78732 in webkit for trunk/Source/JavaScriptCore/jit
- Timestamp:
- Feb 16, 2011, 1:35:19 PM (14 years ago)
- Location:
- trunk/Source/JavaScriptCore/jit
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/jit/JIT.h
r78174 r78732 333 333 #endif 334 334 void compileGetDirectOffset(RegisterID base, RegisterID resultTag, RegisterID resultPayload, Structure* structure, size_t cachedOffset); 335 void compileGetDirectOffset(JSObject* base, RegisterID temp, RegisterIDresultTag, RegisterID resultPayload, size_t cachedOffset);336 void compileGetDirectOffset(RegisterID base, RegisterID resultTag, RegisterID resultPayload, RegisterID structure, RegisterIDoffset);335 void compileGetDirectOffset(JSObject* base, RegisterID resultTag, RegisterID resultPayload, size_t cachedOffset); 336 void compileGetDirectOffset(RegisterID base, RegisterID resultTag, RegisterID resultPayload, RegisterID offset); 337 337 void compilePutDirectOffset(RegisterID base, RegisterID valueTag, RegisterID valuePayload, Structure* structure, size_t cachedOffset); 338 338 … … 345 345 // These architecture specific value are used to enable patching - see comment on op_put_by_id. 346 346 static const int patchOffsetPutByIdStructure = 7; 347 static const int patchOffsetPutByIdExternalLoad = 13;348 static const int patchLengthPutByIdExternalLoad = 3;349 347 static const int patchOffsetPutByIdPropertyMapOffset1 = 22; 350 348 static const int patchOffsetPutByIdPropertyMapOffset2 = 28; … … 352 350 static const int patchOffsetGetByIdStructure = 7; 353 351 static const int patchOffsetGetByIdBranchToSlowCase = 13; 354 static const int patchOffsetGetByIdExternalLoad = 13;355 static const int patchLengthGetByIdExternalLoad = 3;356 352 static const int patchOffsetGetByIdPropertyMapOffset1 = 22; 357 353 static const int patchOffsetGetByIdPropertyMapOffset2 = 28; … … 370 366 // These architecture specific value are used to enable patching - see comment on op_put_by_id. 371 367 static const int patchOffsetPutByIdStructure = 4; 372 static const int patchOffsetPutByIdExternalLoad = 16;373 static const int patchLengthPutByIdExternalLoad = 4;374 368 static const int patchOffsetPutByIdPropertyMapOffset1 = 20; 375 369 static const int patchOffsetPutByIdPropertyMapOffset2 = 28; … … 377 371 static const int patchOffsetGetByIdStructure = 4; 378 372 static const int patchOffsetGetByIdBranchToSlowCase = 16; 379 static const int patchOffsetGetByIdExternalLoad = 16;380 static const int patchLengthGetByIdExternalLoad = 4;381 373 static const int patchOffsetGetByIdPropertyMapOffset1 = 20; 382 374 static const int patchOffsetGetByIdPropertyMapOffset2 = 28; … … 411 403 // These architecture specific value are used to enable patching - see comment on op_put_by_id. 412 404 static const int patchOffsetPutByIdStructure = 10; 413 static const int patchOffsetPutByIdExternalLoad = 26;414 static const int patchLengthPutByIdExternalLoad = 12;415 405 static const int patchOffsetPutByIdPropertyMapOffset1 = 46; 416 406 static const int patchOffsetPutByIdPropertyMapOffset2 = 58; … … 418 408 static const int patchOffsetGetByIdStructure = 10; 419 409 static const int patchOffsetGetByIdBranchToSlowCase = 26; 420 static const int patchOffsetGetByIdExternalLoad = 26;421 static const int patchLengthGetByIdExternalLoad = 12;422 410 static const int patchOffsetGetByIdPropertyMapOffset1 = 46; 423 411 static const int patchOffsetGetByIdPropertyMapOffset2 = 58; … … 452 440 #if WTF_MIPS_ISA(1) 453 441 static const int patchOffsetPutByIdStructure = 16; 454 static const int patchOffsetPutByIdExternalLoad = 48;455 static const int patchLengthPutByIdExternalLoad = 20;456 442 static const int patchOffsetPutByIdPropertyMapOffset1 = 68; 457 443 static const int patchOffsetPutByIdPropertyMapOffset2 = 84; 458 444 static const int patchOffsetGetByIdStructure = 16; 459 445 static const int patchOffsetGetByIdBranchToSlowCase = 48; 460 static const int patchOffsetGetByIdExternalLoad = 48;461 static const int patchLengthGetByIdExternalLoad = 20;462 446 static const int patchOffsetGetByIdPropertyMapOffset1 = 68; 463 447 static const int patchOffsetGetByIdPropertyMapOffset2 = 88; … … 474 458 #else // WTF_MIPS_ISA(1) 475 459 static const int patchOffsetPutByIdStructure = 12; 476 static const int patchOffsetPutByIdExternalLoad = 44;477 static const int patchLengthPutByIdExternalLoad = 16;478 460 static const int patchOffsetPutByIdPropertyMapOffset1 = 60; 479 461 static const int patchOffsetPutByIdPropertyMapOffset2 = 76; 480 462 static const int patchOffsetGetByIdStructure = 12; 481 463 static const int patchOffsetGetByIdBranchToSlowCase = 44; 482 static const int patchOffsetGetByIdExternalLoad = 44;483 static const int patchLengthGetByIdExternalLoad = 16;484 464 static const int patchOffsetGetByIdPropertyMapOffset1 = 60; 485 465 static const int patchOffsetGetByIdPropertyMapOffset2 = 76; … … 552 532 #endif 553 533 void compileGetDirectOffset(RegisterID base, RegisterID result, Structure* structure, size_t cachedOffset); 554 void compileGetDirectOffset(JSObject* base, RegisterID temp, RegisterIDresult, size_t cachedOffset);555 void compileGetDirectOffset(RegisterID base, RegisterID result, RegisterID structure, RegisterIDoffset, RegisterID scratch);534 void compileGetDirectOffset(JSObject* base, RegisterID result, size_t cachedOffset); 535 void compileGetDirectOffset(RegisterID base, RegisterID result, RegisterID offset, RegisterID scratch); 556 536 void compilePutDirectOffset(RegisterID base, RegisterID value, Structure* structure, size_t cachedOffset); 557 537 … … 559 539 // These architecture specific value are used to enable patching - see comment on op_put_by_id. 560 540 static const int patchOffsetPutByIdStructure = 10; 561 static const int patchOffsetPutByIdExternalLoad = 20;562 static const int patchLengthPutByIdExternalLoad = 4;563 541 static const int patchOffsetPutByIdPropertyMapOffset = 31; 564 542 // These architecture specific value are used to enable patching - see comment on op_get_by_id. 565 543 static const int patchOffsetGetByIdStructure = 10; 566 544 static const int patchOffsetGetByIdBranchToSlowCase = 20; 567 static const int patchOffsetGetByIdExternalLoad = 20;568 static const int patchLengthGetByIdExternalLoad = 4;569 545 static const int patchOffsetGetByIdPropertyMapOffset = 31; 570 546 static const int patchOffsetGetByIdPutResult = 31; … … 582 558 // These architecture specific value are used to enable patching - see comment on op_put_by_id. 583 559 static const int patchOffsetPutByIdStructure = 7; 584 static const int patchOffsetPutByIdExternalLoad = 13;585 static const int patchLengthPutByIdExternalLoad = 3;586 560 static const int patchOffsetPutByIdPropertyMapOffset = 22; 587 561 // These architecture specific value are used to enable patching - see comment on op_get_by_id. 588 562 static const int patchOffsetGetByIdStructure = 7; 589 563 static const int patchOffsetGetByIdBranchToSlowCase = 13; 590 static const int patchOffsetGetByIdExternalLoad = 13;591 static const int patchLengthGetByIdExternalLoad = 3;592 564 static const int patchOffsetGetByIdPropertyMapOffset = 22; 593 565 static const int patchOffsetGetByIdPutResult = 22; … … 605 577 // These architecture specific value are used to enable patching - see comment on op_put_by_id. 606 578 static const int patchOffsetPutByIdStructure = 10; 607 static const int patchOffsetPutByIdExternalLoad = 26;608 static const int patchLengthPutByIdExternalLoad = 12;609 579 static const int patchOffsetPutByIdPropertyMapOffset = 46; 610 580 // These architecture specific value are used to enable patching - see comment on op_get_by_id. 611 581 static const int patchOffsetGetByIdStructure = 10; 612 582 static const int patchOffsetGetByIdBranchToSlowCase = 26; 613 static const int patchOffsetGetByIdExternalLoad = 26;614 static const int patchLengthGetByIdExternalLoad = 12;615 583 static const int patchOffsetGetByIdPropertyMapOffset = 46; 616 584 static const int patchOffsetGetByIdPutResult = 50; … … 628 596 // These architecture specific value are used to enable patching - see comment on op_put_by_id. 629 597 static const int patchOffsetPutByIdStructure = 4; 630 static const int patchOffsetPutByIdExternalLoad = 16;631 static const int patchLengthPutByIdExternalLoad = 4;632 598 static const int patchOffsetPutByIdPropertyMapOffset = 20; 633 599 // These architecture specific value are used to enable patching - see comment on op_get_by_id. 634 600 static const int patchOffsetGetByIdStructure = 4; 635 601 static const int patchOffsetGetByIdBranchToSlowCase = 16; 636 static const int patchOffsetGetByIdExternalLoad = 16;637 static const int patchLengthGetByIdExternalLoad = 4;638 602 static const int patchOffsetGetByIdPropertyMapOffset = 20; 639 603 static const int patchOffsetGetByIdPutResult = 28; … … 667 631 #if WTF_MIPS_ISA(1) 668 632 static const int patchOffsetPutByIdStructure = 16; 669 static const int patchOffsetPutByIdExternalLoad = 48;670 static const int patchLengthPutByIdExternalLoad = 20;671 633 static const int patchOffsetPutByIdPropertyMapOffset = 68; 672 634 static const int patchOffsetGetByIdStructure = 16; 673 635 static const int patchOffsetGetByIdBranchToSlowCase = 48; 674 static const int patchOffsetGetByIdExternalLoad = 48;675 static const int patchLengthGetByIdExternalLoad = 20;676 636 static const int patchOffsetGetByIdPropertyMapOffset = 68; 677 637 static const int patchOffsetGetByIdPutResult = 88; … … 687 647 #else // WTF_MIPS_ISA(1) 688 648 static const int patchOffsetPutByIdStructure = 12; 689 static const int patchOffsetPutByIdExternalLoad = 44;690 static const int patchLengthPutByIdExternalLoad = 16;691 649 static const int patchOffsetPutByIdPropertyMapOffset = 60; 692 650 static const int patchOffsetGetByIdStructure = 12; 693 651 static const int patchOffsetGetByIdBranchToSlowCase = 44; 694 static const int patchOffsetGetByIdExternalLoad = 44;695 static const int patchLengthGetByIdExternalLoad = 16;696 652 static const int patchOffsetGetByIdPropertyMapOffset = 60; 697 653 static const int patchOffsetGetByIdPutResult = 76; -
trunk/Source/JavaScriptCore/jit/JITOpcodes.cpp
r78174 r78732 690 690 // Load cached property 691 691 // Assume that the global object always uses external storage. 692 loadPtr(Address(regT0, OBJECT_OFFSETOF(JSGlobalObject, m_ externalStorage)), regT0);692 loadPtr(Address(regT0, OBJECT_OFFSETOF(JSGlobalObject, m_propertyStorage)), regT0); 693 693 load32(offsetAddr, regT1); 694 694 loadPtr(BaseIndex(regT0, regT1, ScalePtr), regT0); -
trunk/Source/JavaScriptCore/jit/JITOpcodes32_64.cpp
r75408 r78732 805 805 806 806 // Load property. 807 loadPtr(Address(regT0, OBJECT_OFFSETOF(JSGlobalObject, m_ externalStorage)), regT2);807 loadPtr(Address(regT0, OBJECT_OFFSETOF(JSGlobalObject, m_propertyStorage)), regT2); 808 808 load32(offsetAddr, regT3); 809 809 load32(BaseIndex(regT2, regT3, TimesEight, OBJECT_OFFSETOF(JSValue, u.asBits.payload)), regT0); // payload -
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 -
trunk/Source/JavaScriptCore/jit/JITPropertyAccess32_64.cpp
r70749 r78732 435 435 ASSERT(differenceBetween(hotPathBegin, structureCheck) == patchOffsetGetByIdBranchToSlowCase); 436 436 437 Label externalLoad = loadPtrWithPatchToLEA(Address(regT0, OBJECT_OFFSETOF(JSObject, m_externalStorage)), regT2); 438 Label externalLoadComplete(this); 439 ASSERT(differenceBetween(hotPathBegin, externalLoad) == patchOffsetGetByIdExternalLoad); 440 ASSERT(differenceBetween(externalLoad, externalLoadComplete) == patchLengthGetByIdExternalLoad); 441 437 loadPtr(Address(regT0, OBJECT_OFFSETOF(JSObject, m_propertyStorage)), regT2); 442 438 DataLabel32 displacementLabel1 = loadPtrWithAddressOffsetPatch(Address(regT2, patchGetByIdDefaultOffset), regT0); // payload 443 439 ASSERT(differenceBetween(hotPathBegin, displacementLabel1) == patchOffsetGetByIdPropertyMapOffset1); … … 513 509 ASSERT(differenceBetween(hotPathBegin, structureToCompare) == patchOffsetPutByIdStructure); 514 510 515 // Plant a load from a bogus ofset in the object's property map; we will patch this later, if it is to be used. 516 Label externalLoad = loadPtrWithPatchToLEA(Address(regT0, OBJECT_OFFSETOF(JSObject, m_externalStorage)), regT0); 517 Label externalLoadComplete(this); 518 ASSERT(differenceBetween(hotPathBegin, externalLoad) == patchOffsetPutByIdExternalLoad); 519 ASSERT(differenceBetween(externalLoad, externalLoadComplete) == patchLengthPutByIdExternalLoad); 520 511 loadPtr(Address(regT0, OBJECT_OFFSETOF(JSObject, m_propertyStorage)), regT0); 521 512 DataLabel32 displacementLabel1 = storePtrWithAddressOffsetPatch(regT2, Address(regT0, patchGetByIdDefaultOffset)); // payload 522 513 DataLabel32 displacementLabel2 = storePtrWithAddressOffsetPatch(regT3, Address(regT0, patchGetByIdDefaultOffset)); // tag … … 553 544 int offset = cachedOffset; 554 545 if (structure->isUsingInlineStorage()) 555 offset += OBJECT_OFFSETOF(JSObject, m_inlineStorage) / sizeof(Register);546 offset += JSObject::offsetOfInlineStorage() / sizeof(Register); 556 547 else 557 loadPtr(Address(base, OBJECT_OFFSETOF(JSObject, m_ externalStorage)), base);548 loadPtr(Address(base, OBJECT_OFFSETOF(JSObject, m_propertyStorage)), base); 558 549 emitStore(offset, valueTag, valuePayload, base); 559 550 } … … 563 554 { 564 555 int offset = cachedOffset; 565 if (structure->isUsingInlineStorage()) 566 offset += OBJECT_OFFSETOF(JSObject, m_inlineStorage) / sizeof(Register); 567 else 568 loadPtr(Address(base, OBJECT_OFFSETOF(JSObject, m_externalStorage)), base); 569 emitLoad(offset, resultTag, resultPayload, base); 570 } 571 572 void JIT::compileGetDirectOffset(JSObject* base, RegisterID temp, RegisterID resultTag, RegisterID resultPayload, size_t cachedOffset) 573 { 574 if (base->isUsingInlineStorage()) { 575 load32(reinterpret_cast<char*>(&base->m_inlineStorage[cachedOffset]) + OBJECT_OFFSETOF(JSValue, u.asBits.payload), resultPayload); 576 load32(reinterpret_cast<char*>(&base->m_inlineStorage[cachedOffset]) + OBJECT_OFFSETOF(JSValue, u.asBits.tag), resultTag); 577 return; 556 if (structure->isUsingInlineStorage()) { 557 offset += JSObject::offsetOfInlineStorage() / sizeof(Register); 558 emitLoad(offset, resultTag, resultPayload, base); 559 } else { 560 RegisterID temp = resultPayload; 561 loadPtr(Address(base, OBJECT_OFFSETOF(JSObject, m_propertyStorage)), temp); 562 emitLoad(offset, resultTag, resultPayload, temp); 578 563 } 579 580 size_t offset = cachedOffset * sizeof(JSValue); 581 582 PropertyStorage* protoPropertyStorage = &base->m_externalStorage; 583 loadPtr(static_cast<void*>(protoPropertyStorage), temp); 584 load32(Address(temp, offset + OBJECT_OFFSETOF(JSValue, u.asBits.payload)), resultPayload); 585 load32(Address(temp, offset + OBJECT_OFFSETOF(JSValue, u.asBits.tag)), resultTag); 564 } 565 566 void JIT::compileGetDirectOffset(JSObject* base, RegisterID resultTag, RegisterID resultPayload, size_t cachedOffset) 567 { 568 load32(reinterpret_cast<char*>(&base->m_propertyStorage[cachedOffset]) + OBJECT_OFFSETOF(JSValue, u.asBits.payload), resultPayload); 569 load32(reinterpret_cast<char*>(&base->m_propertyStorage[cachedOffset]) + OBJECT_OFFSETOF(JSValue, u.asBits.tag), resultTag); 586 570 } 587 571 … … 684 668 685 669 int offset = sizeof(JSValue) * cachedOffset; 686 687 // If we're patching to use inline storage, convert the initial load to a lea; this avoids the extra load 688 // and makes the subsequent load's offset automatically correct 689 if (structure->isUsingInlineStorage()) 690 repatchBuffer.repatchLoadPtrToLEA(stubInfo->hotPathBegin.instructionAtOffset(patchOffsetGetByIdExternalLoad)); 691 670 692 671 // Patch the offset into the propoerty map to load from, then patch the Structure to look for. 693 672 repatchBuffer.repatch(stubInfo->hotPathBegin.dataLabelPtrAtOffset(patchOffsetGetByIdStructure), structure); … … 725 704 726 705 int offset = sizeof(JSValue) * cachedOffset; 727 728 // If we're patching to use inline storage, convert the initial load to a lea; this avoids the extra load 729 // and makes the subsequent load's offset automatically correct 730 if (structure->isUsingInlineStorage()) 731 repatchBuffer.repatchLoadPtrToLEA(stubInfo->hotPathBegin.instructionAtOffset(patchOffsetPutByIdExternalLoad)); 732 706 733 707 // Patch the offset into the propoerty map to load from, then patch the Structure to look for. 734 708 repatchBuffer.repatch(stubInfo->hotPathBegin.dataLabelPtrAtOffset(patchOffsetPutByIdStructure), structure); … … 800 774 if (slot.cachedPropertyType() == PropertySlot::Getter) { 801 775 needsStubLink = true; 802 compileGetDirectOffset(protoObject, regT2, regT 2, regT1, cachedOffset);776 compileGetDirectOffset(protoObject, regT2, regT1, cachedOffset); 803 777 JITStubCall stubCall(this, cti_op_get_by_id_getter_stub); 804 778 stubCall.addArgument(regT1); … … 815 789 stubCall.call(); 816 790 } else 817 compileGetDirectOffset(protoObject, regT 2, regT1, regT0, cachedOffset);791 compileGetDirectOffset(protoObject, regT1, regT0, cachedOffset); 818 792 819 793 Jump success = jump(); … … 857 831 if (slot.cachedPropertyType() == PropertySlot::Getter) { 858 832 needsStubLink = true; 859 if (!structure->isUsingInlineStorage()) { 860 move(regT0, regT1); 861 compileGetDirectOffset(regT1, regT2, regT1, structure, cachedOffset); 862 } else 863 compileGetDirectOffset(regT0, regT2, regT1, structure, cachedOffset); 833 compileGetDirectOffset(regT0, regT2, regT1, structure, cachedOffset); 864 834 JITStubCall stubCall(this, cti_op_get_by_id_getter_stub); 865 835 stubCall.addArgument(regT1); … … 931 901 if (slot.cachedPropertyType() == PropertySlot::Getter) { 932 902 needsStubLink = true; 933 compileGetDirectOffset(protoObject, regT2, regT 2, regT1, cachedOffset);903 compileGetDirectOffset(protoObject, regT2, regT1, cachedOffset); 934 904 JITStubCall stubCall(this, cti_op_get_by_id_getter_stub); 935 905 stubCall.addArgument(regT1); … … 946 916 stubCall.call(); 947 917 } else 948 compileGetDirectOffset(protoObject, regT 2, regT1, regT0, cachedOffset);918 compileGetDirectOffset(protoObject, regT1, regT0, cachedOffset); 949 919 950 920 Jump success = jump(); … … 1000 970 if (slot.cachedPropertyType() == PropertySlot::Getter) { 1001 971 needsStubLink = true; 1002 compileGetDirectOffset(protoObject, regT2, regT 2, regT1, cachedOffset);972 compileGetDirectOffset(protoObject, regT2, regT1, cachedOffset); 1003 973 JITStubCall stubCall(this, cti_op_get_by_id_getter_stub); 1004 974 stubCall.addArgument(regT1); … … 1015 985 stubCall.call(); 1016 986 } else 1017 compileGetDirectOffset(protoObject, regT 2, regT1, regT0, cachedOffset);987 compileGetDirectOffset(protoObject, regT1, regT0, cachedOffset); 1018 988 1019 989 Jump success = jump(); … … 1070 1040 if (slot.cachedPropertyType() == PropertySlot::Getter) { 1071 1041 needsStubLink = true; 1072 compileGetDirectOffset(protoObject, regT2, regT 2, regT1, cachedOffset);1042 compileGetDirectOffset(protoObject, regT2, regT1, cachedOffset); 1073 1043 JITStubCall stubCall(this, cti_op_get_by_id_getter_stub); 1074 1044 stubCall.addArgument(regT1); … … 1085 1055 stubCall.call(); 1086 1056 } else 1087 compileGetDirectOffset(protoObject, regT 2, regT1, regT0, cachedOffset);1057 compileGetDirectOffset(protoObject, regT1, regT0, cachedOffset); 1088 1058 Jump success = jump(); 1089 1059 … … 1118 1088 #endif // !ENABLE(JIT_OPTIMIZE_PROPERTY_ACCESS) 1119 1089 1120 void JIT::compileGetDirectOffset(RegisterID base, RegisterID resultTag, RegisterID resultPayload, RegisterID structure, RegisterID offset) 1121 { 1122 ASSERT(sizeof(((Structure*)0)->m_propertyStorageCapacity) == sizeof(int32_t)); 1123 ASSERT(sizeof(JSObject::inlineStorageCapacity) == sizeof(int32_t)); 1090 void JIT::compileGetDirectOffset(RegisterID base, RegisterID resultTag, RegisterID resultPayload, RegisterID offset) 1091 { 1124 1092 ASSERT(sizeof(JSValue) == 8); 1125 1093 1126 Jump notUsingInlineStorage = branch32(NotEqual, Address(structure, OBJECT_OFFSETOF(Structure, m_propertyStorageCapacity)), Imm32(JSObject::inlineStorageCapacity)); 1127 loadPtr(BaseIndex(base, offset, TimesEight, OBJECT_OFFSETOF(JSObject, m_inlineStorage) + OBJECT_OFFSETOF(JSValue, u.asBits.payload)), resultPayload); 1128 loadPtr(BaseIndex(base, offset, TimesEight, OBJECT_OFFSETOF(JSObject, m_inlineStorage) + OBJECT_OFFSETOF(JSValue, u.asBits.tag)), resultTag); 1129 Jump finishedLoad = jump(); 1130 notUsingInlineStorage.link(this); 1131 loadPtr(Address(base, OBJECT_OFFSETOF(JSObject, m_externalStorage)), base); 1094 loadPtr(Address(base, OBJECT_OFFSETOF(JSObject, m_propertyStorage)), base); 1132 1095 loadPtr(BaseIndex(base, offset, TimesEight, OBJECT_OFFSETOF(JSValue, u.asBits.payload)), resultPayload); 1133 1096 loadPtr(BaseIndex(base, offset, TimesEight, OBJECT_OFFSETOF(JSValue, u.asBits.tag)), resultTag); 1134 finishedLoad.link(this);1135 1097 } 1136 1098 … … 1157 1119 sub32(Imm32(1), regT3); 1158 1120 addSlowCase(branch32(AboveOrEqual, regT3, Address(regT1, OBJECT_OFFSETOF(JSPropertyNameIterator, m_numCacheableSlots)))); 1159 compileGetDirectOffset(regT2, regT1, regT0, regT 0, regT3);1121 compileGetDirectOffset(regT2, regT1, regT0, regT3); 1160 1122 1161 1123 emitStore(dst, regT1, regT0); -
trunk/Source/JavaScriptCore/jit/JITStubs.cpp
r77151 r78732 1177 1177 else 1178 1178 structure = constructor->scope().node()->globalObject->emptyObjectStructure(); 1179 JSValue result = new (&callFrame->globalData()) JSObject(structure);1179 JSValue result = constructEmptyObject(callFrame, structure); 1180 1180 1181 1181 return JSValue::encode(result);
Note:
See TracChangeset
for help on using the changeset viewer.