| 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 "factory.h" | 5 #include "factory.h" |
| 6 | 6 |
| 7 #include "macro-assembler.h" | 7 #include "macro-assembler.h" |
| 8 #include "isolate-inl.h" | 8 #include "isolate-inl.h" |
| 9 #include "v8conversions.h" | 9 #include "v8conversions.h" |
| 10 | 10 |
| (...skipping 1482 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1493 // The global object might be created from an object template with accessors. | 1493 // The global object might be created from an object template with accessors. |
| 1494 // Fill these accessors into the dictionary. | 1494 // Fill these accessors into the dictionary. |
| 1495 Handle<DescriptorArray> descs(map->instance_descriptors()); | 1495 Handle<DescriptorArray> descs(map->instance_descriptors()); |
| 1496 for (int i = 0; i < map->NumberOfOwnDescriptors(); i++) { | 1496 for (int i = 0; i < map->NumberOfOwnDescriptors(); i++) { |
| 1497 PropertyDetails details = descs->GetDetails(i); | 1497 PropertyDetails details = descs->GetDetails(i); |
| 1498 ASSERT(details.type() == CALLBACKS); // Only accessors are expected. | 1498 ASSERT(details.type() == CALLBACKS); // Only accessors are expected. |
| 1499 PropertyDetails d = PropertyDetails(details.attributes(), CALLBACKS, i + 1); | 1499 PropertyDetails d = PropertyDetails(details.attributes(), CALLBACKS, i + 1); |
| 1500 Handle<Name> name(descs->GetKey(i)); | 1500 Handle<Name> name(descs->GetKey(i)); |
| 1501 Handle<Object> value(descs->GetCallbacksObject(i), isolate()); | 1501 Handle<Object> value(descs->GetCallbacksObject(i), isolate()); |
| 1502 Handle<PropertyCell> cell = NewPropertyCell(value); | 1502 Handle<PropertyCell> cell = NewPropertyCell(value); |
| 1503 NameDictionary::Add(dictionary, name, cell, d); | 1503 // |dictionary| already contains enough space for all properties. |
| 1504 USE(NameDictionary::Add(dictionary, name, cell, d)); |
| 1504 } | 1505 } |
| 1505 | 1506 |
| 1506 // Allocate the global object and initialize it with the backing store. | 1507 // Allocate the global object and initialize it with the backing store. |
| 1507 Handle<GlobalObject> global = New<GlobalObject>(map, OLD_POINTER_SPACE); | 1508 Handle<GlobalObject> global = New<GlobalObject>(map, OLD_POINTER_SPACE); |
| 1508 isolate()->heap()->InitializeJSObjectFromMap(*global, *dictionary, *map); | 1509 isolate()->heap()->InitializeJSObjectFromMap(*global, *dictionary, *map); |
| 1509 | 1510 |
| 1510 // Create a new map for the global object. | 1511 // Create a new map for the global object. |
| 1511 Handle<Map> new_map = Map::CopyDropDescriptors(map); | 1512 Handle<Map> new_map = Map::CopyDropDescriptors(map); |
| 1512 new_map->set_dictionary_map(true); | 1513 new_map->set_dictionary_map(true); |
| 1513 | 1514 |
| (...skipping 811 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2325 return Handle<Object>::null(); | 2326 return Handle<Object>::null(); |
| 2326 } | 2327 } |
| 2327 | 2328 |
| 2328 | 2329 |
| 2329 Handle<Object> Factory::ToBoolean(bool value) { | 2330 Handle<Object> Factory::ToBoolean(bool value) { |
| 2330 return value ? true_value() : false_value(); | 2331 return value ? true_value() : false_value(); |
| 2331 } | 2332 } |
| 2332 | 2333 |
| 2333 | 2334 |
| 2334 } } // namespace v8::internal | 2335 } } // namespace v8::internal |
| OLD | NEW |