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 2249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2260 | 2260 |
2261 ALLOCATE_VARSIZE_MAP(FIXED_ARRAY_TYPE, scope_info) | 2261 ALLOCATE_VARSIZE_MAP(FIXED_ARRAY_TYPE, scope_info) |
2262 ALLOCATE_VARSIZE_MAP(FIXED_ARRAY_TYPE, module_info) | 2262 ALLOCATE_VARSIZE_MAP(FIXED_ARRAY_TYPE, module_info) |
2263 ALLOCATE_VARSIZE_MAP(FIXED_ARRAY_TYPE, feedback_vector) | 2263 ALLOCATE_VARSIZE_MAP(FIXED_ARRAY_TYPE, feedback_vector) |
2264 ALLOCATE_PRIMITIVE_MAP(HEAP_NUMBER_TYPE, HeapNumber::kSize, heap_number, | 2264 ALLOCATE_PRIMITIVE_MAP(HEAP_NUMBER_TYPE, HeapNumber::kSize, heap_number, |
2265 Context::NUMBER_FUNCTION_INDEX) | 2265 Context::NUMBER_FUNCTION_INDEX) |
2266 ALLOCATE_MAP(MUTABLE_HEAP_NUMBER_TYPE, HeapNumber::kSize, | 2266 ALLOCATE_MAP(MUTABLE_HEAP_NUMBER_TYPE, HeapNumber::kSize, |
2267 mutable_heap_number) | 2267 mutable_heap_number) |
2268 ALLOCATE_PRIMITIVE_MAP(SYMBOL_TYPE, Symbol::kSize, symbol, | 2268 ALLOCATE_PRIMITIVE_MAP(SYMBOL_TYPE, Symbol::kSize, symbol, |
2269 Context::SYMBOL_FUNCTION_INDEX) | 2269 Context::SYMBOL_FUNCTION_INDEX) |
| 2270 #define ALLOCATE_SIMD128_MAP(TYPE, Type, type, lane_count, lane_type) \ |
| 2271 ALLOCATE_PRIMITIVE_MAP(SIMD128_VALUE_TYPE, Type::kSize, type, \ |
| 2272 Context::TYPE##_FUNCTION_INDEX) |
| 2273 SIMD128_TYPES(ALLOCATE_SIMD128_MAP) |
| 2274 #undef ALLOCATE_SIMD128_MAP |
2270 ALLOCATE_MAP(FOREIGN_TYPE, Foreign::kSize, foreign) | 2275 ALLOCATE_MAP(FOREIGN_TYPE, Foreign::kSize, foreign) |
2271 | 2276 |
2272 ALLOCATE_PRIMITIVE_MAP(ODDBALL_TYPE, Oddball::kSize, boolean, | 2277 ALLOCATE_PRIMITIVE_MAP(ODDBALL_TYPE, Oddball::kSize, boolean, |
2273 Context::BOOLEAN_FUNCTION_INDEX); | 2278 Context::BOOLEAN_FUNCTION_INDEX); |
2274 ALLOCATE_MAP(ODDBALL_TYPE, Oddball::kSize, uninitialized); | 2279 ALLOCATE_MAP(ODDBALL_TYPE, Oddball::kSize, uninitialized); |
2275 ALLOCATE_MAP(ODDBALL_TYPE, Oddball::kSize, arguments_marker); | 2280 ALLOCATE_MAP(ODDBALL_TYPE, Oddball::kSize, arguments_marker); |
2276 ALLOCATE_MAP(ODDBALL_TYPE, Oddball::kSize, no_interceptor_result_sentinel); | 2281 ALLOCATE_MAP(ODDBALL_TYPE, Oddball::kSize, no_interceptor_result_sentinel); |
2277 ALLOCATE_MAP(ODDBALL_TYPE, Oddball::kSize, exception); | 2282 ALLOCATE_MAP(ODDBALL_TYPE, Oddball::kSize, exception); |
2278 ALLOCATE_MAP(ODDBALL_TYPE, Oddball::kSize, termination_exception); | 2283 ALLOCATE_MAP(ODDBALL_TYPE, Oddball::kSize, termination_exception); |
2279 ALLOCATE_MAP(ODDBALL_TYPE, Oddball::kSize, optimized_out); | 2284 ALLOCATE_MAP(ODDBALL_TYPE, Oddball::kSize, optimized_out); |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2425 { | 2430 { |
2426 AllocationResult allocation = AllocateRaw(size, space, kDoubleUnaligned); | 2431 AllocationResult allocation = AllocateRaw(size, space, kDoubleUnaligned); |
2427 if (!allocation.To(&result)) return allocation; | 2432 if (!allocation.To(&result)) return allocation; |
2428 } | 2433 } |
2429 | 2434 |
2430 Map* map = mode == MUTABLE ? mutable_heap_number_map() : heap_number_map(); | 2435 Map* map = mode == MUTABLE ? mutable_heap_number_map() : heap_number_map(); |
2431 HeapObject::cast(result)->set_map_no_write_barrier(map); | 2436 HeapObject::cast(result)->set_map_no_write_barrier(map); |
2432 return result; | 2437 return result; |
2433 } | 2438 } |
2434 | 2439 |
| 2440 #define SIMD_ALLOCATE_DEFINITION(TYPE, Type, type, lane_count, lane_type) \ |
| 2441 AllocationResult Heap::Allocate##Type(lane_type lanes[lane_count], \ |
| 2442 PretenureFlag pretenure) { \ |
| 2443 int size = Type::kSize; \ |
| 2444 STATIC_ASSERT(Type::kSize <= kMaxRegularHeapObjectSize); \ |
| 2445 \ |
| 2446 AllocationSpace space = SelectSpace(pretenure); \ |
| 2447 \ |
| 2448 HeapObject* result = nullptr; \ |
| 2449 { \ |
| 2450 AllocationResult allocation = \ |
| 2451 AllocateRaw(size, space, kSimd128Unaligned); \ |
| 2452 if (!allocation.To(&result)) return allocation; \ |
| 2453 } \ |
| 2454 \ |
| 2455 result->set_map_no_write_barrier(type##_map()); \ |
| 2456 Type* instance = Type::cast(result); \ |
| 2457 for (int i = 0; i < lane_count; i++) { \ |
| 2458 instance->set_lane(i, lanes[i]); \ |
| 2459 } \ |
| 2460 return result; \ |
| 2461 } |
| 2462 SIMD128_TYPES(SIMD_ALLOCATE_DEFINITION) |
| 2463 #undef SIMD_ALLOCATE_DEFINITION |
| 2464 |
| 2465 |
2435 AllocationResult Heap::AllocateCell(Object* value) { | 2466 AllocationResult Heap::AllocateCell(Object* value) { |
2436 int size = Cell::kSize; | 2467 int size = Cell::kSize; |
2437 STATIC_ASSERT(Cell::kSize <= kMaxRegularHeapObjectSize); | 2468 STATIC_ASSERT(Cell::kSize <= kMaxRegularHeapObjectSize); |
2438 | 2469 |
2439 HeapObject* result = nullptr; | 2470 HeapObject* result = nullptr; |
2440 { | 2471 { |
2441 AllocationResult allocation = AllocateRaw(size, OLD_SPACE); | 2472 AllocationResult allocation = AllocateRaw(size, OLD_SPACE); |
2442 if (!allocation.To(&result)) return allocation; | 2473 if (!allocation.To(&result)) return allocation; |
2443 } | 2474 } |
2444 result->set_map_no_write_barrier(cell_map()); | 2475 result->set_map_no_write_barrier(cell_map()); |
(...skipping 4065 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6510 } | 6541 } |
6511 | 6542 |
6512 | 6543 |
6513 // static | 6544 // static |
6514 int Heap::GetStaticVisitorIdForMap(Map* map) { | 6545 int Heap::GetStaticVisitorIdForMap(Map* map) { |
6515 return StaticVisitorBase::GetVisitorId(map); | 6546 return StaticVisitorBase::GetVisitorId(map); |
6516 } | 6547 } |
6517 | 6548 |
6518 } // namespace internal | 6549 } // namespace internal |
6519 } // namespace v8 | 6550 } // namespace v8 |
OLD | NEW |