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()), |