Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(324)

Unified Diff: vm/gc_marker.cc

Issue 10797021: - Start using the collected store buffer entries to find (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/runtime/
Patch Set: Created 8 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « vm/code_generator.cc ('k') | vm/hash_set.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: vm/gc_marker.cc
===================================================================
--- vm/gc_marker.cc (revision 9784)
+++ vm/gc_marker.cc (working copy)
@@ -124,7 +124,8 @@
heap_(heap),
vm_heap_(Dart::vm_isolate()->heap()),
page_space_(page_space),
- marking_stack_(marking_stack) {
+ marking_stack_(marking_stack),
+ update_store_buffers_(false) {
ASSERT(heap_ != vm_heap_);
}
@@ -132,10 +133,12 @@
void VisitPointers(RawObject** first, RawObject** last) {
for (RawObject** current = first; current <= last; current++) {
- MarkObject(*current);
+ MarkObject(*current, current);
}
}
+ void set_update_store_buffers(bool val) { update_store_buffers_ = val; }
+
private:
void MarkAndPush(RawObject* raw_obj) {
ASSERT(raw_obj->IsHeapObject());
@@ -152,10 +155,10 @@
page->AddUsed(raw_obj->Size());
// TODO(iposva): Should we mark the classes early?
- MarkObject(raw_class);
+ MarkObject(raw_class, NULL);
}
- void MarkObject(RawObject* raw_obj) {
+ void MarkObject(RawObject* raw_obj, RawObject** p) {
// Fast exit if the raw object is a Smi.
if (!raw_obj->IsHeapObject()) return;
@@ -165,6 +168,10 @@
// Skip over new objects, but verify consistency of heap while at it.
if (raw_obj->IsNewObject()) {
// TODO(iposva): Add consistency check.
+ if (update_store_buffers_) {
+ ASSERT(p != NULL);
+ isolate()->store_buffer()->AddPointer(reinterpret_cast<uword>(p));
+ }
return;
}
@@ -177,6 +184,7 @@
Heap* vm_heap_;
PageSpace* page_space_;
MarkingStack* marking_stack_;
+ bool update_store_buffers_;
DISALLOW_IMPLICIT_CONSTRUCTORS(MarkingVisitor);
};
@@ -219,6 +227,9 @@
if (invoke_api_callbacks) {
isolate->gc_prologue_callbacks().Invoke();
}
+ // The store buffers will be rebuilt as part of marking, reset them now.
+ isolate->store_buffer()->Reset();
+ isolate->store_buffer_block()->Reset();
}
@@ -304,10 +315,12 @@
void GCMarker::DrainMarkingStack(Isolate* isolate,
MarkingVisitor* visitor) {
+ visitor->set_update_store_buffers(true);
while (!visitor->marking_stack()->IsEmpty()) {
RawObject* raw_obj = visitor->marking_stack()->Pop();
raw_obj->VisitPointers(visitor);
}
+ visitor->set_update_store_buffers(false);
}
« no previous file with comments | « vm/code_generator.cc ('k') | vm/hash_set.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698