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

Side by Side Diff: src/factory.cc

Issue 1127693009: Do not cache object literal maps during bootstrapping. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 7 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/factory.h" 5 #include "src/factory.h"
6 6
7 #include "src/allocation-site-scopes.h" 7 #include "src/allocation-site-scopes.h"
8 #include "src/base/bits.h" 8 #include "src/base/bits.h"
9 #include "src/bootstrapper.h" 9 #include "src/bootstrapper.h"
10 #include "src/conversions.h" 10 #include "src/conversions.h"
(...skipping 2381 matching lines...) Expand 10 before | Expand all | Expand 10 after
2392 Handle<Map> map = NewMap(JS_WEAK_MAP_TYPE, JSWeakMap::kSize); 2392 Handle<Map> map = NewMap(JS_WEAK_MAP_TYPE, JSWeakMap::kSize);
2393 return Handle<JSWeakMap>::cast(NewJSObjectFromMap(map)); 2393 return Handle<JSWeakMap>::cast(NewJSObjectFromMap(map));
2394 } 2394 }
2395 2395
2396 2396
2397 Handle<Map> Factory::ObjectLiteralMapFromCache(Handle<Context> context, 2397 Handle<Map> Factory::ObjectLiteralMapFromCache(Handle<Context> context,
2398 int number_of_properties, 2398 int number_of_properties,
2399 bool* is_result_from_cache) { 2399 bool* is_result_from_cache) {
2400 const int kMapCacheSize = 128; 2400 const int kMapCacheSize = 128;
2401 2401
2402 if (number_of_properties > kMapCacheSize) { 2402 // We do not cache maps for too many properties or when running builtin code.
2403 if (number_of_properties > kMapCacheSize ||
2404 isolate()->bootstrapper()->IsActive()) {
2403 *is_result_from_cache = false; 2405 *is_result_from_cache = false;
2404 return Map::Create(isolate(), number_of_properties); 2406 return Map::Create(isolate(), number_of_properties);
2405 } 2407 }
2406 *is_result_from_cache = true; 2408 *is_result_from_cache = true;
2407 if (number_of_properties == 0) { 2409 if (number_of_properties == 0) {
2408 // Reuse the initial map of the Object function if the literal has no 2410 // Reuse the initial map of the Object function if the literal has no
2409 // predeclared properties. 2411 // predeclared properties.
2410 return handle(context->object_function()->initial_map(), isolate()); 2412 return handle(context->object_function()->initial_map(), isolate());
2411 } 2413 }
2412 int cache_index = number_of_properties - 1; 2414 int cache_index = number_of_properties - 1;
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
2477 return Handle<Object>::null(); 2479 return Handle<Object>::null();
2478 } 2480 }
2479 2481
2480 2482
2481 Handle<Object> Factory::ToBoolean(bool value) { 2483 Handle<Object> Factory::ToBoolean(bool value) {
2482 return value ? true_value() : false_value(); 2484 return value ? true_value() : false_value();
2483 } 2485 }
2484 2486
2485 2487
2486 } } // namespace v8::internal 2488 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698