Reviewers: Erik Corry,

Description:
Ensure that regexp code flushing correctly updates slots buffer.

Enable code compaction again.

[email protected]


Please review this at https://chromiumcodereview.appspot.com/9365019/

SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge

Affected files:
  M src/flag-definitions.h
  M src/mark-compact.cc


Index: src/flag-definitions.h
diff --git a/src/flag-definitions.h b/src/flag-definitions.h
index 50086fb7f45dad6bfcabe2f2fed00df7fb41c345..b1bd74b8fc8f5ba15ae7f31389e16221f917c21e 100644
--- a/src/flag-definitions.h
+++ b/src/flag-definitions.h
@@ -307,7 +307,7 @@ DEFINE_bool(cleanup_caches_in_maps_at_gc, true,
             "Flush code caches in maps during mark compact cycle.")
 DEFINE_bool(never_compact, false,
             "Never perform compaction on full GC - testing only")
-DEFINE_bool(compact_code_space, false,
+DEFINE_bool(compact_code_space, true,
             "Compact code space on full non-incremental collections")
 DEFINE_bool(cleanup_code_caches_at_gc, true,
             "Flush inline caches prior to mark compact collection and "
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),


--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev

Reply via email to