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

Unified Diff: src/heap/incremental-marking.cc

Issue 2771703003: Revert of [heap] Simplify clearing of normalized map caches. (Closed)
Patch Set: Created 3 years, 9 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 | « src/heap/heap.cc ('k') | src/heap/objects-visiting-inl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/heap/incremental-marking.cc
diff --git a/src/heap/incremental-marking.cc b/src/heap/incremental-marking.cc
index a124fd3ba99609da4c61615103c1608a0358d507..3477261721b29ab74f192d10dc1a95ecb41631c1 100644
--- a/src/heap/incremental-marking.cc
+++ b/src/heap/incremental-marking.cc
@@ -153,6 +153,7 @@
static void Initialize() {
StaticMarkingVisitor<IncrementalMarkingMarkingVisitor>::Initialize();
table_.Register(kVisitFixedArray, &VisitFixedArrayIncremental);
+ table_.Register(kVisitNativeContext, &VisitNativeContextIncremental);
}
static const int kProgressBarScanningChunk = 32 * 1024;
@@ -198,6 +199,26 @@
}
}
+ static void VisitNativeContextIncremental(Map* map, HeapObject* object) {
+ Context* context = Context::cast(object);
+
+ // We will mark cache black with a separate pass when we finish marking.
+ // Note that GC can happen when the context is not fully initialized,
+ // so the cache can be undefined.
+ Object* cache = context->get(Context::NORMALIZED_MAP_CACHE_INDEX);
+ if (!cache->IsUndefined(map->GetIsolate())) {
+ if (cache->IsHeapObject()) {
+ HeapObject* heap_obj = HeapObject::cast(cache);
+ // Mark the object grey if it is white, do not enque it into the marking
+ // deque.
+ if (ObjectMarking::IsWhite(heap_obj)) {
+ ObjectMarking::WhiteToGrey(heap_obj);
+ }
+ }
+ }
+ VisitNativeContext(map, context);
+ }
+
INLINE(static void VisitPointer(Heap* heap, HeapObject* object, Object** p)) {
Object* target = *p;
if (target->IsHeapObject()) {
« no previous file with comments | « src/heap/heap.cc ('k') | src/heap/objects-visiting-inl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698