Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5)

Unified Diff: src/heap/heap.cc

Issue 1153373003: Add new Float32x4 type for SIMD.js. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix int type mismatches. Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/heap/heap.h ('k') | src/heap/objects-visiting.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/heap/heap.cc
diff --git a/src/heap/heap.cc b/src/heap/heap.cc
index 38968ad0b33b026b2a6087a908044a9026d8c009..08eaf20308fbe815966fc8448ad174f00d7ea273 100644
--- a/src/heap/heap.cc
+++ b/src/heap/heap.cc
@@ -2742,6 +2742,7 @@ bool Heap::CreateInitialMaps() {
ALLOCATE_MAP(HEAP_NUMBER_TYPE, HeapNumber::kSize, heap_number)
ALLOCATE_MAP(MUTABLE_HEAP_NUMBER_TYPE, HeapNumber::kSize,
mutable_heap_number)
+ ALLOCATE_MAP(FLOAT32X4_TYPE, Float32x4::kSize, float32x4)
ALLOCATE_MAP(SYMBOL_TYPE, Symbol::kSize, symbol)
ALLOCATE_MAP(FOREIGN_TYPE, Foreign::kSize, foreign)
@@ -2891,6 +2892,32 @@ AllocationResult Heap::AllocateHeapNumber(double value, MutableMode mode,
}
+AllocationResult Heap::AllocateFloat32x4(float w, float x, float y, float z,
+ PretenureFlag pretenure) {
+ // Statically ensure that it is safe to allocate SIMD values in paged
+ // spaces.
+ int size = Float32x4::kSize;
+ STATIC_ASSERT(Float32x4::kSize <= Page::kMaxRegularHeapObjectSize);
+
+ AllocationSpace space = SelectSpace(size, pretenure);
+
+ HeapObject* result;
+ {
+ AllocationResult allocation =
+ AllocateRaw(size, space, OLD_SPACE, kSimd128Unaligned);
+ if (!allocation.To(&result)) return allocation;
+ }
+
+ result->set_map_no_write_barrier(float32x4_map());
+ Float32x4* float32x4 = Float32x4::cast(result);
+ float32x4->set_lane(0, w);
+ float32x4->set_lane(1, x);
+ float32x4->set_lane(2, y);
+ float32x4->set_lane(3, z);
+ return result;
+}
+
+
AllocationResult Heap::AllocateCell(Object* value) {
int size = Cell::kSize;
STATIC_ASSERT(Cell::kSize <= Page::kMaxRegularHeapObjectSize);
« no previous file with comments | « src/heap/heap.h ('k') | src/heap/objects-visiting.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698