Changeset 44700 in webkit for trunk/JavaScriptCore/jit/JITPropertyAccess.cpp
- Timestamp:
- Jun 15, 2009, 5:26:53 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/jit/JITPropertyAccess.cpp
r44525 r44700 499 499 CodeLocationLabel entryLabel = patchBuffer.finalizeCodeAddendum(); 500 500 stubInfo->stubRoutine = entryLabel; 501 returnAddress.relinkCallerToTrampoline(entryLabel); 501 RepatchBuffer repatchBuffer; 502 repatchBuffer.relinkCallerToTrampoline(returnAddress, entryLabel); 502 503 } 503 504 504 505 void JIT::patchGetByIdSelf(StructureStubInfo* stubInfo, Structure* structure, size_t cachedOffset, ProcessorReturnAddress returnAddress) 505 506 { 507 RepatchBuffer repatchBuffer; 508 506 509 // We don't want to patch more than once - in future go to cti_op_get_by_id_generic. 507 510 // Should probably go to JITStubs::cti_op_get_by_id_fail, but that doesn't do anything interesting right now. 508 re turnAddress.relinkCallerToFunction(FunctionPtr(JITStubs::cti_op_get_by_id_self_fail));511 repatchBuffer.relinkCallerToFunction(returnAddress, FunctionPtr(JITStubs::cti_op_get_by_id_self_fail)); 509 512 510 513 int offset = sizeof(JSValue) * cachedOffset; … … 513 516 // and makes the subsequent load's offset automatically correct 514 517 if (structure->isUsingInlineStorage()) 515 stubInfo->hotPathBegin.instructionAtOffset(patchOffsetGetByIdExternalLoad).repatchLoadPtrToLEA();518 repatchBuffer.repatchLoadPtrToLEA(stubInfo->hotPathBegin.instructionAtOffset(patchOffsetGetByIdExternalLoad)); 516 519 517 520 // Patch the offset into the propoerty map to load from, then patch the Structure to look for. 518 stubInfo->hotPathBegin.dataLabelPtrAtOffset(patchOffsetGetByIdStructure).repatch(structure);519 stubInfo->hotPathBegin.dataLabel32AtOffset(patchOffsetGetByIdPropertyMapOffset).repatch(offset);521 repatchBuffer.repatch(stubInfo->hotPathBegin.dataLabelPtrAtOffset(patchOffsetGetByIdStructure), structure); 522 repatchBuffer.repatch(stubInfo->hotPathBegin.dataLabel32AtOffset(patchOffsetGetByIdPropertyMapOffset), offset); 520 523 } 521 524 522 525 void JIT::patchMethodCallProto(MethodCallLinkInfo& methodCallLinkInfo, JSFunction* callee, Structure* structure, JSObject* proto) 523 526 { 527 RepatchBuffer repatchBuffer; 528 524 529 ASSERT(!methodCallLinkInfo.cachedStructure); 525 530 methodCallLinkInfo.cachedStructure = structure; 526 531 structure->ref(); 527 532 528 methodCallLinkInfo.structureLabel.repatch(structure);529 methodCallLinkInfo.structureLabel.dataLabelPtrAtOffset(patchOffsetMethodCheckProtoObj).repatch(proto);530 methodCallLinkInfo.structureLabel.dataLabelPtrAtOffset(patchOffsetMethodCheckProtoStruct).repatch(proto->structure());531 methodCallLinkInfo.structureLabel.dataLabelPtrAtOffset(patchOffsetMethodCheckPutFunction).repatch(callee);533 repatchBuffer.repatch(methodCallLinkInfo.structureLabel, structure); 534 repatchBuffer.repatch(methodCallLinkInfo.structureLabel.dataLabelPtrAtOffset(patchOffsetMethodCheckProtoObj), proto); 535 repatchBuffer.repatch(methodCallLinkInfo.structureLabel.dataLabelPtrAtOffset(patchOffsetMethodCheckProtoStruct), proto->structure()); 536 repatchBuffer.repatch(methodCallLinkInfo.structureLabel.dataLabelPtrAtOffset(patchOffsetMethodCheckPutFunction), callee); 532 537 } 533 538 534 539 void JIT::patchPutByIdReplace(StructureStubInfo* stubInfo, Structure* structure, size_t cachedOffset, ProcessorReturnAddress returnAddress) 535 540 { 541 RepatchBuffer repatchBuffer; 542 536 543 // We don't want to patch more than once - in future go to cti_op_put_by_id_generic. 537 544 // Should probably go to JITStubs::cti_op_put_by_id_fail, but that doesn't do anything interesting right now. 538 re turnAddress.relinkCallerToFunction(FunctionPtr(JITStubs::cti_op_put_by_id_generic));545 repatchBuffer.relinkCallerToFunction(returnAddress, FunctionPtr(JITStubs::cti_op_put_by_id_generic)); 539 546 540 547 int offset = sizeof(JSValue) * cachedOffset; … … 543 550 // and makes the subsequent load's offset automatically correct 544 551 if (structure->isUsingInlineStorage()) 545 stubInfo->hotPathBegin.instructionAtOffset(patchOffsetPutByIdExternalLoad).repatchLoadPtrToLEA();552 repatchBuffer.repatchLoadPtrToLEA(stubInfo->hotPathBegin.instructionAtOffset(patchOffsetPutByIdExternalLoad)); 546 553 547 554 // Patch the offset into the propoerty map to load from, then patch the Structure to look for. 548 stubInfo->hotPathBegin.dataLabelPtrAtOffset(patchOffsetPutByIdStructure).repatch(structure);549 stubInfo->hotPathBegin.dataLabel32AtOffset(patchOffsetPutByIdPropertyMapOffset).repatch(offset);555 repatchBuffer.repatch(stubInfo->hotPathBegin.dataLabelPtrAtOffset(patchOffsetPutByIdStructure), structure); 556 repatchBuffer.repatch(stubInfo->hotPathBegin.dataLabel32AtOffset(patchOffsetPutByIdPropertyMapOffset), offset); 550 557 } 551 558 … … 553 560 { 554 561 StructureStubInfo* stubInfo = &m_codeBlock->getStubInfo(returnAddress.addressForLookup()); 555 556 // We don't want to patch more than once - in future go to cti_op_put_by_id_generic.557 returnAddress.relinkCallerToFunction(FunctionPtr(JITStubs::cti_op_get_by_id_array_fail));558 562 559 563 // Check eax is an array … … 585 589 // Finally patch the jump to slow case back in the hot path to jump here instead. 586 590 CodeLocationJump jumpLocation = stubInfo->hotPathBegin.jumpAtOffset(patchOffsetGetByIdBranchToSlowCase); 587 jumpLocation.relink(entryLabel); 591 RepatchBuffer repatchBuffer; 592 repatchBuffer.relink(jumpLocation, entryLabel); 593 594 // We don't want to patch more than once - in future go to cti_op_put_by_id_generic. 595 repatchBuffer.relinkCallerToFunction(returnAddress, FunctionPtr(JITStubs::cti_op_get_by_id_array_fail)); 588 596 } 589 597 590 598 void JIT::privateCompileGetByIdProto(StructureStubInfo* stubInfo, Structure* structure, Structure* prototypeStructure, size_t cachedOffset, ProcessorReturnAddress returnAddress, CallFrame* callFrame) 591 599 { 592 // We don't want to patch more than once - in future go to cti_op_put_by_id_generic.593 returnAddress.relinkCallerToFunction(FunctionPtr(JITStubs::cti_op_get_by_id_proto_list));594 595 600 // The prototype object definitely exists (if this stub exists the CodeBlock is referencing a Structure that is 596 601 // referencing the prototype object - let's speculatively load it's table nice and early!) … … 630 635 // Finally patch the jump to slow case back in the hot path to jump here instead. 631 636 CodeLocationJump jumpLocation = stubInfo->hotPathBegin.jumpAtOffset(patchOffsetGetByIdBranchToSlowCase); 632 jumpLocation.relink(entryLabel); 637 RepatchBuffer repatchBuffer; 638 repatchBuffer.relink(jumpLocation, entryLabel); 639 640 // We don't want to patch more than once - in future go to cti_op_put_by_id_generic. 641 repatchBuffer.relinkCallerToFunction(returnAddress, FunctionPtr(JITStubs::cti_op_get_by_id_proto_list)); 633 642 } 634 643 … … 658 667 // Finally patch the jump to slow case back in the hot path to jump here instead. 659 668 CodeLocationJump jumpLocation = stubInfo->hotPathBegin.jumpAtOffset(patchOffsetGetByIdBranchToSlowCase); 660 jumpLocation.relink(entryLabel); 669 RepatchBuffer repatchBuffer; 670 repatchBuffer.relink(jumpLocation, entryLabel); 661 671 } 662 672 … … 702 712 // Finally patch the jump to slow case back in the hot path to jump here instead. 703 713 CodeLocationJump jumpLocation = stubInfo->hotPathBegin.jumpAtOffset(patchOffsetGetByIdBranchToSlowCase); 704 jumpLocation.relink(entryLabel); 714 RepatchBuffer repatchBuffer; 715 repatchBuffer.relink(jumpLocation, entryLabel); 705 716 } 706 717 … … 755 766 // Finally patch the jump to slow case back in the hot path to jump here instead. 756 767 CodeLocationJump jumpLocation = stubInfo->hotPathBegin.jumpAtOffset(patchOffsetGetByIdBranchToSlowCase); 757 jumpLocation.relink(entryLabel); 768 RepatchBuffer repatchBuffer; 769 repatchBuffer.relink(jumpLocation, entryLabel); 758 770 } 759 771 760 772 void JIT::privateCompileGetByIdChain(StructureStubInfo* stubInfo, Structure* structure, StructureChain* chain, size_t count, size_t cachedOffset, ProcessorReturnAddress returnAddress, CallFrame* callFrame) 761 773 { 762 // We don't want to patch more than once - in future go to cti_op_put_by_id_generic.763 returnAddress.relinkCallerToFunction(FunctionPtr(JITStubs::cti_op_get_by_id_proto_list));764 765 774 ASSERT(count); 766 775 … … 805 814 // Finally patch the jump to slow case back in the hot path to jump here instead. 806 815 CodeLocationJump jumpLocation = stubInfo->hotPathBegin.jumpAtOffset(patchOffsetGetByIdBranchToSlowCase); 807 jumpLocation.relink(entryLabel); 816 RepatchBuffer repatchBuffer; 817 repatchBuffer.relink(jumpLocation, entryLabel); 818 819 // We don't want to patch more than once - in future go to cti_op_put_by_id_generic. 820 repatchBuffer.relinkCallerToFunction(returnAddress, FunctionPtr(JITStubs::cti_op_get_by_id_proto_list)); 808 821 } 809 822
Note:
See TracChangeset
for help on using the changeset viewer.