Index: src/macros.py |
diff --git a/src/macros.py b/src/macros.py |
index 7bad23bd425369f9452fe33c90d86f31bdc14a49..464d3c7396637595d13cfcd845f8e065a636cf0d 100644 |
--- a/src/macros.py |
+++ b/src/macros.py |
@@ -99,6 +99,8 @@ macro IS_NULL(arg) = (arg === null); |
macro IS_NULL_OR_UNDEFINED(arg) = (arg == null); |
macro IS_UNDEFINED(arg) = (typeof(arg) === 'undefined'); |
macro IS_NUMBER(arg) = (typeof(arg) === 'number'); |
+macro IS_FLOAT32x4(arg) = (typeof(arg) === 'float32x4'); |
+macro IS_INT32x4(arg) = (typeof(arg) === 'int32x4'); |
macro IS_STRING(arg) = (typeof(arg) === 'string'); |
macro IS_BOOLEAN(arg) = (typeof(arg) === 'boolean'); |
macro IS_SYMBOL(arg) = (typeof(arg) === 'symbol'); |
@@ -112,6 +114,8 @@ macro IS_WEAKMAP(arg) = (%_ClassOf(arg) === 'WeakMap'); |
macro IS_WEAKSET(arg) = (%_ClassOf(arg) === 'WeakSet'); |
macro IS_DATE(arg) = (%_ClassOf(arg) === 'Date'); |
macro IS_NUMBER_WRAPPER(arg) = (%_ClassOf(arg) === 'Number'); |
+macro IS_FLOAT32x4_WRAPPER(arg) = (%_ClassOf(arg) === 'float32x4'); |
+macro IS_INT32x4_WRAPPER(arg) = (%_ClassOf(arg) === 'int32x4'); |
macro IS_STRING_WRAPPER(arg) = (%_ClassOf(arg) === 'String'); |
macro IS_SYMBOL_WRAPPER(arg) = (%_ClassOf(arg) === 'Symbol'); |
macro IS_BOOLEAN_WRAPPER(arg) = (%_ClassOf(arg) === 'Boolean'); |
@@ -156,6 +160,8 @@ macro TO_STRING_INLINE(arg) = (IS_STRING(%IS_VAR(arg)) ? arg : NonStringToString |
macro TO_NUMBER_INLINE(arg) = (IS_NUMBER(%IS_VAR(arg)) ? arg : NonNumberToNumber(arg)); |
macro TO_OBJECT_INLINE(arg) = (IS_SPEC_OBJECT(%IS_VAR(arg)) ? arg : ToObject(arg)); |
macro JSON_NUMBER_TO_STRING(arg) = ((%_IsSmi(%IS_VAR(arg)) || arg - arg == 0) ? %_NumberToString(arg) : "null"); |
+macro TO_FLOAT32x4(arg) = (IS_FLOAT32x4_WRAPPER(%IS_VAR(arg))) ? %_ValueOf(arg) : arg; |
+macro TO_INT32x4(arg) = (IS_INT32x4_WRAPPER(%IS_VAR(arg))) ? %_ValueOf(arg) : arg; |
# Private names. |
macro NEW_PRIVATE(name) = (%CreatePrivateSymbol(name)); |
@@ -260,3 +266,7 @@ const COMPILATION_TYPE_JSON = 2; |
# Matches Messages::kNoLineNumberInfo from v8.h |
const kNoLineNumberInfo = 0; |
+ |
+# For simd128.js |
+macro CHECK_FLOAT32x4(arg) = if (typeof(arg) !== 'float32x4') ThrowFloat32x4TypeError(); |
+macro CHECK_INT32x4(arg) = if (typeof(arg) !== 'int32x4') ThrowInt32x4TypeError(); |