Changeset 52977 in webkit for trunk/JavaScriptCore/assembler/ARMAssembler.cpp
- Timestamp:
- Jan 8, 2010, 12:01:40 AM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/assembler/ARMAssembler.cpp
r52797 r52977 35 35 // Patching helpers 36 36 37 ARMWord* ARMAssembler::getLdrImmAddress(ARMWord* insn, uint32_t* constPool)38 {39 // Must be an ldr ..., [pc +/- imm]40 ASSERT((*insn & 0x0f7f0000) == 0x051f0000);41 42 if (constPool && (*insn & 0x1))43 return reinterpret_cast<ARMWord*>(constPool + ((*insn & SDT_OFFSET_MASK) >> 1));44 45 ARMWord addr = reinterpret_cast<ARMWord>(insn) + 2 * sizeof(ARMWord);46 if (*insn & DT_UP)47 return reinterpret_cast<ARMWord*>(addr + (*insn & SDT_OFFSET_MASK));48 else49 return reinterpret_cast<ARMWord*>(addr - (*insn & SDT_OFFSET_MASK));50 }51 52 void ARMAssembler::linkBranch(void* code, JmpSrc from, void* to, int useConstantPool)53 {54 ARMWord* insn = reinterpret_cast<ARMWord*>(code) + (from.m_offset / sizeof(ARMWord));55 56 if (!useConstantPool) {57 int diff = reinterpret_cast<ARMWord*>(to) - reinterpret_cast<ARMWord*>(insn + 2);58 59 if ((diff <= BOFFSET_MAX && diff >= BOFFSET_MIN)) {60 *insn = B | getConditionalField(*insn) | (diff & BRANCH_MASK);61 ExecutableAllocator::cacheFlush(insn, sizeof(ARMWord));62 return;63 }64 }65 ARMWord* addr = getLdrImmAddress(insn);66 *addr = reinterpret_cast<ARMWord>(to);67 ExecutableAllocator::cacheFlush(addr, sizeof(ARMWord));68 }69 70 37 void ARMAssembler::patchConstantPoolLoad(void* loadAddr, void* constPoolAddr) 71 38 { … … 389 356 int pos = (*iter) & (~0x1); 390 357 ARMWord* ldrAddr = reinterpret_cast<ARMWord*>(data + pos); 391 ARMWord offset = *getLdrImmAddress(ldrAddr); 392 if (offset != 0xffffffff) { 393 JmpSrc jmpSrc(pos); 394 linkBranch(data, jmpSrc, data + offset, ((*iter) & 1)); 358 ARMWord* addr = getLdrImmAddress(ldrAddr); 359 if (*addr != 0xffffffff) { 360 if (!(*iter & 1)) { 361 int diff = reinterpret_cast<ARMWord*>(data + *addr) - (ldrAddr + DefaultPrefetching); 362 363 if ((diff <= BOFFSET_MAX && diff >= BOFFSET_MIN)) { 364 *ldrAddr = B | getConditionalField(*ldrAddr) | (diff & BRANCH_MASK); 365 continue; 366 } 367 } 368 *addr = reinterpret_cast<ARMWord>(data + *addr); 395 369 } 396 370 }
Note:
See TracChangeset
for help on using the changeset viewer.