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

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: Created 5 years, 6 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/runtime.js
diff --git a/src/runtime.js b/src/runtime.js
index ed7cd0b8a2008ca5d06a5cb24d5dd65dd2073f0d..1fa82368a529abca96ae9219b6403bded3db0f0f 100644
--- a/src/runtime.js
+++ b/src/runtime.js
@@ -107,7 +107,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));
@@ -117,13 +117,13 @@ 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
y = %$toPrimitive(y, NO_HINT);
}
- } else if (IS_SYMBOL(x)) {
+ } else if (IS_SYMBOL(x) || IS_FLOAT32X4(x)) {
rossberg 2015/07/02 13:35:43 This seems wrong. There needs to be a separate cas
bbudge 2015/07/06 23:59:05 I misunderstood the spec to state that comparisons
if (IS_SYMBOL(y)) return %_ObjectEquals(x, y) ? 0 : 1;
return 1; // not equal
} else if (IS_BOOLEAN(x)) {
@@ -131,7 +131,7 @@ 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);
@@ -143,7 +143,7 @@ EQUALS = function EQUALS(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);
}
@@ -810,6 +810,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);
}
@@ -835,6 +836,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));
}
@@ -846,6 +848,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));
}
@@ -881,6 +884,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);
}
@@ -976,7 +980,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);

Powered by Google App Engine
This is Rietveld 408576698