| 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 1574 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1585 int at_least_space_for = map->NumberOfOwnDescriptors() * 2 + initial_size; | 1585 int at_least_space_for = map->NumberOfOwnDescriptors() * 2 + initial_size; |
| 1586 Handle<NameDictionary> dictionary = | 1586 Handle<NameDictionary> dictionary = |
| 1587 NameDictionary::New(isolate(), at_least_space_for); | 1587 NameDictionary::New(isolate(), at_least_space_for); |
| 1588 | 1588 |
| 1589 // The global object might be created from an object template with accessors. | 1589 // The global object might be created from an object template with accessors. |
| 1590 // Fill these accessors into the dictionary. | 1590 // Fill these accessors into the dictionary. |
| 1591 Handle<DescriptorArray> descs(map->instance_descriptors()); | 1591 Handle<DescriptorArray> descs(map->instance_descriptors()); |
| 1592 for (int i = 0; i < map->NumberOfOwnDescriptors(); i++) { | 1592 for (int i = 0; i < map->NumberOfOwnDescriptors(); i++) { |
| 1593 PropertyDetails details = descs->GetDetails(i); | 1593 PropertyDetails details = descs->GetDetails(i); |
| 1594 DCHECK(details.type() == CALLBACKS); // Only accessors are expected. | 1594 DCHECK(details.type() == CALLBACKS); // Only accessors are expected. |
| 1595 PropertyDetails d = PropertyDetails(details.attributes(), CALLBACKS, i + 1); | 1595 PropertyDetails d(details.attributes(), CALLBACKS, i + 1); |
| 1596 Handle<Name> name(descs->GetKey(i)); | 1596 Handle<Name> name(descs->GetKey(i)); |
| 1597 Handle<Object> value(descs->GetCallbacksObject(i), isolate()); | 1597 Handle<Object> value(descs->GetCallbacksObject(i), isolate()); |
| 1598 Handle<PropertyCell> cell = NewPropertyCell(value); | 1598 Handle<PropertyCell> cell = NewPropertyCell(value); |
| 1599 // |dictionary| already contains enough space for all properties. | 1599 // |dictionary| already contains enough space for all properties. |
| 1600 USE(NameDictionary::Add(dictionary, name, cell, d)); | 1600 USE(NameDictionary::Add(dictionary, name, cell, d)); |
| 1601 } | 1601 } |
| 1602 | 1602 |
| 1603 // Allocate the global object and initialize it with the backing store. | 1603 // Allocate the global object and initialize it with the backing store. |
| 1604 Handle<GlobalObject> global = New<GlobalObject>(map, OLD_POINTER_SPACE); | 1604 Handle<GlobalObject> global = New<GlobalObject>(map, OLD_POINTER_SPACE); |
| 1605 isolate()->heap()->InitializeJSObjectFromMap(*global, *dictionary, *map); | 1605 isolate()->heap()->InitializeJSObjectFromMap(*global, *dictionary, *map); |
| (...skipping 915 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2521 return Handle<Object>::null(); | 2521 return Handle<Object>::null(); |
| 2522 } | 2522 } |
| 2523 | 2523 |
| 2524 | 2524 |
| 2525 Handle<Object> Factory::ToBoolean(bool value) { | 2525 Handle<Object> Factory::ToBoolean(bool value) { |
| 2526 return value ? true_value() : false_value(); | 2526 return value ? true_value() : false_value(); |
| 2527 } | 2527 } |
| 2528 | 2528 |
| 2529 | 2529 |
| 2530 } } // namespace v8::internal | 2530 } } // namespace v8::internal |
| OLD | NEW |