| Index: src/objects.cc
|
| diff --git a/src/objects.cc b/src/objects.cc
|
| index 4fdb63dd877e5510e13d8dc9d49a6a071b5eaefa..efe35ed30ecab035dc602df3b821b8f9002fd238 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();
|
| }
|
|
|
| @@ -639,7 +644,7 @@ Object* Object::GetHash() {
|
|
|
| Object* Object::GetSimpleHash() {
|
| // The object is either a Smi, a HeapNumber, a name, an odd-ball,
|
| - // a real JS object, or a Harmony proxy.
|
| + // a SIMD value type, a real JS object, or a Harmony proxy.
|
| if (IsSmi()) {
|
| uint32_t hash = ComputeIntegerHash(Smi::cast(this)->value(), kZeroHashSeed);
|
| return Smi::FromInt(hash & Smi::kMaxValue);
|
| @@ -662,6 +667,16 @@ Object* Object::GetSimpleHash() {
|
| uint32_t hash = Oddball::cast(this)->to_string()->Hash();
|
| return Smi::FromInt(hash);
|
| }
|
| + if (IsFloat32x4()) {
|
| + Float32x4* simd = Float32x4::cast(this);
|
| + uint32_t seed = v8::internal::kZeroHashSeed;
|
| + uint32_t hash;
|
| + hash = ComputeIntegerHash(bit_cast<uint32_t>(simd->get_lane(0)), seed);
|
| + hash = ComputeIntegerHash(bit_cast<uint32_t>(simd->get_lane(1)), hash * 31);
|
| + hash = ComputeIntegerHash(bit_cast<uint32_t>(simd->get_lane(2)), hash * 31);
|
| + hash = ComputeIntegerHash(bit_cast<uint32_t>(simd->get_lane(3)), hash * 31);
|
| + return Smi::FromInt(hash & Smi::kMaxValue);
|
| + }
|
| DCHECK(IsJSReceiver());
|
| JSReceiver* receiver = JSReceiver::cast(this);
|
| return receiver->GetHeap()->undefined_value();
|
| @@ -688,6 +703,14 @@ bool Object::SameValue(Object* other) {
|
| if (IsString() && other->IsString()) {
|
| return String::cast(this)->Equals(String::cast(other));
|
| }
|
| + if (IsFloat32x4() && other->IsFloat32x4()) {
|
| + Float32x4* x = Float32x4::cast(this);
|
| + Float32x4* y = Float32x4::cast(other);
|
| + return v8::internal::SameValue(x->get_lane(0), y->get_lane(0)) &&
|
| + v8::internal::SameValue(x->get_lane(1), y->get_lane(1)) &&
|
| + v8::internal::SameValue(x->get_lane(2), y->get_lane(2)) &&
|
| + v8::internal::SameValue(x->get_lane(3), y->get_lane(3));
|
| + }
|
| return false;
|
| }
|
|
|
| @@ -703,6 +726,14 @@ bool Object::SameValueZero(Object* other) {
|
| if (IsString() && other->IsString()) {
|
| return String::cast(this)->Equals(String::cast(other));
|
| }
|
| + if (IsFloat32x4() && other->IsFloat32x4()) {
|
| + Float32x4* x = Float32x4::cast(this);
|
| + Float32x4* y = Float32x4::cast(other);
|
| + return v8::internal::SameValueZero(x->get_lane(0), y->get_lane(0)) &&
|
| + v8::internal::SameValueZero(x->get_lane(1), y->get_lane(1)) &&
|
| + v8::internal::SameValueZero(x->get_lane(2), y->get_lane(2)) &&
|
| + v8::internal::SameValueZero(x->get_lane(3), y->get_lane(3));
|
| + }
|
| return false;
|
| }
|
|
|
| @@ -1515,8 +1546,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));
|
| }
|
|
|
|
|
|
|