Index: src/arm/full-codegen-arm.cc |
diff --git a/src/arm/full-codegen-arm.cc b/src/arm/full-codegen-arm.cc |
index 751854591bd3bd0894d629d299def0de09adb691..5e4cc19569bead02d9d3e384592cd6920df99027 100644 |
--- a/src/arm/full-codegen-arm.cc |
+++ b/src/arm/full-codegen-arm.cc |
@@ -168,10 +168,20 @@ void FullCodeGenerator::Generate() { |
masm_, kNoCodeAgeSequenceLength * Assembler::kInstrSize); |
// The following three instructions must remain together and unmodified |
// for code aging to work properly. |
- __ stm(db_w, sp, r1.bit() | cp.bit() | fp.bit() | lr.bit()); |
- __ nop(ip.code()); |
- // Adjust FP to point to saved FP. |
- __ add(fp, sp, Operand(2 * kPointerSize)); |
+ if (FLAG_optimize_for_size) { |
+ // Pre-age the code. |
+ Code* stub = Code::GetPreAgedCodeAgeStub(isolate()); |
+ __ add(r0, pc, Operand(-8)); |
+ __ ldr(pc, MemOperand(pc, -4)); |
+ __ dd(reinterpret_cast<uint32_t>(stub->instruction_start())); |
+ } else { |
+ // The following three instructions must remain together and unmodified |
+ // for code aging to work properly. |
+ __ stm(db_w, sp, r1.bit() | cp.bit() | fp.bit() | lr.bit()); |
+ __ nop(ip.code()); |
+ // Adjust FP to point to saved FP. |
+ __ add(fp, sp, Operand(2 * kPointerSize)); |
+ } |
} |
info->AddNoFrameRange(0, masm_->pc_offset()); |