OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 1585 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1596 Map* map = reinterpret_cast<Map*>(result); | 1596 Map* map = reinterpret_cast<Map*>(result); |
1597 map->set_map(meta_map()); | 1597 map->set_map(meta_map()); |
1598 map->set_instance_type(instance_type); | 1598 map->set_instance_type(instance_type); |
1599 map->set_visitor_id( | 1599 map->set_visitor_id( |
1600 StaticVisitorBase::GetVisitorId(instance_type, instance_size)); | 1600 StaticVisitorBase::GetVisitorId(instance_type, instance_size)); |
1601 map->set_prototype(null_value()); | 1601 map->set_prototype(null_value()); |
1602 map->set_constructor(null_value()); | 1602 map->set_constructor(null_value()); |
1603 map->set_instance_size(instance_size); | 1603 map->set_instance_size(instance_size); |
1604 map->set_inobject_properties(0); | 1604 map->set_inobject_properties(0); |
1605 map->set_pre_allocated_property_fields(0); | 1605 map->set_pre_allocated_property_fields(0); |
1606 map->set_instance_descriptors(empty_descriptor_array()); | 1606 map->init_instance_descriptors(); |
1607 map->set_code_cache(empty_fixed_array()); | 1607 map->set_code_cache(empty_fixed_array()); |
1608 map->set_prototype_transitions(empty_fixed_array()); | 1608 map->set_prototype_transitions(empty_fixed_array()); |
1609 map->set_unused_property_fields(0); | 1609 map->set_unused_property_fields(0); |
1610 map->set_bit_field(0); | 1610 map->set_bit_field(0); |
1611 map->set_bit_field2((1 << Map::kIsExtensible) | (1 << Map::kHasFastElements)); | 1611 map->set_bit_field2((1 << Map::kIsExtensible) | (1 << Map::kHasFastElements)); |
1612 | 1612 |
1613 // If the map object is aligned fill the padding area with Smi 0 objects. | 1613 // If the map object is aligned fill the padding area with Smi 0 objects. |
1614 if (Map::kPadStart < Map::kSize) { | 1614 if (Map::kPadStart < Map::kSize) { |
1615 memset(reinterpret_cast<byte*>(map) + Map::kPadStart - kHeapObjectTag, | 1615 memset(reinterpret_cast<byte*>(map) + Map::kPadStart - kHeapObjectTag, |
1616 0, | 1616 0, |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1689 set_null_value(obj); | 1689 set_null_value(obj); |
1690 Oddball::cast(obj)->set_kind(Oddball::kNull); | 1690 Oddball::cast(obj)->set_kind(Oddball::kNull); |
1691 | 1691 |
1692 // Allocate the empty descriptor array. | 1692 // Allocate the empty descriptor array. |
1693 { MaybeObject* maybe_obj = AllocateEmptyFixedArray(); | 1693 { MaybeObject* maybe_obj = AllocateEmptyFixedArray(); |
1694 if (!maybe_obj->ToObject(&obj)) return false; | 1694 if (!maybe_obj->ToObject(&obj)) return false; |
1695 } | 1695 } |
1696 set_empty_descriptor_array(DescriptorArray::cast(obj)); | 1696 set_empty_descriptor_array(DescriptorArray::cast(obj)); |
1697 | 1697 |
1698 // Fix the instance_descriptors for the existing maps. | 1698 // Fix the instance_descriptors for the existing maps. |
1699 meta_map()->set_instance_descriptors(empty_descriptor_array()); | 1699 meta_map()->init_instance_descriptors(); |
1700 meta_map()->set_code_cache(empty_fixed_array()); | 1700 meta_map()->set_code_cache(empty_fixed_array()); |
1701 meta_map()->set_prototype_transitions(empty_fixed_array()); | 1701 meta_map()->set_prototype_transitions(empty_fixed_array()); |
1702 | 1702 |
1703 fixed_array_map()->set_instance_descriptors(empty_descriptor_array()); | 1703 fixed_array_map()->init_instance_descriptors(); |
1704 fixed_array_map()->set_code_cache(empty_fixed_array()); | 1704 fixed_array_map()->set_code_cache(empty_fixed_array()); |
1705 fixed_array_map()->set_prototype_transitions(empty_fixed_array()); | 1705 fixed_array_map()->set_prototype_transitions(empty_fixed_array()); |
1706 | 1706 |
1707 oddball_map()->set_instance_descriptors(empty_descriptor_array()); | 1707 oddball_map()->init_instance_descriptors(); |
1708 oddball_map()->set_code_cache(empty_fixed_array()); | 1708 oddball_map()->set_code_cache(empty_fixed_array()); |
1709 oddball_map()->set_prototype_transitions(empty_fixed_array()); | 1709 oddball_map()->set_prototype_transitions(empty_fixed_array()); |
1710 | 1710 |
1711 // Fix prototype object for existing maps. | 1711 // Fix prototype object for existing maps. |
1712 meta_map()->set_prototype(null_value()); | 1712 meta_map()->set_prototype(null_value()); |
1713 meta_map()->set_constructor(null_value()); | 1713 meta_map()->set_constructor(null_value()); |
1714 | 1714 |
1715 fixed_array_map()->set_prototype(null_value()); | 1715 fixed_array_map()->set_prototype(null_value()); |
1716 fixed_array_map()->set_constructor(null_value()); | 1716 fixed_array_map()->set_constructor(null_value()); |
1717 | 1717 |
(...skipping 1582 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3300 InitializeJSObjectFromMap(global, dictionary, map); | 3300 InitializeJSObjectFromMap(global, dictionary, map); |
3301 | 3301 |
3302 // Create a new map for the global object. | 3302 // Create a new map for the global object. |
3303 { MaybeObject* maybe_obj = map->CopyDropDescriptors(); | 3303 { MaybeObject* maybe_obj = map->CopyDropDescriptors(); |
3304 if (!maybe_obj->ToObject(&obj)) return maybe_obj; | 3304 if (!maybe_obj->ToObject(&obj)) return maybe_obj; |
3305 } | 3305 } |
3306 Map* new_map = Map::cast(obj); | 3306 Map* new_map = Map::cast(obj); |
3307 | 3307 |
3308 // Setup the global object as a normalized object. | 3308 // Setup the global object as a normalized object. |
3309 global->set_map(new_map); | 3309 global->set_map(new_map); |
3310 global->map()->set_instance_descriptors(empty_descriptor_array()); | 3310 global->map()->clear_instance_descriptors(); |
3311 global->set_properties(dictionary); | 3311 global->set_properties(dictionary); |
3312 | 3312 |
3313 // Make sure result is a global object with properties in dictionary. | 3313 // Make sure result is a global object with properties in dictionary. |
3314 ASSERT(global->IsGlobalObject()); | 3314 ASSERT(global->IsGlobalObject()); |
3315 ASSERT(!global->HasFastProperties()); | 3315 ASSERT(!global->HasFastProperties()); |
3316 return global; | 3316 return global; |
3317 } | 3317 } |
3318 | 3318 |
3319 | 3319 |
3320 MaybeObject* Heap::CopyJSObject(JSObject* source) { | 3320 MaybeObject* Heap::CopyJSObject(JSObject* source) { |
(...skipping 2580 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5901 } | 5901 } |
5902 | 5902 |
5903 | 5903 |
5904 void ExternalStringTable::TearDown() { | 5904 void ExternalStringTable::TearDown() { |
5905 new_space_strings_.Free(); | 5905 new_space_strings_.Free(); |
5906 old_space_strings_.Free(); | 5906 old_space_strings_.Free(); |
5907 } | 5907 } |
5908 | 5908 |
5909 | 5909 |
5910 } } // namespace v8::internal | 5910 } } // namespace v8::internal |
OLD | NEW |