Index: src/x64/deoptimizer-x64.cc |
diff --git a/src/x64/deoptimizer-x64.cc b/src/x64/deoptimizer-x64.cc |
index 9e312ef3838f406f0443abb6fd8f6a760e0e53f5..0733602f1a9f063ac33c10e5942e8544b9b0f671 100644 |
--- a/src/x64/deoptimizer-x64.cc |
+++ b/src/x64/deoptimizer-x64.cc |
@@ -204,6 +204,11 @@ void Deoptimizer::DeoptimizeFunction(JSFunction* function) { |
node->set_next(data->deoptimizing_code_list_); |
data->deoptimizing_code_list_ = node; |
+ // We might be in the middle of incremental marking with compaction. |
+ // Tell collector to treat this code object in a special way and |
+ // ignore all slots that might have been recorded on it. |
+ isolate->heap()->mark_compact_collector()->InvalidateCode(code); |
+ |
// Set the code for the function to non-optimized version. |
function->ReplaceCode(function->shared()->code()); |