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

Unified Diff: src/heap.cc

Issue 1780001: Clean JS function results cache on each major GC. (Closed)
Patch Set: Reoworking the test Created 10 years, 8 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.h ('k') | src/objects.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 55d6c97bedcdb94d5d2a03dbd0204f337b9479fe..193f082f355cb1bac86df83e06e7608bb05f2ad2 100644
--- a/src/heap.cc
+++ b/src/heap.cc
@@ -306,6 +306,7 @@ void Heap::ReportStatisticsAfterGC() {
void Heap::GarbageCollectionPrologue() {
TranscendentalCache::Clear();
+ ClearJSFunctionResultCaches();
gc_count_++;
unflattened_strings_length_ = 0;
#ifdef DEBUG
@@ -541,6 +542,28 @@ void Heap::EnsureFromSpaceIsCommitted() {
}
+class ClearThreadJSFunctionResultCachesVisitor: public ThreadVisitor {
+ virtual void VisitThread(ThreadLocalTop* top) {
+ Context* context = top->context_;
+ if (context == NULL) return;
+
+ FixedArray* caches =
+ context->global()->global_context()->jsfunction_result_caches();
+ int length = caches->length();
+ for (int i = 0; i < length; i++) {
+ JSFunctionResultCache::cast(caches->get(i))->Clear();
+ }
+ }
+};
+
+
+void Heap::ClearJSFunctionResultCaches() {
+ if (Bootstrapper::IsActive()) return;
+ ClearThreadJSFunctionResultCachesVisitor visitor;
+ ThreadManager::IterateThreads(&visitor);
+}
+
+
void Heap::PerformGarbageCollection(AllocationSpace space,
GarbageCollector collector,
GCTracer* tracer) {
« no previous file with comments | « src/heap.h ('k') | src/objects.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698