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/conversions.h" | 9 #include "src/conversions.h" |
10 #include "src/isolate-inl.h" | 10 #include "src/isolate-inl.h" |
(...skipping 1558 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1569 // Allocate a dictionary object for backing storage. | 1569 // Allocate a dictionary object for backing storage. |
1570 int at_least_space_for = map->NumberOfOwnDescriptors() * 2 + initial_size; | 1570 int at_least_space_for = map->NumberOfOwnDescriptors() * 2 + initial_size; |
1571 Handle<NameDictionary> dictionary = | 1571 Handle<NameDictionary> dictionary = |
1572 NameDictionary::New(isolate(), at_least_space_for); | 1572 NameDictionary::New(isolate(), at_least_space_for); |
1573 | 1573 |
1574 // The global object might be created from an object template with accessors. | 1574 // The global object might be created from an object template with accessors. |
1575 // Fill these accessors into the dictionary. | 1575 // Fill these accessors into the dictionary. |
1576 Handle<DescriptorArray> descs(map->instance_descriptors()); | 1576 Handle<DescriptorArray> descs(map->instance_descriptors()); |
1577 for (int i = 0; i < map->NumberOfOwnDescriptors(); i++) { | 1577 for (int i = 0; i < map->NumberOfOwnDescriptors(); i++) { |
1578 PropertyDetails details = descs->GetDetails(i); | 1578 PropertyDetails details = descs->GetDetails(i); |
1579 DCHECK(details.type() == CALLBACKS); // Only accessors are expected. | 1579 // Only accessors are expected. |
1580 PropertyDetails d(details.attributes(), CALLBACKS, i + 1); | 1580 DCHECK_EQ(ACCESSOR_CONSTANT, details.type()); |
| 1581 PropertyDetails d(details.attributes(), ACCESSOR_CONSTANT, i + 1); |
1581 Handle<Name> name(descs->GetKey(i)); | 1582 Handle<Name> name(descs->GetKey(i)); |
1582 Handle<Object> value(descs->GetCallbacksObject(i), isolate()); | 1583 Handle<Object> value(descs->GetCallbacksObject(i), isolate()); |
1583 Handle<PropertyCell> cell = NewPropertyCell(value); | 1584 Handle<PropertyCell> cell = NewPropertyCell(value); |
1584 // |dictionary| already contains enough space for all properties. | 1585 // |dictionary| already contains enough space for all properties. |
1585 USE(NameDictionary::Add(dictionary, name, cell, d)); | 1586 USE(NameDictionary::Add(dictionary, name, cell, d)); |
1586 } | 1587 } |
1587 | 1588 |
1588 // Allocate the global object and initialize it with the backing store. | 1589 // Allocate the global object and initialize it with the backing store. |
1589 Handle<GlobalObject> global = New<GlobalObject>(map, OLD_POINTER_SPACE); | 1590 Handle<GlobalObject> global = New<GlobalObject>(map, OLD_POINTER_SPACE); |
1590 isolate()->heap()->InitializeJSObjectFromMap(*global, *dictionary, *map); | 1591 isolate()->heap()->InitializeJSObjectFromMap(*global, *dictionary, *map); |
(...skipping 928 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2519 return Handle<Object>::null(); | 2520 return Handle<Object>::null(); |
2520 } | 2521 } |
2521 | 2522 |
2522 | 2523 |
2523 Handle<Object> Factory::ToBoolean(bool value) { | 2524 Handle<Object> Factory::ToBoolean(bool value) { |
2524 return value ? true_value() : false_value(); | 2525 return value ? true_value() : false_value(); |
2525 } | 2526 } |
2526 | 2527 |
2527 | 2528 |
2528 } } // namespace v8::internal | 2529 } } // namespace v8::internal |
OLD | NEW |