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

Unified Diff: src/heap.cc

Issue 4200009: Clear JS function result caches in all global contexts. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 10 years, 2 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 | « no previous file | src/objects-inl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/heap.cc
diff --git a/src/heap.cc b/src/heap.cc
index fc9086655201b970f92a4a01911be013eb23d9a7..b037efd80450e1df3aae746d286eb9068b4e4b39 100644
--- a/src/heap.cc
+++ b/src/heap.cc
@@ -581,25 +581,22 @@ void Heap::EnsureFromSpaceIsCommitted() {
}
-class ClearThreadJSFunctionResultCachesVisitor: public ThreadVisitor {
- virtual void VisitThread(ThreadLocalTop* top) {
- Context* context = top->context_;
- if (context == NULL) return;
+void Heap::ClearJSFunctionResultCaches() {
+ if (Bootstrapper::IsActive()) return;
+ Object* context = global_contexts_list_;
+ while (!context->IsUndefined()) {
+ // Get the caches for this context:
FixedArray* caches =
- context->global()->global_context()->jsfunction_result_caches();
+ Context::cast(context)->jsfunction_result_caches();
+ // Clear the caches:
int length = caches->length();
for (int i = 0; i < length; i++) {
JSFunctionResultCache::cast(caches->get(i))->Clear();
}
+ // Get the next context:
+ context = Context::cast(context)->get(Context::NEXT_CONTEXT_LINK);
}
-};
-
-
-void Heap::ClearJSFunctionResultCaches() {
- if (Bootstrapper::IsActive()) return;
- ClearThreadJSFunctionResultCachesVisitor visitor;
- ThreadManager::IterateArchivedThreads(&visitor);
}
« no previous file with comments | « no previous file | src/objects-inl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698