OLD | NEW |
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 1491 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1502 DCHECK(map->NextFreePropertyIndex() == 0); | 1502 DCHECK(map->NextFreePropertyIndex() == 0); |
1503 | 1503 |
1504 // Make sure we don't have a ton of pre-allocated slots in the | 1504 // Make sure we don't have a ton of pre-allocated slots in the |
1505 // global objects. They will be unused once we normalize the object. | 1505 // global objects. They will be unused once we normalize the object. |
1506 DCHECK(map->unused_property_fields() == 0); | 1506 DCHECK(map->unused_property_fields() == 0); |
1507 DCHECK(map->GetInObjectProperties() == 0); | 1507 DCHECK(map->GetInObjectProperties() == 0); |
1508 | 1508 |
1509 // Initial size of the backing store to avoid resize of the storage during | 1509 // Initial size of the backing store to avoid resize of the storage during |
1510 // bootstrapping. The size differs between the JS global object ad the | 1510 // bootstrapping. The size differs between the JS global object ad the |
1511 // builtins object. | 1511 // builtins object. |
1512 int initial_size = map->instance_type() == JS_GLOBAL_OBJECT_TYPE ? 64 : 512; | 1512 int initial_size = 64; |
1513 | 1513 |
1514 // Allocate a dictionary object for backing storage. | 1514 // Allocate a dictionary object for backing storage. |
1515 int at_least_space_for = map->NumberOfOwnDescriptors() * 2 + initial_size; | 1515 int at_least_space_for = map->NumberOfOwnDescriptors() * 2 + initial_size; |
1516 Handle<GlobalDictionary> dictionary = | 1516 Handle<GlobalDictionary> dictionary = |
1517 GlobalDictionary::New(isolate(), at_least_space_for); | 1517 GlobalDictionary::New(isolate(), at_least_space_for); |
1518 | 1518 |
1519 // The global object might be created from an object template with accessors. | 1519 // The global object might be created from an object template with accessors. |
1520 // Fill these accessors into the dictionary. | 1520 // Fill these accessors into the dictionary. |
1521 Handle<DescriptorArray> descs(map->instance_descriptors()); | 1521 Handle<DescriptorArray> descs(map->instance_descriptors()); |
1522 for (int i = 0; i < map->NumberOfOwnDescriptors(); i++) { | 1522 for (int i = 0; i < map->NumberOfOwnDescriptors(); i++) { |
(...skipping 861 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2384 } | 2384 } |
2385 | 2385 |
2386 | 2386 |
2387 Handle<Object> Factory::ToBoolean(bool value) { | 2387 Handle<Object> Factory::ToBoolean(bool value) { |
2388 return value ? true_value() : false_value(); | 2388 return value ? true_value() : false_value(); |
2389 } | 2389 } |
2390 | 2390 |
2391 | 2391 |
2392 } // namespace internal | 2392 } // namespace internal |
2393 } // namespace v8 | 2393 } // namespace v8 |
OLD | NEW |