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

Unified Diff: src/factory.cc

Issue 7285031: Remove unmarked entries from per context map caches. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 9 years, 6 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/contexts.h ('k') | src/mark-compact.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/factory.cc
diff --git a/src/factory.cc b/src/factory.cc
index fcf07092b77f2964c058bb39c3965fb43916c681..dbc13af01d4f9296a287c7d48e4d78cec3e7f3db 100644
--- a/src/factory.cc
+++ b/src/factory.cc
@@ -1168,6 +1168,12 @@ MUST_USE_RESULT static MaybeObject* UpdateMapCacheWith(Context* context,
if (!maybe_result->ToObject(&result)) return maybe_result;
}
context->set_map_cache(MapCache::cast(result));
+ StatsCounter* counter =
+ Isolate::Current()->counters()->max_map_cache_length();
+ int length = FixedArray::cast(result)->length();
+ if (counter->Enabled() && (*counter->GetInternalPointer()) < length) {
+ counter->Set(length);
+ }
return result;
}
@@ -1191,7 +1197,11 @@ Handle<Map> Factory::ObjectLiteralMapFromCache(Handle<Context> context,
Handle<MapCache> cache =
Handle<MapCache>(MapCache::cast(context->map_cache()));
Handle<Object> result = Handle<Object>(cache->Lookup(*keys));
- if (result->IsMap()) return Handle<Map>::cast(result);
+ if (result->IsMap()) {
+ Isolate::Current()->counters()->map_cache_hits()->Increment();
+ return Handle<Map>::cast(result);
+ }
+ Isolate::Current()->counters()->map_cache_misses()->Increment();
// Create a new map and add it to the cache.
Handle<Map> map =
CopyMap(Handle<Map>(context->object_function()->initial_map()),
« no previous file with comments | « src/contexts.h ('k') | src/mark-compact.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698