Index: src/arm/deoptimizer-arm.cc |
diff --git a/src/arm/deoptimizer-arm.cc b/src/arm/deoptimizer-arm.cc |
index d9a4d4b0f41e3083a39f4c3a10486ae3cd5f2528..a9fa061815eb1ebb9a701d7275624b490e4da0c0 100644 |
--- a/src/arm/deoptimizer-arm.cc |
+++ b/src/arm/deoptimizer-arm.cc |
@@ -108,6 +108,10 @@ void Deoptimizer::DeoptimizeFunction(JSFunction* function) { |
} |
+static const int32_t kBranchBeforeStackCheck = 0x2a000001; |
+static const int32_t kBranchBeforeInterrupt = 0x5a000004; |
Erik Corry
2012/03/23 09:55:53
There is a bunch of these in assembler-arm.h eg kM
Jakob Kummerow
2012/03/23 12:07:32
I disagree. They contain condition codes and jump
|
+ |
+ |
void Deoptimizer::PatchStackCheckCodeAt(Code* unoptimized_code, |
Address pc_after, |
Code* check_code, |
@@ -122,6 +126,13 @@ void Deoptimizer::PatchStackCheckCodeAt(Code* unoptimized_code, |
(al | B24 | B21 | 15*B16 | 15*B12 | 15*B8 | BLX | ip.code())); |
ASSERT(Assembler::IsLdrPcImmediateOffset( |
Assembler::instr_at(pc_after - 2 * kInstrSize))); |
+ if (FLAG_count_based_interrupts) { |
+ ASSERT_EQ(kBranchBeforeInterrupt, |
+ Memory::int32_at(pc_after - 3 * kInstrSize)); |
+ } else { |
+ ASSERT_EQ(kBranchBeforeStackCheck, |
+ Memory::int32_at(pc_after - 3 * kInstrSize)); |
+ } |
// We patch the code to the following form: |
// e1 5d 00 0c cmp sp, <limit> |
@@ -155,13 +166,22 @@ void Deoptimizer::RevertStackCheckCodeAt(Code* unoptimized_code, |
Code* check_code, |
Code* replacement_code) { |
const int kInstrSize = Assembler::kInstrSize; |
- ASSERT(Memory::uint32_at(pc_after - kInstrSize) == 0xe12fff3c); |
- ASSERT(Memory::uint8_at(pc_after - kInstrSize - 1) == 0xe5); |
- ASSERT(Memory::uint8_at(pc_after - kInstrSize - 2) == 0x9f); |
+ ASSERT(Memory::int32_at(pc_after - kInstrSize) == |
+ (al | B24 | B21 | 15*B16 | 15*B12 | 15*B8 | BLX | ip.code())); |
Erik Corry
2012/03/23 09:55:53
What is this instruction?
Jakob Kummerow
2012/03/23 12:07:32
"blx ip", copied from above in the interest of uni
|
+ ASSERT(Assembler::IsLdrPcImmediateOffset( |
+ Assembler::instr_at(pc_after - 2 * kInstrSize))); |
// Replace NOP with conditional jump. |
CodePatcher patcher(pc_after - 3 * kInstrSize, 1); |
- patcher.masm()->b(+4, cs); |
+ if (FLAG_count_based_interrupts) { |
+ patcher.masm()->b(+16, pl); |
+ ASSERT_EQ(kBranchBeforeInterrupt, |
+ Memory::int32_at(pc_after - 3 * kInstrSize)); |
+ } else { |
+ patcher.masm()->b(+4, cs); |
+ ASSERT_EQ(kBranchBeforeStackCheck, |
+ Memory::int32_at(pc_after - 3 * kInstrSize)); |
+ } |
// Replace the stack check address in the constant pool |
// with the entry address of the replacement code. |