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/context-slot-cache.h" | 9 #include "src/ast/context-slot-cache.h" |
10 #include "src/base/bits.h" | 10 #include "src/base/bits.h" |
(...skipping 2284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2295 (constructor_function_index)); \ | 2295 (constructor_function_index)); \ |
2296 } | 2296 } |
2297 | 2297 |
2298 ALLOCATE_VARSIZE_MAP(FIXED_ARRAY_TYPE, fixed_cow_array) | 2298 ALLOCATE_VARSIZE_MAP(FIXED_ARRAY_TYPE, fixed_cow_array) |
2299 fixed_cow_array_map()->set_elements_kind(FAST_HOLEY_ELEMENTS); | 2299 fixed_cow_array_map()->set_elements_kind(FAST_HOLEY_ELEMENTS); |
2300 DCHECK_NE(fixed_array_map(), fixed_cow_array_map()); | 2300 DCHECK_NE(fixed_array_map(), fixed_cow_array_map()); |
2301 | 2301 |
2302 ALLOCATE_VARSIZE_MAP(FIXED_ARRAY_TYPE, scope_info) | 2302 ALLOCATE_VARSIZE_MAP(FIXED_ARRAY_TYPE, scope_info) |
2303 ALLOCATE_VARSIZE_MAP(FIXED_ARRAY_TYPE, module_info_entry) | 2303 ALLOCATE_VARSIZE_MAP(FIXED_ARRAY_TYPE, module_info_entry) |
2304 ALLOCATE_VARSIZE_MAP(FIXED_ARRAY_TYPE, module_info) | 2304 ALLOCATE_VARSIZE_MAP(FIXED_ARRAY_TYPE, module_info) |
2305 ALLOCATE_MAP(JS_MODULE_TYPE, JSModule::kSize, js_module) | |
2306 ALLOCATE_PRIMITIVE_MAP(HEAP_NUMBER_TYPE, HeapNumber::kSize, heap_number, | 2305 ALLOCATE_PRIMITIVE_MAP(HEAP_NUMBER_TYPE, HeapNumber::kSize, heap_number, |
2307 Context::NUMBER_FUNCTION_INDEX) | 2306 Context::NUMBER_FUNCTION_INDEX) |
2308 ALLOCATE_MAP(MUTABLE_HEAP_NUMBER_TYPE, HeapNumber::kSize, | 2307 ALLOCATE_MAP(MUTABLE_HEAP_NUMBER_TYPE, HeapNumber::kSize, |
2309 mutable_heap_number) | 2308 mutable_heap_number) |
2310 ALLOCATE_PRIMITIVE_MAP(SYMBOL_TYPE, Symbol::kSize, symbol, | 2309 ALLOCATE_PRIMITIVE_MAP(SYMBOL_TYPE, Symbol::kSize, symbol, |
2311 Context::SYMBOL_FUNCTION_INDEX) | 2310 Context::SYMBOL_FUNCTION_INDEX) |
2312 #define ALLOCATE_SIMD128_MAP(TYPE, Type, type, lane_count, lane_type) \ | 2311 #define ALLOCATE_SIMD128_MAP(TYPE, Type, type, lane_count, lane_type) \ |
2313 ALLOCATE_PRIMITIVE_MAP(SIMD128_VALUE_TYPE, Type::kSize, type, \ | 2312 ALLOCATE_PRIMITIVE_MAP(SIMD128_VALUE_TYPE, Type::kSize, type, \ |
2314 Context::TYPE##_FUNCTION_INDEX) | 2313 Context::TYPE##_FUNCTION_INDEX) |
2315 SIMD128_TYPES(ALLOCATE_SIMD128_MAP) | 2314 SIMD128_TYPES(ALLOCATE_SIMD128_MAP) |
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2501 HeapObject* result = nullptr; | 2500 HeapObject* result = nullptr; |
2502 { | 2501 { |
2503 AllocationResult allocation = AllocateRaw(size, OLD_SPACE); | 2502 AllocationResult allocation = AllocateRaw(size, OLD_SPACE); |
2504 if (!allocation.To(&result)) return allocation; | 2503 if (!allocation.To(&result)) return allocation; |
2505 } | 2504 } |
2506 result->set_map_no_write_barrier(cell_map()); | 2505 result->set_map_no_write_barrier(cell_map()); |
2507 Cell::cast(result)->set_value(value); | 2506 Cell::cast(result)->set_value(value); |
2508 return result; | 2507 return result; |
2509 } | 2508 } |
2510 | 2509 |
2511 | |
2512 AllocationResult Heap::AllocatePropertyCell() { | 2510 AllocationResult Heap::AllocatePropertyCell() { |
2513 int size = PropertyCell::kSize; | 2511 int size = PropertyCell::kSize; |
2514 STATIC_ASSERT(PropertyCell::kSize <= kMaxRegularHeapObjectSize); | 2512 STATIC_ASSERT(PropertyCell::kSize <= kMaxRegularHeapObjectSize); |
2515 | 2513 |
2516 HeapObject* result = nullptr; | 2514 HeapObject* result = nullptr; |
2517 AllocationResult allocation = AllocateRaw(size, OLD_SPACE); | 2515 AllocationResult allocation = AllocateRaw(size, OLD_SPACE); |
2518 if (!allocation.To(&result)) return allocation; | 2516 if (!allocation.To(&result)) return allocation; |
2519 | 2517 |
2520 result->set_map_no_write_barrier(global_property_cell_map()); | 2518 result->set_map_no_write_barrier(global_property_cell_map()); |
2521 PropertyCell* cell = PropertyCell::cast(result); | 2519 PropertyCell* cell = PropertyCell::cast(result); |
(...skipping 4014 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6536 } | 6534 } |
6537 | 6535 |
6538 | 6536 |
6539 // static | 6537 // static |
6540 int Heap::GetStaticVisitorIdForMap(Map* map) { | 6538 int Heap::GetStaticVisitorIdForMap(Map* map) { |
6541 return StaticVisitorBase::GetVisitorId(map); | 6539 return StaticVisitorBase::GetVisitorId(map); |
6542 } | 6540 } |
6543 | 6541 |
6544 } // namespace internal | 6542 } // namespace internal |
6545 } // namespace v8 | 6543 } // namespace v8 |
OLD | NEW |