Index: src/deoptimizer.cc |
diff --git a/src/deoptimizer.cc b/src/deoptimizer.cc |
index e6742fe01be43f14f59193bd64671aa62981b428..f081576aa884e7d2b025c1ef5887a686751c9c9d 100644 |
--- a/src/deoptimizer.cc |
+++ b/src/deoptimizer.cc |
@@ -823,7 +823,26 @@ void Deoptimizer::PatchStackCheckCode(Code* unoptimized_code, |
for (uint32_t i = 0; i < table_length; ++i) { |
uint32_t pc_offset = Memory::uint32_at(stack_check_cursor + kIntSize); |
Address pc_after = unoptimized_code->instruction_start() + pc_offset; |
- PatchStackCheckAt(pc_after, check_code, replacement_code); |
+ PatchStackCheckCodeAt(pc_after, check_code, replacement_code); |
+ stack_check_cursor += 2 * kIntSize; |
+ } |
+} |
+ |
+ |
+void Deoptimizer::RevertStackCheckCode(Code* unoptimized_code, |
+ Code* check_code, |
+ Code* replacement_code) { |
+ // Iterate over the stack check table and revert the patched |
+ // stack check calls. |
+ ASSERT(unoptimized_code->kind() == Code::FUNCTION); |
+ Address stack_check_cursor = unoptimized_code->instruction_start() + |
+ unoptimized_code->stack_check_table_start(); |
+ uint32_t table_length = Memory::uint32_at(stack_check_cursor); |
+ stack_check_cursor += kIntSize; |
+ for (uint32_t i = 0; i < table_length; ++i) { |
+ uint32_t pc_offset = Memory::uint32_at(stack_check_cursor + kIntSize); |
+ Address pc_after = unoptimized_code->instruction_start() + pc_offset; |
+ RevertStackCheckCodeAt(pc_after, check_code, replacement_code); |
stack_check_cursor += 2 * kIntSize; |
} |
} |