Ensure that regexp code flushing correctly updates slots buffer.

Enable code compaction again.

R=erik.corry@gmail.com

Review URL: https://chromiumcodereview.appspot.com/9365019

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@10647 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
vegorov@chromium.org 2012-02-08 15:44:07 +00:00
parent 53c6838cce
commit 96baf602df
2 changed files with 11 additions and 1 deletions

View File

@ -302,7 +302,7 @@ DEFINE_bool(lazy_sweeping, true,
"Use lazy sweeping for old pointer and data spaces") "Use lazy sweeping for old pointer and data spaces")
DEFINE_bool(never_compact, false, DEFINE_bool(never_compact, false,
"Never perform compaction on full GC - testing only") "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") "Compact code space on full non-incremental collections")
DEFINE_bool(cleanup_code_caches_at_gc, true, DEFINE_bool(cleanup_code_caches_at_gc, true,
"Flush inline caches prior to mark compact collection and " "Flush inline caches prior to mark compact collection and "

View File

@ -1325,6 +1325,16 @@ class StaticMarkingVisitor : public StaticVisitorBase {
re->SetDataAtUnchecked(JSRegExp::saved_code_index(is_ascii), re->SetDataAtUnchecked(JSRegExp::saved_code_index(is_ascii),
code, code,
heap); 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. // Set a number in the 0-255 range to guarantee no smi overflow.
re->SetDataAtUnchecked(JSRegExp::code_index(is_ascii), re->SetDataAtUnchecked(JSRegExp::code_index(is_ascii),
Smi::FromInt(heap->sweep_generation() & 0xff), Smi::FromInt(heap->sweep_generation() & 0xff),