Do not cache object literal maps during bootstrapping.
authoryangguo <yangguo@chromium.org>
Tue, 5 May 2015 13:59:08 +0000 (06:59 -0700)
committerCommit bot <commit-bot@chromium.org>
Tue, 5 May 2015 14:17:44 +0000 (14:17 +0000)
We do not expect to share maps for object literals created by builtin
Javascript code.

R=ishell@chromium.org

Review URL: https://codereview.chromium.org/1127693009

Cr-Commit-Position: refs/heads/master@{#28224}

src/factory.cc

index 3df71b1..3632989 100644 (file)
@@ -2399,7 +2399,9 @@ Handle<Map> Factory::ObjectLiteralMapFromCache(Handle<Context> context,
                                                bool* is_result_from_cache) {
   const int kMapCacheSize = 128;
 
-  if (number_of_properties > kMapCacheSize) {
+  // We do not cache maps for too many properties or when running builtin code.
+  if (number_of_properties > kMapCacheSize ||
+      isolate()->bootstrapper()->IsActive()) {
     *is_result_from_cache = false;
     return Map::Create(isolate(), number_of_properties);
   }