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

Unified Diff: src/heap.cc

Issue 90643003: Experimental implementation: Exposing SIMD instructions into JavaScript Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 1 month 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.h ('k') | src/hydrogen.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/heap.cc
diff --git a/src/heap.cc b/src/heap.cc
index cf9d6c709ee489f0658196d3244c96c12e822c1c..0818d470d7bacdd11246fadd6cd9865fbf641763 100644
--- a/src/heap.cc
+++ b/src/heap.cc
@@ -2690,6 +2690,16 @@ bool Heap::CreateInitialMaps() {
}
set_heap_number_map(Map::cast(obj));
+ { MaybeObject* maybe_obj = AllocateMap(FLOAT32x4_TYPE, Float32x4::kSize);
+ if (!maybe_obj->ToObject(&obj)) return false;
+ }
+ set_float32x4_map(Map::cast(obj));
+
+ { MaybeObject* maybe_obj = AllocateMap(INT32x4_TYPE, Int32x4::kSize);
+ if (!maybe_obj->ToObject(&obj)) return false;
+ }
+ set_int32x4_map(Map::cast(obj));
+
{ MaybeObject* maybe_obj = AllocateMap(SYMBOL_TYPE, Symbol::kSize);
if (!maybe_obj->ToObject(&obj)) return false;
}
@@ -2798,6 +2808,18 @@ bool Heap::CreateInitialMaps() {
}
set_external_float_array_map(Map::cast(obj));
+ { MaybeObject* maybe_obj = AllocateMap(EXTERNAL_FLOAT32x4_ARRAY_TYPE,
+ ExternalArray::kAlignedSize);
+ if (!maybe_obj->ToObject(&obj)) return false;
+ }
+ set_external_float32x4_array_map(Map::cast(obj));
+
+ { MaybeObject* maybe_obj = AllocateMap(EXTERNAL_INT32x4_ARRAY_TYPE,
+ ExternalArray::kAlignedSize);
+ if (!maybe_obj->ToObject(&obj)) return false;
+ }
+ set_external_int32x4_array_map(Map::cast(obj));
+
{ MaybeObject* maybe_obj =
AllocateMap(FIXED_ARRAY_TYPE, kVariableSizeSentinel);
if (!maybe_obj->ToObject(&obj)) return false;
@@ -2848,6 +2870,18 @@ bool Heap::CreateInitialMaps() {
}
set_empty_external_float_array(ExternalArray::cast(obj));
+ { MaybeObject* maybe_obj =
+ AllocateEmptyExternalArray(kExternalFloat32x4Array);
+ if (!maybe_obj->ToObject(&obj)) return false;
+ }
+ set_empty_external_float32x4_array(ExternalArray::cast(obj));
+
+ { MaybeObject* maybe_obj =
+ AllocateEmptyExternalArray(kExternalInt32x4Array);
+ if (!maybe_obj->ToObject(&obj)) return false;
+ }
+ set_empty_external_int32x4_array(ExternalArray::cast(obj));
+
{ MaybeObject* maybe_obj = AllocateEmptyExternalArray(kExternalDoubleArray);
if (!maybe_obj->ToObject(&obj)) return false;
}
@@ -2986,6 +3020,44 @@ MaybeObject* Heap::AllocateHeapNumber(double value, PretenureFlag pretenure) {
}
+MaybeObject* Heap::AllocateFloat32x4(float32x4_value_t value,
+ PretenureFlag pretenure) {
+ // Statically ensure that it is safe to allocate float32x4 objects in paged
+ // spaces.
+ int size = Float32x4::kSize;
+ STATIC_ASSERT(Float32x4::kSize <= Page::kNonCodeObjectAreaSize);
+ AllocationSpace space = (pretenure == TENURED) ? OLD_DATA_SPACE : NEW_SPACE;
+
+ Object* result;
+ { MaybeObject* maybe_result = AllocateRaw(size, space, OLD_DATA_SPACE);
+ if (!maybe_result->ToObject(&result)) return maybe_result;
+ }
+
+ HeapObject::cast(result)->set_map_no_write_barrier(float32x4_map());
+ Float32x4::cast(result)->set_value(value);
+ return result;
+}
+
+
+MaybeObject* Heap::AllocateInt32x4(int32x4_value_t value,
+ PretenureFlag pretenure) {
+ // Statically ensure that it is safe to allocate int32x4 objects in paged
+ // spaces.
+ int size = Int32x4::kSize;
+ STATIC_ASSERT(Int32x4::kSize <= Page::kNonCodeObjectAreaSize);
+ AllocationSpace space = (pretenure == TENURED) ? OLD_DATA_SPACE : NEW_SPACE;
+
+ Object* result;
+ { MaybeObject* maybe_result = AllocateRaw(size, space, OLD_DATA_SPACE);
+ if (!maybe_result->ToObject(&result)) return maybe_result;
+ }
+
+ HeapObject::cast(result)->set_map_no_write_barrier(int32x4_map());
+ Int32x4::cast(result)->set_value(value);
+ return result;
+}
+
+
MaybeObject* Heap::AllocateCell(Object* value) {
int size = Cell::kSize;
STATIC_ASSERT(Cell::kSize <= Page::kNonCodeObjectAreaSize);
@@ -3655,6 +3727,10 @@ Heap::RootListIndex Heap::RootIndexForExternalArrayType(
return kExternalUnsignedIntArrayMapRootIndex;
case kExternalFloatArray:
return kExternalFloatArrayMapRootIndex;
+ case kExternalFloat32x4Array:
+ return kExternalFloat32x4ArrayMapRootIndex;
+ case kExternalInt32x4Array:
+ return kExternalInt32x4ArrayMapRootIndex;
case kExternalDoubleArray:
return kExternalDoubleArrayMapRootIndex;
case kExternalPixelArray:
@@ -3682,6 +3758,10 @@ Heap::RootListIndex Heap::RootIndexForEmptyExternalArray(
return kEmptyExternalUnsignedIntArrayRootIndex;
case EXTERNAL_FLOAT_ELEMENTS:
return kEmptyExternalFloatArrayRootIndex;
+ case EXTERNAL_FLOAT32x4_ELEMENTS:
+ return kEmptyExternalFloat32x4ArrayRootIndex;
+ case EXTERNAL_INT32x4_ELEMENTS:
+ return kEmptyExternalInt32x4ArrayRootIndex;
case EXTERNAL_DOUBLE_ELEMENTS:
return kEmptyExternalDoubleArrayRootIndex;
case EXTERNAL_PIXEL_ELEMENTS:
« no previous file with comments | « src/heap.h ('k') | src/hydrogen.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698