Index: src/ia32/deoptimizer-ia32.cc |
diff --git a/src/ia32/deoptimizer-ia32.cc b/src/ia32/deoptimizer-ia32.cc |
index 313b65f6e2168fe4fd0371083d103a90f493b83b..b3668f3c335ff932b19c6325bd090e42e9ba782a 100644 |
--- a/src/ia32/deoptimizer-ia32.cc |
+++ b/src/ia32/deoptimizer-ia32.cc |
@@ -206,6 +206,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()); |