Index: src/x64/deoptimizer-x64.cc |
diff --git a/src/x64/deoptimizer-x64.cc b/src/x64/deoptimizer-x64.cc |
index aee8be6e1bbda80cd9907508f46af8c1c9da6016..705da527257f51c98f603d62c63081e104e2f932 100644 |
--- a/src/x64/deoptimizer-x64.cc |
+++ b/src/x64/deoptimizer-x64.cc |
@@ -51,6 +51,26 @@ void Deoptimizer::PatchCodeForDeoptimization(Isolate* isolate, Code* code) { |
// code patching below, and is not needed any more. |
code->InvalidateRelocation(); |
+ if (FLAG_zap_code_space) { |
+ // Fail hard and early if we enter this code object again. |
+ byte* pointer = code->FindCodeAgeSequence(); |
+ if (pointer != NULL) { |
+ pointer += kNoCodeAgeSequenceLength; |
+ } else { |
+ pointer = code->instruction_start(); |
+ } |
+ CodePatcher patcher(pointer, 1); |
+ patcher.masm()->int3(); |
+ |
+ DeoptimizationInputData* data = |
+ DeoptimizationInputData::cast(code->deoptimization_data()); |
+ int osr_offset = data->OsrPcOffset()->value(); |
+ if (osr_offset > 0) { |
+ CodePatcher osr_patcher(code->instruction_start() + osr_offset, 1); |
+ osr_patcher.masm()->int3(); |
+ } |
+ } |
+ |
// For each LLazyBailout instruction insert a absolute call to the |
// corresponding deoptimization entry, or a short call to an absolute |
// jump if space is short. The absolute jumps are put in a table just |