Index: src/mark-compact.cc |
diff --git a/src/mark-compact.cc b/src/mark-compact.cc |
index 40333fe1f838037fe4822f067a010fbc1032045a..2661a83c50d5024af1b60b41195aa273235cffdb 100644 |
--- a/src/mark-compact.cc |
+++ b/src/mark-compact.cc |
@@ -1325,6 +1325,16 @@ class StaticMarkingVisitor : public StaticVisitorBase { |
re->SetDataAtUnchecked(JSRegExp::saved_code_index(is_ascii), |
code, |
heap); |
+ |
+ // Saving a copy might create a pointer into compaction candidate |
+ // that was not observed by marker. This might happen if JSRegExp data |
+ // was marked through the compilation cache before marker reached JSRegExp |
+ // object. |
+ FixedArray* data = FixedArray::cast(re->data()); |
+ Object** slot = data->data_start() + JSRegExp::saved_code_index(is_ascii); |
+ heap->mark_compact_collector()-> |
+ RecordSlot(slot, slot, code); |
+ |
// Set a number in the 0-255 range to guarantee no smi overflow. |
re->SetDataAtUnchecked(JSRegExp::code_index(is_ascii), |
Smi::FromInt(heap->sweep_generation() & 0xff), |