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

Unified Diff: src/objects.cc

Issue 1219943002: Expose SIMD.Float32x4 type to Javascript. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: samevalue.js tweak. Created 5 years, 5 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
Index: src/objects.cc
diff --git a/src/objects.cc b/src/objects.cc
index 79ae57356121a3352149120eb02ecb025510fb70..fb08a43b8ba36d83624600e5d196e8aa4208706d 100644
--- a/src/objects.cc
+++ b/src/objects.cc
@@ -81,6 +81,8 @@ MaybeHandle<JSReceiver> Object::ToObject(Isolate* isolate,
constructor = handle(native_context->string_function(), isolate);
} else if (object->IsSymbol()) {
constructor = handle(native_context->symbol_function(), isolate);
+ } else if (object->IsFloat32x4()) {
+ constructor = handle(native_context->float32x4_function(), isolate);
} else {
return MaybeHandle<JSReceiver>();
}
@@ -605,7 +607,7 @@ Map* Object::GetRootMap(Isolate* isolate) {
HeapObject* heap_object = HeapObject::cast(this);
- // The object is either a number, a string, a boolean,
+ // The object is either a number, a string, a symbol, a boolean, a SIMD value,
// a real JS object, or a Harmony proxy.
if (heap_object->IsJSReceiver()) {
return heap_object->map();
@@ -624,6 +626,9 @@ Map* Object::GetRootMap(Isolate* isolate) {
if (heap_object->IsBoolean()) {
return context->boolean_function()->initial_map();
}
+ if (heap_object->IsFloat32x4()) {
+ return context->float32x4_function()->initial_map();
+ }
return isolate->heap()->null_value()->map();
}
@@ -1525,8 +1530,12 @@ void HeapNumber::HeapNumberPrint(std::ostream& os) { // NOLINT
void Float32x4::Float32x4Print(std::ostream& os) { // NOLINT
- os << get_lane(0) << ", " << get_lane(1) << ", " << get_lane(2) << ", "
- << get_lane(3);
+ char arr[100];
+ Vector<char> buffer(arr, arraysize(arr));
+ os << std::string(DoubleToCString(get_lane(0), buffer)) << ", "
+ << std::string(DoubleToCString(get_lane(1), buffer)) << ", "
+ << std::string(DoubleToCString(get_lane(2), buffer)) << ", "
+ << std::string(DoubleToCString(get_lane(3), buffer));
}
« no previous file with comments | « src/objects.h ('k') | src/objects-inl.h » ('j') | test/mjsunit/object-toprimitive.js » ('J')

Powered by Google App Engine
This is Rietveld 408576698