Index: src/x64/deoptimizer-x64.cc |
diff --git a/src/x64/deoptimizer-x64.cc b/src/x64/deoptimizer-x64.cc |
index e9cf567f7e44d1aaa52653b03286ced8ad09f464..33d4f4dd585ec1ae64503434785606250ce64a70 100644 |
--- a/src/x64/deoptimizer-x64.cc |
+++ b/src/x64/deoptimizer-x64.cc |
@@ -105,12 +105,7 @@ static const byte kNopByteTwo = 0x90; |
void Deoptimizer::PatchInterruptCodeAt(Code* unoptimized_code, |
Address pc_after, |
- Code* interrupt_code, |
Code* replacement_code) { |
- ASSERT(!InterruptCodeIsPatched(unoptimized_code, |
- pc_after, |
- interrupt_code, |
- replacement_code)); |
// Turn the jump into nops. |
Address call_target_address = pc_after - kIntSize; |
*(call_target_address - 3) = kNopByteOne; |
@@ -126,12 +121,7 @@ void Deoptimizer::PatchInterruptCodeAt(Code* unoptimized_code, |
void Deoptimizer::RevertInterruptCodeAt(Code* unoptimized_code, |
Address pc_after, |
- Code* interrupt_code, |
- Code* replacement_code) { |
- ASSERT(InterruptCodeIsPatched(unoptimized_code, |
- pc_after, |
- interrupt_code, |
- replacement_code)); |
+ Code* interrupt_code) { |
// Restore the original jump. |
Address call_target_address = pc_after - kIntSize; |
*(call_target_address - 3) = kJnsInstruction; |
@@ -146,23 +136,29 @@ void Deoptimizer::RevertInterruptCodeAt(Code* unoptimized_code, |
#ifdef DEBUG |
-bool Deoptimizer::InterruptCodeIsPatched(Code* unoptimized_code, |
- Address pc_after, |
- Code* interrupt_code, |
- Code* replacement_code) { |
+Deoptimizer::InterruptPatchState Deoptimizer::GetInterruptPatchState( |
+ Isolate* isolate, |
+ Code* unoptimized_code, |
+ Address pc_after) { |
Address call_target_address = pc_after - kIntSize; |
ASSERT_EQ(kCallInstruction, *(call_target_address - 1)); |
if (*(call_target_address - 3) == kNopByteOne) { |
- ASSERT(replacement_code->entry() == |
- Assembler::target_address_at(call_target_address)); |
ASSERT_EQ(kNopByteTwo, *(call_target_address - 2)); |
- return true; |
+ Code* osr_builtin = |
+ isolate->builtins()->builtin(Builtins::kOnStackReplacement); |
+ ASSERT_EQ(osr_builtin->entry(), |
+ Assembler::target_address_at(call_target_address)); |
+ return PATCHED_FOR_OSR; |
} else { |
+ // Get the interrupt stub code object to match against from cache. |
+ Code* interrupt_code = NULL; |
+ InterruptStub stub; |
+ if (!stub.FindCodeInCache(&interrupt_code, isolate)) UNREACHABLE(); |
ASSERT_EQ(interrupt_code->entry(), |
Assembler::target_address_at(call_target_address)); |
ASSERT_EQ(kJnsInstruction, *(call_target_address - 3)); |
ASSERT_EQ(kJnsOffset, *(call_target_address - 2)); |
- return false; |
+ return NOT_PATCHED; |
} |
} |
#endif // DEBUG |