Chromium Code Reviews

Unified Diff: src/heap/heap.cc

Issue 1105693002: Implement IdentityMap<V>, a robust, GC-safe object-identity HashMap. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Index: src/heap/heap.cc
diff --git a/src/heap/heap.cc b/src/heap/heap.cc
index 4907030d5d09007bebe508ee27aeb51907dc095a..d938ad4cfc12d718128c957310b488a6c39debd7 100644
--- a/src/heap/heap.cc
+++ b/src/heap/heap.cc
@@ -141,7 +141,8 @@ Heap::Heap()
chunks_queued_for_free_(NULL),
gc_callbacks_depth_(0),
deserialization_complete_(false),
- concurrent_sweeping_enabled_(false) {
+ concurrent_sweeping_enabled_(false),
+ strong_roots_list_(NULL) {
// Allow build-time customization of the max semispace size. Building
// V8 with snapshots and a non-default max semispace size is much
// easier if you can define it as part of the build environment.
@@ -5030,6 +5031,9 @@ void Heap::IterateStrongRoots(ObjectVisitor* v, VisitMode mode) {
// output a flag to the snapshot. However at this point the serializer and
// deserializer are deliberately a little unsynchronized (see above) so the
// checking of the sync flag in the snapshot would fail.
+ for (StrongRootsList* list = strong_roots_list_; list; list = list->next_) {
Erik Corry 2015/04/28 15:27:31 We don't need a lock here?
+ v->VisitPointers(list->start_, list->end_);
+ }
}
@@ -5520,6 +5524,13 @@ void Heap::TearDown() {
store_buffer()->TearDown();
isolate_->memory_allocator()->TearDown();
+
+ StrongRootsList* next = NULL;
+ for (StrongRootsList* list = strong_roots_list_; list; list = next) {
+ next = list->next_;
+ delete list;
+ }
+ strong_roots_list_ = NULL;
}

Powered by Google App Engine