OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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/heap/heap.h" | 5 #include "src/heap/heap.h" |
6 | 6 |
7 #include "src/accessors.h" | 7 #include "src/accessors.h" |
8 #include "src/api.h" | 8 #include "src/api.h" |
9 #include "src/ast/scopeinfo.h" | 9 #include "src/ast/scopeinfo.h" |
10 #include "src/base/bits.h" | 10 #include "src/base/bits.h" |
(...skipping 2022 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2033 ->set_layout_descriptor(LayoutDescriptor::FastPointerLayout()); | 2033 ->set_layout_descriptor(LayoutDescriptor::FastPointerLayout()); |
2034 } | 2034 } |
2035 reinterpret_cast<Map*>(result)->clear_unused(); | 2035 reinterpret_cast<Map*>(result)->clear_unused(); |
2036 reinterpret_cast<Map*>(result) | 2036 reinterpret_cast<Map*>(result) |
2037 ->set_inobject_properties_or_constructor_function_index(0); | 2037 ->set_inobject_properties_or_constructor_function_index(0); |
2038 reinterpret_cast<Map*>(result)->set_unused_property_fields(0); | 2038 reinterpret_cast<Map*>(result)->set_unused_property_fields(0); |
2039 reinterpret_cast<Map*>(result)->set_bit_field(0); | 2039 reinterpret_cast<Map*>(result)->set_bit_field(0); |
2040 reinterpret_cast<Map*>(result)->set_bit_field2(0); | 2040 reinterpret_cast<Map*>(result)->set_bit_field2(0); |
2041 int bit_field3 = Map::EnumLengthBits::encode(kInvalidEnumCacheSentinel) | | 2041 int bit_field3 = Map::EnumLengthBits::encode(kInvalidEnumCacheSentinel) | |
2042 Map::OwnsDescriptors::encode(true) | | 2042 Map::OwnsDescriptors::encode(true) | |
2043 Map::Counter::encode(Map::kRetainingCounterStart); | 2043 Map::ConstructionCounter::encode(Map::kNoSlackTracking); |
2044 reinterpret_cast<Map*>(result)->set_bit_field3(bit_field3); | 2044 reinterpret_cast<Map*>(result)->set_bit_field3(bit_field3); |
2045 reinterpret_cast<Map*>(result)->set_weak_cell_cache(Smi::FromInt(0)); | 2045 reinterpret_cast<Map*>(result)->set_weak_cell_cache(Smi::FromInt(0)); |
2046 return result; | 2046 return result; |
2047 } | 2047 } |
2048 | 2048 |
2049 | 2049 |
2050 AllocationResult Heap::AllocateMap(InstanceType instance_type, | 2050 AllocationResult Heap::AllocateMap(InstanceType instance_type, |
2051 int instance_size, | 2051 int instance_size, |
2052 ElementsKind elements_kind) { | 2052 ElementsKind elements_kind) { |
2053 HeapObject* result = nullptr; | 2053 HeapObject* result = nullptr; |
(...skipping 18 matching lines...) Expand all Loading... |
2072 if (FLAG_unbox_double_fields) { | 2072 if (FLAG_unbox_double_fields) { |
2073 map->set_layout_descriptor(LayoutDescriptor::FastPointerLayout()); | 2073 map->set_layout_descriptor(LayoutDescriptor::FastPointerLayout()); |
2074 } | 2074 } |
2075 // Must be called only after |instance_type|, |instance_size| and | 2075 // Must be called only after |instance_type|, |instance_size| and |
2076 // |layout_descriptor| are set. | 2076 // |layout_descriptor| are set. |
2077 map->set_visitor_id(Heap::GetStaticVisitorIdForMap(map)); | 2077 map->set_visitor_id(Heap::GetStaticVisitorIdForMap(map)); |
2078 map->set_bit_field(0); | 2078 map->set_bit_field(0); |
2079 map->set_bit_field2(1 << Map::kIsExtensible); | 2079 map->set_bit_field2(1 << Map::kIsExtensible); |
2080 int bit_field3 = Map::EnumLengthBits::encode(kInvalidEnumCacheSentinel) | | 2080 int bit_field3 = Map::EnumLengthBits::encode(kInvalidEnumCacheSentinel) | |
2081 Map::OwnsDescriptors::encode(true) | | 2081 Map::OwnsDescriptors::encode(true) | |
2082 Map::Counter::encode(Map::kRetainingCounterStart); | 2082 Map::ConstructionCounter::encode(Map::kNoSlackTracking); |
2083 map->set_bit_field3(bit_field3); | 2083 map->set_bit_field3(bit_field3); |
2084 map->set_elements_kind(elements_kind); | 2084 map->set_elements_kind(elements_kind); |
2085 map->set_new_target_is_base(true); | 2085 map->set_new_target_is_base(true); |
2086 | 2086 |
2087 return map; | 2087 return map; |
2088 } | 2088 } |
2089 | 2089 |
2090 | 2090 |
2091 AllocationResult Heap::AllocateFillerObject(int size, bool double_align, | 2091 AllocationResult Heap::AllocateFillerObject(int size, bool double_align, |
2092 AllocationSpace space) { | 2092 AllocationSpace space) { |
(...skipping 4024 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6117 } | 6117 } |
6118 | 6118 |
6119 | 6119 |
6120 // static | 6120 // static |
6121 int Heap::GetStaticVisitorIdForMap(Map* map) { | 6121 int Heap::GetStaticVisitorIdForMap(Map* map) { |
6122 return StaticVisitorBase::GetVisitorId(map); | 6122 return StaticVisitorBase::GetVisitorId(map); |
6123 } | 6123 } |
6124 | 6124 |
6125 } // namespace internal | 6125 } // namespace internal |
6126 } // namespace v8 | 6126 } // namespace v8 |
OLD | NEW |