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 2083 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2094 } | 2094 } |
2095 | 2095 |
2096 | 2096 |
2097 AllocationResult Heap::AllocateMap(InstanceType instance_type, | 2097 AllocationResult Heap::AllocateMap(InstanceType instance_type, |
2098 int instance_size, | 2098 int instance_size, |
2099 ElementsKind elements_kind) { | 2099 ElementsKind elements_kind) { |
2100 HeapObject* result = nullptr; | 2100 HeapObject* result = nullptr; |
2101 AllocationResult allocation = AllocateRaw(Map::kSize, MAP_SPACE); | 2101 AllocationResult allocation = AllocateRaw(Map::kSize, MAP_SPACE); |
2102 if (!allocation.To(&result)) return allocation; | 2102 if (!allocation.To(&result)) return allocation; |
2103 | 2103 |
| 2104 isolate()->counters()->maps_created()->Increment(); |
2104 result->set_map_no_write_barrier(meta_map()); | 2105 result->set_map_no_write_barrier(meta_map()); |
2105 Map* map = Map::cast(result); | 2106 Map* map = Map::cast(result); |
2106 map->set_instance_type(instance_type); | 2107 map->set_instance_type(instance_type); |
2107 map->set_prototype(null_value(), SKIP_WRITE_BARRIER); | 2108 map->set_prototype(null_value(), SKIP_WRITE_BARRIER); |
2108 map->set_constructor_or_backpointer(null_value(), SKIP_WRITE_BARRIER); | 2109 map->set_constructor_or_backpointer(null_value(), SKIP_WRITE_BARRIER); |
2109 map->set_instance_size(instance_size); | 2110 map->set_instance_size(instance_size); |
2110 map->clear_unused(); | 2111 map->clear_unused(); |
2111 map->set_inobject_properties_or_constructor_function_index(0); | 2112 map->set_inobject_properties_or_constructor_function_index(0); |
2112 map->set_code_cache(empty_fixed_array(), SKIP_WRITE_BARRIER); | 2113 map->set_code_cache(empty_fixed_array(), SKIP_WRITE_BARRIER); |
2113 map->set_dependent_code(DependentCode::cast(empty_fixed_array()), | 2114 map->set_dependent_code(DependentCode::cast(empty_fixed_array()), |
(...skipping 4108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6222 } | 6223 } |
6223 | 6224 |
6224 | 6225 |
6225 // static | 6226 // static |
6226 int Heap::GetStaticVisitorIdForMap(Map* map) { | 6227 int Heap::GetStaticVisitorIdForMap(Map* map) { |
6227 return StaticVisitorBase::GetVisitorId(map); | 6228 return StaticVisitorBase::GetVisitorId(map); |
6228 } | 6229 } |
6229 | 6230 |
6230 } // namespace internal | 6231 } // namespace internal |
6231 } // namespace v8 | 6232 } // namespace v8 |
OLD | NEW |