Index: runtime/vm/code_patcher_x64.cc |
diff --git a/runtime/vm/code_patcher_x64.cc b/runtime/vm/code_patcher_x64.cc |
index 8e3e8898fd99f5bc7c35c912241310cabefa1f6e..0e18f6f046672c96a3ed6ce8403c38999f1e7616 100644 |
--- a/runtime/vm/code_patcher_x64.cc |
+++ b/runtime/vm/code_patcher_x64.cc |
@@ -293,8 +293,13 @@ intptr_t CodePatcher::InstanceCallSizeInBytes() { |
} |
-void CodePatcher::InsertDeoptimizationCallAt(uword start) { |
- UNREACHABLE(); |
+void CodePatcher::InsertDeoptimizationCallAt(uword start, uword target) { |
+ // The inserted call should not overlap the lazy deopt jump code. |
+ ASSERT(start + ShortCallPattern::pattern_length_in_bytes() <= target); |
+ *reinterpret_cast<uint8_t*>(start) = 0xE8; |
+ ShortCallPattern call(start); |
+ call.SetTargetAddress(target); |
+ CPU::FlushICache(start, ShortCallPattern::pattern_length_in_bytes()); |
} |