Revision: 9216
Author: [email protected]
Date: Sat Sep 10 07:48:09 2011
Log: Fix two bugs in the code compaction:
1) Ensure that pc_to_code cache can iterate heap in the middle of
compaction.
2) Increase precision of code target patching write-barrier. We shoould
never record reloc slots on white objects because they might die and
evacuation will overwrite their contents invalidating collected reloc slots
as their positions are not aligned in the code stream.
3) remove bogus assertion.
[email protected]
BUG=
TEST=
Review URL: http://codereview.chromium.org/7864025
http://code.google.com/p/v8/source/detail?r=9216
Modified:
/branches/experimental/gc/src/frames.cc
/branches/experimental/gc/src/heap.cc
/branches/experimental/gc/src/incremental-marking.cc
/branches/experimental/gc/src/mark-compact.cc
=======================================
--- /branches/experimental/gc/src/frames.cc Wed Aug 3 09:10:10 2011
+++ /branches/experimental/gc/src/frames.cc Sat Sep 10 07:48:09 2011
@@ -1160,6 +1160,14 @@
ASSERT(code != NULL && code->contains(pc));
return code;
}
+
+
+static int GcSafeSizeOfCodeSpaceObject(HeapObject* object) {
+ MapWord map_word = object->map_word();
+ Map* map = map_word.IsForwardingAddress() ?
+ map_word.ToForwardingAddress()->map() : map_word.ToMap();
+ return object->SizeFromMap(map);
+}
Code* PcToCodeCache::GcSafeFindCodeForPc(Address pc) {
@@ -1171,7 +1179,7 @@
// Iterate through the page until we reach the end or find an object
starting
// after the pc.
Page* page = Page::FromAddress(pc);
- HeapObjectIterator iterator(page, heap->GcSafeSizeOfOldObjectFunction());
+ HeapObjectIterator iterator(page, &GcSafeSizeOfCodeSpaceObject);
HeapObject* previous = NULL;
while (true) {
HeapObject* next = iterator.Next();
=======================================
--- /branches/experimental/gc/src/heap.cc Mon Aug 29 05:23:10 2011
+++ /branches/experimental/gc/src/heap.cc Sat Sep 10 07:48:09 2011
@@ -4739,8 +4739,7 @@
// Iterate over the builtin code objects and code stubs in the
// heap. Note that it is not necessary to iterate over code objects
// on scavenge collections.
- if (mode != VISIT_ALL_IN_SCAVENGE &&
- mode != VISIT_ALL_IN_SWEEP_NEWSPACE) {
+ if (mode != VISIT_ALL_IN_SCAVENGE) {
isolate_->builtins()->IterateBuiltins(v);
}
v->Synchronize("builtins");
=======================================
--- /branches/experimental/gc/src/incremental-marking.cc Tue Sep 6
08:11:38 2011
+++ /branches/experimental/gc/src/incremental-marking.cc Sat Sep 10
07:48:09 2011
@@ -86,20 +86,10 @@
void IncrementalMarking::RecordCodeTargetPatch(Address pc, HeapObject*
value) {
if (IsMarking()) {
- ASSERT(!MarkCompactCollector::IsOnEvacuationCandidate(value));
-
- MarkBit value_bit = Marking::MarkBitFrom(value);
- if (Marking::IsWhite(value_bit)) {
- WhiteToGreyAndPush(value, value_bit);
- RestartIfNotMarking();
- }
-
-
- if (is_compacting_) {
- RelocInfo rinfo(pc, RelocInfo::CODE_TARGET, NULL, NULL);
- heap_->mark_compact_collector()->RecordRelocSlot(&rinfo,
- Code::cast(value));
- }
+ Code* host =
+ heap_->isolate()->pc_to_code_cache()->GcSafeFindCodeForPc(pc);
+ RelocInfo rinfo(pc, RelocInfo::CODE_TARGET, NULL, host);
+ RecordWriteIntoCode(host, &rinfo, value);
}
}
=======================================
--- /branches/experimental/gc/src/mark-compact.cc Thu Sep 8 05:15:24 2011
+++ /branches/experimental/gc/src/mark-compact.cc Sat Sep 10 07:48:09 2011
@@ -2837,7 +2837,8 @@
&UpdateReferenceInExternalStringTableEntry);
// Update JSFunction pointers from the runtime profiler.
- heap_->isolate()->runtime_profiler()->UpdateSamplesAfterScavenge();
+ heap()->isolate()->runtime_profiler()->UpdateSamplesAfterCompact(
+ &updating_visitor);
EvacuationWeakObjectRetainer evacuation_object_retainer;
heap()->ProcessWeakReferences(&evacuation_object_retainer);
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev