Changeset 52977 in webkit for trunk/JavaScriptCore/assembler/ARMAssembler.h
- Timestamp:
- Jan 8, 2010, 12:01:40 AM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/assembler/ARMAssembler.h
r52797 r52977 184 184 185 185 static const ARMWord INVALID_IMM = 0xf0000000; 186 static const int DefaultPrefetching = 2; 186 187 187 188 class JmpSrc { … … 633 634 // Patching helpers 634 635 635 static ARMWord* getLdrImmAddress(ARMWord* insn, uint32_t* constPool = 0); 636 static void linkBranch(void* code, JmpSrc from, void* to, int useConstantPool = 0); 636 static ARMWord* getLdrImmAddress(ARMWord* insn) 637 { 638 // Must be an ldr ..., [pc +/- imm] 639 ASSERT((*insn & 0x0f7f0000) == 0x051f0000); 640 641 ARMWord addr = reinterpret_cast<ARMWord>(insn) + DefaultPrefetching * sizeof(ARMWord); 642 if (*insn & DT_UP) 643 return reinterpret_cast<ARMWord*>(addr + (*insn & SDT_OFFSET_MASK)); 644 return reinterpret_cast<ARMWord*>(addr - (*insn & SDT_OFFSET_MASK)); 645 } 646 647 static ARMWord* getLdrImmAddressOnPool(ARMWord* insn, uint32_t* constPool) 648 { 649 // Must be an ldr ..., [pc +/- imm] 650 ASSERT((*insn & 0x0f7f0000) == 0x051f0000); 651 652 if (*insn & 0x1) 653 return reinterpret_cast<ARMWord*>(constPool + ((*insn & SDT_OFFSET_MASK) >> 1)); 654 return getLdrImmAddress(insn); 655 } 637 656 638 657 static void patchPointerInternal(intptr_t from, void* to) … … 641 660 ARMWord* addr = getLdrImmAddress(insn); 642 661 *addr = reinterpret_cast<ARMWord>(to); 643 ExecutableAllocator::cacheFlush(addr, sizeof(ARMWord));644 662 } 645 663 … … 686 704 { 687 705 ARMWord* insn = reinterpret_cast<ARMWord*>(m_buffer.data()) + (from.m_offset / sizeof(ARMWord)); 688 *getLdrImmAddress(insn, m_buffer.poolAddress()) = static_cast<ARMWord>(to.m_offset); 706 ARMWord* addr = getLdrImmAddressOnPool(insn, m_buffer.poolAddress()); 707 *addr = static_cast<ARMWord>(to.m_offset); 689 708 } 690 709 691 710 static void linkJump(void* code, JmpSrc from, void* to) 692 711 { 693 linkBranch(code, from, to);712 patchPointerInternal(reinterpret_cast<intptr_t>(code) + from.m_offset, to); 694 713 } 695 714 … … 701 720 static void linkCall(void* code, JmpSrc from, void* to) 702 721 { 703 linkBranch(code, from, to, true);722 patchPointerInternal(reinterpret_cast<intptr_t>(code) + from.m_offset, to); 704 723 } 705 724 706 725 static void relinkCall(void* from, void* to) 707 726 { 708 relinkJump(from, to);727 patchPointerInternal(reinterpret_cast<intptr_t>(from) - sizeof(ARMWord), to); 709 728 } 710 729
Note:
See TracChangeset
for help on using the changeset viewer.