Index: src/heap/heap.cc |
diff --git a/src/heap/heap.cc b/src/heap/heap.cc |
index 7d6033617c03c72152ff5395a6eaef20930921c4..352816c3892c3fccbb2453cbfeb454c6a9a2e2de 100644 |
--- a/src/heap/heap.cc |
+++ b/src/heap/heap.cc |
@@ -2267,6 +2267,11 @@ |
mutable_heap_number) |
ALLOCATE_PRIMITIVE_MAP(SYMBOL_TYPE, Symbol::kSize, symbol, |
Context::SYMBOL_FUNCTION_INDEX) |
+#define ALLOCATE_SIMD128_MAP(TYPE, Type, type, lane_count, lane_type) \ |
+ ALLOCATE_PRIMITIVE_MAP(SIMD128_VALUE_TYPE, Type::kSize, type, \ |
+ Context::TYPE##_FUNCTION_INDEX) |
+ SIMD128_TYPES(ALLOCATE_SIMD128_MAP) |
+#undef ALLOCATE_SIMD128_MAP |
ALLOCATE_MAP(FOREIGN_TYPE, Foreign::kSize, foreign) |
ALLOCATE_PRIMITIVE_MAP(ODDBALL_TYPE, Oddball::kSize, boolean, |
@@ -2431,6 +2436,32 @@ |
HeapObject::cast(result)->set_map_no_write_barrier(map); |
return result; |
} |
+ |
+#define SIMD_ALLOCATE_DEFINITION(TYPE, Type, type, lane_count, lane_type) \ |
+ AllocationResult Heap::Allocate##Type(lane_type lanes[lane_count], \ |
+ PretenureFlag pretenure) { \ |
+ int size = Type::kSize; \ |
+ STATIC_ASSERT(Type::kSize <= kMaxRegularHeapObjectSize); \ |
+ \ |
+ AllocationSpace space = SelectSpace(pretenure); \ |
+ \ |
+ HeapObject* result = nullptr; \ |
+ { \ |
+ AllocationResult allocation = \ |
+ AllocateRaw(size, space, kSimd128Unaligned); \ |
+ if (!allocation.To(&result)) return allocation; \ |
+ } \ |
+ \ |
+ result->set_map_no_write_barrier(type##_map()); \ |
+ Type* instance = Type::cast(result); \ |
+ for (int i = 0; i < lane_count; i++) { \ |
+ instance->set_lane(i, lanes[i]); \ |
+ } \ |
+ return result; \ |
+ } |
+SIMD128_TYPES(SIMD_ALLOCATE_DEFINITION) |
+#undef SIMD_ALLOCATE_DEFINITION |
+ |
AllocationResult Heap::AllocateCell(Object* value) { |
int size = Cell::kSize; |