Clear normalized map caches in all global contexts not just in those reachable from...
authorvegorov@chromium.org <vegorov@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Tue, 19 Oct 2010 08:14:41 +0000 (08:14 +0000)
committervegorov@chromium.org <vegorov@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Tue, 19 Oct 2010 08:14:41 +0000 (08:14 +0000)
Issue reported by Mark Lam <mark.lam@palm.com> from Hewlett-Packard Development Company, LP.

Review URL: http://codereview.chromium.org/3828011

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@5654 ce2b1a6d-e550-0410-aec6-3dcde31c8c00

src/heap.cc

index de0c294..d0f1f95 100644 (file)
@@ -606,19 +606,14 @@ void Heap::ClearJSFunctionResultCaches() {
 }
 
 
-class ClearThreadNormalizedMapCachesVisitor: public ThreadVisitor {
-  virtual void VisitThread(ThreadLocalTop* top) {
-    Context* context = top->context_;
-    if (context == NULL) return;
-    context->global()->global_context()->normalized_map_cache()->Clear();
-  }
-};
-
-
 void Heap::ClearNormalizedMapCaches() {
   if (Bootstrapper::IsActive()) return;
-  ClearThreadNormalizedMapCachesVisitor visitor;
-  ThreadManager::IterateArchivedThreads(&visitor);
+
+  Object* context = global_contexts_list_;
+  while (!context->IsUndefined()) {
+    Context::cast(context)->normalized_map_cache()->Clear();
+    context = Context::cast(context)->get(Context::NEXT_CONTEXT_LINK);
+  }
 }