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

Unified Diff: src/runtime.js

Issue 1219943002: Expose SIMD.Float32x4 type to Javascript. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Back out changes to include/v8.h 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
« no previous file with comments | « src/ppc/lithium-codegen-ppc.cc ('k') | src/runtime/runtime.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/runtime.js
diff --git a/src/runtime.js b/src/runtime.js
index e5ac2210528c7ef46d58f05de1cb0b41468498c2..dd776dbc8c354722c692c3580914398e5de26d30 100644
--- a/src/runtime.js
+++ b/src/runtime.js
@@ -103,7 +103,7 @@ EQUALS = function EQUALS(y) {
while (true) {
if (IS_NUMBER(y)) return %NumberEquals(x, y);
if (IS_NULL_OR_UNDEFINED(y)) return 1; // not equal
- if (IS_SYMBOL(y)) return 1; // not equal
+ if (IS_SYMBOL(y) || IS_FLOAT32X4(y)) return 1; // not equal
if (!IS_SPEC_OBJECT(y)) {
// String or boolean.
return %NumberEquals(x, %$toNumber(y));
@@ -113,7 +113,7 @@ EQUALS = function EQUALS(y) {
} else if (IS_STRING(x)) {
while (true) {
if (IS_STRING(y)) return %StringEquals(x, y);
- if (IS_SYMBOL(y)) return 1; // not equal
+ if (IS_SYMBOL(y) || IS_FLOAT32X4(y)) return 1; // not equal
if (IS_NUMBER(y)) return %NumberEquals(%$toNumber(x), y);
if (IS_BOOLEAN(y)) return %NumberEquals(%$toNumber(x), %$toNumber(y));
if (IS_NULL_OR_UNDEFINED(y)) return 1; // not equal
@@ -127,19 +127,23 @@ EQUALS = function EQUALS(y) {
if (IS_NULL_OR_UNDEFINED(y)) return 1;
if (IS_NUMBER(y)) return %NumberEquals(%$toNumber(x), y);
if (IS_STRING(y)) return %NumberEquals(%$toNumber(x), %$toNumber(y));
- if (IS_SYMBOL(y)) return 1; // not equal
+ if (IS_SYMBOL(y) || IS_FLOAT32X4(y)) return 1; // not equal
// y is object.
x = %$toNumber(x);
y = %$toPrimitive(y, NO_HINT);
} else if (IS_NULL_OR_UNDEFINED(x)) {
return IS_NULL_OR_UNDEFINED(y) ? 0 : 1;
+ } else if (IS_FLOAT32X4(x)) {
+ if (IS_FLOAT32X4(y))
+ return %Float32x4Equals(x, y);
+ return 1; // not equal
} else {
// x is an object.
if (IS_SPEC_OBJECT(y)) {
return %_ObjectEquals(x, y) ? 0 : 1;
}
if (IS_NULL_OR_UNDEFINED(y)) return 1; // not equal
- if (IS_SYMBOL(y)) return 1; // not equal
+ if (IS_SYMBOL(y) || IS_FLOAT32X4(y)) return 1; // not equal
if (IS_BOOLEAN(y)) y = %$toNumber(y);
x = %$toPrimitive(x, NO_HINT);
}
@@ -158,6 +162,9 @@ STRICT_EQUALS = function STRICT_EQUALS(x) {
return %NumberEquals(this, x);
}
+ if (IS_FLOAT32X4(this) && IS_FLOAT32X4(x))
+ return %Float32x4Equals(this, x);
+
// If anything else gets here, we just do simple identity check.
// Objects (including functions), null, undefined and booleans were
// checked in the CompareStub, so there should be nothing left.
@@ -760,6 +767,7 @@ function ToPrimitive(x, hint) {
// Normal behavior.
if (!IS_SPEC_OBJECT(x)) return x;
if (IS_SYMBOL_WRAPPER(x)) throw MakeTypeError(kSymbolToPrimitive);
+ if (IS_FLOAT32X4(x)) return x;
if (hint == NO_HINT) hint = (IS_DATE(x)) ? STRING_HINT : NUMBER_HINT;
return (hint == NUMBER_HINT) ? DefaultNumber(x) : DefaultString(x);
}
@@ -785,6 +793,7 @@ function ToNumber(x) {
if (IS_BOOLEAN(x)) return x ? 1 : 0;
if (IS_UNDEFINED(x)) return NAN;
if (IS_SYMBOL(x)) throw MakeTypeError(kSymbolToNumber);
+ if (IS_FLOAT32X4(x)) throw MakeTypeError(kSimdToNumber);
return (IS_NULL(x)) ? 0 : ToNumber(DefaultNumber(x));
}
@@ -796,6 +805,7 @@ function NonNumberToNumber(x) {
if (IS_BOOLEAN(x)) return x ? 1 : 0;
if (IS_UNDEFINED(x)) return NAN;
if (IS_SYMBOL(x)) throw MakeTypeError(kSymbolToNumber);
+ if (IS_FLOAT32X4(x)) throw MakeTypeError(kSimdToNumber);
return (IS_NULL(x)) ? 0 : ToNumber(DefaultNumber(x));
}
@@ -831,6 +841,7 @@ function ToObject(x) {
if (IS_NUMBER(x)) return new GlobalNumber(x);
if (IS_BOOLEAN(x)) return new GlobalBoolean(x);
if (IS_SYMBOL(x)) return %NewSymbolWrapper(x);
+ if (IS_FLOAT32X4(x)) return %NewFloat32x4Wrapper(x);
if (IS_NULL_OR_UNDEFINED(x) && !IS_UNDETECTABLE(x)) {
throw MakeTypeError(kUndefinedOrNullToObject);
}
@@ -878,6 +889,9 @@ function SameValue(x, y) {
return false;
}
}
+ if (IS_FLOAT32X4(x)) {
+ return %Float32x4SameValue(x, y);
+ }
return x === y;
}
@@ -888,9 +902,13 @@ function SameValueZero(x, y) {
if (IS_NUMBER(x)) {
if (NUMBER_IS_NAN(x) && NUMBER_IS_NAN(y)) return true;
}
+ if (IS_FLOAT32X4(x)) {
+ return %Float32x4SameValueZero(x, y);
+ }
return x === y;
}
+
function ConcatIterableToArray(target, iterable) {
var index = target.length;
for (var element of iterable) {
@@ -926,7 +944,7 @@ function IsConcatSpreadable(O) {
// ECMA-262, section 8.6.2.6, page 28.
function DefaultNumber(x) {
- if (!IS_SYMBOL_WRAPPER(x)) {
+ if (!IS_SYMBOL_WRAPPER(x) && !IS_FLOAT32X4_WRAPPER(x)) {
var valueOf = x.valueOf;
if (IS_SPEC_FUNCTION(valueOf)) {
var v = %_CallFunction(x, valueOf);
« no previous file with comments | « src/ppc/lithium-codegen-ppc.cc ('k') | src/runtime/runtime.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698