Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(703)

Unified Diff: src/arm/assembler-arm-inl.h

Issue 1113002: Implement function calls on ARM using the blx instruction when available. Usi... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 10 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/arm/assembler-arm.cc ('k') | src/arm/constants-arm.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/arm/assembler-arm-inl.h
===================================================================
--- src/arm/assembler-arm-inl.h (revision 4189)
+++ src/arm/assembler-arm-inl.h (working copy)
@@ -144,12 +144,21 @@
bool RelocInfo::IsPatchedReturnSequence() {
- // On ARM a "call instruction" is actually two instructions.
- // mov lr, pc
- // ldr pc, [pc, #XXX]
- return (Assembler::instr_at(pc_) == kMovLrPc)
- && ((Assembler::instr_at(pc_ + Assembler::kInstrSize) & kLdrPCPattern)
- == kLdrPCPattern);
+ Instr current_instr = Assembler::instr_at(pc_);
+ Instr next_instr = Assembler::instr_at(pc_ + Assembler::kInstrSize);
+#ifdef USE_BLX
+ // A patched return sequence is:
+ // ldr ip, [pc, #0]
+ // blx ip
+ return ((current_instr & kLdrPCMask) == kLdrPCPattern)
+ && ((next_instr & kBlxRegMask) == kBlxRegPattern);
+#else
+ // A patched return sequence is:
+ // mov lr, pc
+ // ldr pc, [pc, #-4]
+ return (current_instr == kMovLrPc)
+ && ((next_instr & kLdrPCMask) == kLdrPCPattern);
+#endif
}
@@ -225,6 +234,16 @@
target_pc -= kInstrSize;
instr = Memory::int32_at(target_pc);
}
+
+#ifdef USE_BLX
+ // If we have a blx instruction, the instruction before it is
+ // what needs to be patched.
+ if ((instr & kBlxRegMask) == kBlxRegPattern) {
+ target_pc -= kInstrSize;
+ instr = Memory::int32_at(target_pc);
+ }
+#endif
+
// Verify that the instruction to patch is a
// ldr<cond> <Rd>, [pc +/- offset_12].
ASSERT((instr & 0x0f7f0000) == 0x051f0000);
« no previous file with comments | « src/arm/assembler-arm.cc ('k') | src/arm/constants-arm.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698