Преглед изворни кода

Adding object wrappers for SIMD types.

1. Adding SIMD object wrappers for all SIMD types.
   Populated SIMD object prototype with the needed methods (toString,
   toLocaleString, valueOf etc)
2. Added value semantics for SIMD types.
   SIMD variables can be used in operations similar to the other
   javascript variables.
3. BugFix: Chakra could become unresponsive if @@ToPrimitive of a
   javascript object is overridden by null or undefined. Adding fix.
4. Enabling previosuly disabled type conversion operationfor Uint32x4.
   Adding tests.
Arun пре 10 година
родитељ
комит
32561b63d9
64 измењених фајлова са 5293 додато и 1692 уклоњено
  1. 1 0
      lib/Parser/rterrors.h
  2. 3 4
      lib/Runtime/Language/InterpreterStackFrame.cpp
  3. 40 4
      lib/Runtime/Language/JavascriptConversion.cpp
  4. 142 41
      lib/Runtime/Language/JavascriptOperators.cpp
  5. 1 0
      lib/Runtime/Language/JavascriptOperators.h
  6. 6 0
      lib/Runtime/Language/SimdUtils.cpp
  7. 2 0
      lib/Runtime/Language/SimdUtils.h
  8. 4 0
      lib/Runtime/Library/Chakra.Runtime.Library.vcxproj
  9. 2 0
      lib/Runtime/Library/Chakra.Runtime.Library.vcxproj.filters
  10. 299 299
      lib/Runtime/Library/InJavascript/Intl.js.nojit.bc.32b.h
  11. 299 299
      lib/Runtime/Library/InJavascript/Intl.js.nojit.bc.64b.h
  12. 65 27
      lib/Runtime/Library/JavascriptBuiltInFunctionList.h
  13. 305 107
      lib/Runtime/Library/JavascriptLibrary.cpp
  14. 39 1
      lib/Runtime/Library/JavascriptLibrary.h
  15. 24 0
      lib/Runtime/Library/JavascriptLibraryBase.h
  16. 15 3
      lib/Runtime/Library/JavascriptNumber.cpp
  17. 2 0
      lib/Runtime/Library/JavascriptNumber.h
  18. 8 0
      lib/Runtime/Library/JavascriptObject.cpp
  19. 6 59
      lib/Runtime/Library/JavascriptSimdBool16x8.cpp
  20. 14 26
      lib/Runtime/Library/JavascriptSimdBool16x8.h
  21. 11 68
      lib/Runtime/Library/JavascriptSimdBool32x4.cpp
  22. 19 32
      lib/Runtime/Library/JavascriptSimdBool32x4.h
  23. 6 63
      lib/Runtime/Library/JavascriptSimdBool8x16.cpp
  24. 13 23
      lib/Runtime/Library/JavascriptSimdBool8x16.h
  25. 20 64
      lib/Runtime/Library/JavascriptSimdFloat32x4.cpp
  26. 11 20
      lib/Runtime/Library/JavascriptSimdFloat32x4.h
  27. 6 0
      lib/Runtime/Library/JavascriptSimdFloat64x2.h
  28. 12 60
      lib/Runtime/Library/JavascriptSimdInt16x8.cpp
  29. 12 19
      lib/Runtime/Library/JavascriptSimdInt16x8.h
  30. 14 54
      lib/Runtime/Library/JavascriptSimdInt32x4.cpp
  31. 13 21
      lib/Runtime/Library/JavascriptSimdInt32x4.h
  32. 12 56
      lib/Runtime/Library/JavascriptSimdInt8x16.cpp
  33. 10 21
      lib/Runtime/Library/JavascriptSimdInt8x16.h
  34. 257 0
      lib/Runtime/Library/JavascriptSimdObject.cpp
  35. 37 0
      lib/Runtime/Library/JavascriptSimdObject.h
  36. 213 0
      lib/Runtime/Library/JavascriptSimdType.cpp
  37. 42 0
      lib/Runtime/Library/JavascriptSimdType.h
  38. 12 56
      lib/Runtime/Library/JavascriptSimdUint16x8.cpp
  39. 10 21
      lib/Runtime/Library/JavascriptSimdUint16x8.h
  40. 13 60
      lib/Runtime/Library/JavascriptSimdUint32x4.cpp
  41. 10 26
      lib/Runtime/Library/JavascriptSimdUint32x4.h
  42. 12 56
      lib/Runtime/Library/JavascriptSimdUint8x16.cpp
  43. 10 21
      lib/Runtime/Library/JavascriptSimdUint8x16.h
  44. 1 11
      lib/Runtime/Library/SimdInt16x8Lib.cpp
  45. 2 0
      lib/Runtime/Library/SimdLib.h
  46. 6 12
      lib/Runtime/Library/SimdUint32x4Lib.cpp
  47. 11 0
      lib/Runtime/LibraryFunction.h
  48. 1 0
      lib/Runtime/Runtime.h
  49. 40 38
      lib/Runtime/Types/EdgeJavascriptTypeId.h
  50. 8 2
      test/Array/memset_simd.js
  51. 2 0
      test/SIMD.float32x4.asmjs/testSIMDLink-2.baseline
  52. 24 18
      test/SIMD.float32x4.asmjs/testSIMDLink-2.js
  53. 63 0
      test/SIMD.wrappers/rlexe.xml
  54. 305 0
      test/SIMD.wrappers/testBool16x8.js
  55. 304 0
      test/SIMD.wrappers/testBool32x4.js
  56. 303 0
      test/SIMD.wrappers/testBool8x16.js
  57. 305 0
      test/SIMD.wrappers/testFloat32x4.js
  58. 308 0
      test/SIMD.wrappers/testInt16x8.js
  59. 305 0
      test/SIMD.wrappers/testInt32x4.js
  60. 317 0
      test/SIMD.wrappers/testInt8x16.js
  61. 309 0
      test/SIMD.wrappers/testUint16x8.js
  62. 304 0
      test/SIMD.wrappers/testUint32x4.js
  63. 317 0
      test/SIMD.wrappers/testUint8x16.js
  64. 6 0
      test/rlexedirs.xml

+ 1 - 0
lib/Parser/rterrors.h

@@ -342,3 +342,4 @@ RT_ERROR_MSG(JSERR_CannotResolveModule, 5645, "HostResolveImportedModule failed
 RT_ERROR_MSG(JSERR_ResolveExportFailed, 5646, "Resolve export %s failed due to circular reference or resolved exports", "Resolve export failed due to circular reference or resolved exports", kjstSyntaxError, 0)
 
 RT_ERROR_MSG(JSERR_ObjectCoercible, 5647, "", "Cannot convert null or undefined to object", kjstTypeError, 0)
+RT_ERROR_MSG(JSERR_SIMDConversion, 5648, "%s: cannot be converted to a number", "Cannot be converted to a number", kjstTypeError, 0)

+ 3 - 4
lib/Runtime/Language/InterpreterStackFrame.cpp

@@ -2437,16 +2437,15 @@ namespace Js
                 {
                     case AsmJsVarType::Int32x4:
                         valid = JavascriptSIMDInt32x4::Is(value);
-                        val = ((JavascriptSIMDInt32x4*)value)->GetValue();
-
+                        val = (valid) ? ((JavascriptSIMDInt32x4*)value)->GetValue() : val;
                         break;
                     case AsmJsVarType::Float32x4:
                         valid = JavascriptSIMDFloat32x4::Is(value);
-                        val = ((JavascriptSIMDFloat32x4*)value)->GetValue();
+                        val = (valid) ? ((JavascriptSIMDFloat32x4*)value)->GetValue() : val;
                         break;
                     case AsmJsVarType::Float64x2:
                         valid = JavascriptSIMDFloat64x2::Is(value);
-                        val = ((JavascriptSIMDFloat64x2*)value)->GetValue();
+                        val = (valid) ? ((JavascriptSIMDFloat64x2*)value)->GetValue() : val;
                         break;
                     default:
                         Assert(UNREACHED);

+ 40 - 4
lib/Runtime/Language/JavascriptConversion.cpp

@@ -5,6 +5,7 @@
 #include "RuntimeLanguagePch.h"
 #include "Library/JavascriptNumberObject.h"
 #include "Library/JavascriptStringObject.h"
+#include "Library/JavascriptSimdObject.h"
 #include "Library/DateImplementation.h"
 #include "Library/JavascriptDate.h"
 
@@ -264,6 +265,7 @@ CommonNumber:
     BOOL JavascriptConversion::ToObject(Var aValue, ScriptContext* scriptContext, RecyclableObject** object)
     {
         Assert(object);
+
         switch (JavascriptOperators::GetTypeId(aValue))
         {
             case TypeIds_Undefined:
@@ -277,7 +279,14 @@ CommonNumber:
 
             default:
             {
-                *object = RecyclableObject::FromVar(aValue)->ToObject(scriptContext);
+                if (IsSimdType(aValue))
+                {
+                    *object = scriptContext->GetLibrary()->CreateSIMDObject(aValue, JavascriptOperators::GetTypeId(aValue));
+                }
+                else
+                {
+                    *object = RecyclableObject::FromVar(aValue)->ToObject(scriptContext);
+                }
                 return TRUE;
             }
         }
@@ -419,9 +428,16 @@ CommonNumber:
             return JavascriptUInt64Number::FromVar(aValue)->ToJavascriptNumber();
 
         default:
-            // if no Method exists this function falls back to OrdinaryToPrimitive
-            // if IsES6ToPrimitiveEnabled flag is off we also fall back to OrdinaryToPrimitive
-            return MethodCallToPrimitive(aValue, hint, requestContext);
+            if (IsSimdType(aValue))
+            {
+                return aValue;
+            }
+            else
+            {
+                // if no Method exists this function falls back to OrdinaryToPrimitive
+                // if IsES6ToPrimitiveEnabled flag is off we also fall back to OrdinaryToPrimitive
+                return MethodCallToPrimitive(aValue, hint, requestContext);
+            }
         }
     }
 
@@ -650,6 +666,26 @@ CommonNumber:
 
             case TypeIds_Symbol:
                 return JavascriptSymbol::FromVar(aValue)->ToString(scriptContext);
+            case TypeIds_SIMDBool8x16:
+            case TypeIds_SIMDBool16x8:
+            case TypeIds_SIMDBool32x4:
+            case TypeIds_SIMDInt8x16:
+            case TypeIds_SIMDInt16x8:
+            case TypeIds_SIMDInt32x4:
+            case TypeIds_SIMDUint8x16:
+            case TypeIds_SIMDUint16x8:
+            case TypeIds_SIMDUint32x4:
+            case TypeIds_SIMDFloat32x4:
+            {
+                Assert(aValue);
+                RecyclableObject *obj = nullptr;
+                if (!JavascriptConversion::ToObject(aValue, scriptContext, &obj))
+                {
+                    JavascriptError::ThrowTypeError(scriptContext, JSERR_This_NeedSimd, L"SIMDType.toString");
+                }
+                JavascriptSIMDObject* simdObject = static_cast<JavascriptSIMDObject*>(obj);
+                return JavascriptString::FromVar(simdObject->ToString(scriptContext));
+            }
 
             case TypeIds_GlobalObject:
                 aValue = static_cast<Js::GlobalObject*>(aValue)->ToThis();

+ 142 - 41
lib/Runtime/Language/JavascriptOperators.cpp

@@ -94,7 +94,7 @@ namespace Js
             else
             {
                 wchar_t buffer[20];
-                ::_itow_s(indexInt, buffer, sizeof(buffer)/sizeof(wchar_t), 10);
+                ::_itow_s(indexInt, buffer, sizeof(buffer) / sizeof(wchar_t), 10);
                 charcount_t length = JavascriptString::GetBufferLength(buffer);
                 if (createIfNotFound || preferJavascriptStringOverPropertyRecord)
                 {
@@ -167,7 +167,7 @@ namespace Js
 
     Var JavascriptOperators::OP_ApplyArgs(Var func, Var instance, __in_xcount(8) void** stackPtr, CallInfo callInfo, ScriptContext* scriptContext)
     {
-        int argCount=callInfo.Count;
+        int argCount = callInfo.Count;
         ///
         /// Check func has internal [[Call]] property
         /// If not, throw TypeError
@@ -183,43 +183,43 @@ namespace Js
         callInfo.Flags = CallFlags_Value;
 
         RecyclableObject *funcPtr = RecyclableObject::FromVar(func);
-        PROBE_STACK(scriptContext, Js::Constants::MinStackDefault+argCount*4);
+        PROBE_STACK(scriptContext, Js::Constants::MinStackDefault + argCount * 4);
 
-        JavascriptMethod entryPoint=funcPtr->GetEntryPoint();
+        JavascriptMethod entryPoint = funcPtr->GetEntryPoint();
         Var ret;
 
         switch (argCount) {
         case 0:
             Assert(false);
-            ret=entryPoint(funcPtr,callInfo);
+            ret = entryPoint(funcPtr, callInfo);
             break;
         case 1:
-            ret=entryPoint(funcPtr,callInfo,instance);
+            ret = entryPoint(funcPtr, callInfo, instance);
             break;
         case 2:
-            ret=entryPoint(funcPtr,callInfo,instance,stackPtr[0]);
+            ret = entryPoint(funcPtr, callInfo, instance, stackPtr[0]);
             break;
         case 3:
-            ret=entryPoint(funcPtr,callInfo,instance,stackPtr[0],stackPtr[1]);
+            ret = entryPoint(funcPtr, callInfo, instance, stackPtr[0], stackPtr[1]);
             break;
         case 4:
-            ret=entryPoint(funcPtr,callInfo,instance,stackPtr[0],stackPtr[1],stackPtr[2]);
+            ret = entryPoint(funcPtr, callInfo, instance, stackPtr[0], stackPtr[1], stackPtr[2]);
             break;
         case 5:
-            ret=entryPoint(funcPtr,callInfo,instance,stackPtr[0],stackPtr[1],stackPtr[2],stackPtr[3]);
+            ret = entryPoint(funcPtr, callInfo, instance, stackPtr[0], stackPtr[1], stackPtr[2], stackPtr[3]);
             break;
         case 6:
-            ret=entryPoint(funcPtr,callInfo,instance,stackPtr[0],stackPtr[1],stackPtr[2],stackPtr[3],stackPtr[4]);
+            ret = entryPoint(funcPtr, callInfo, instance, stackPtr[0], stackPtr[1], stackPtr[2], stackPtr[3], stackPtr[4]);
             break;
         case 7:
-            ret=entryPoint(funcPtr,callInfo,instance,stackPtr[0],stackPtr[1],stackPtr[2],stackPtr[3],stackPtr[4],stackPtr[5]);
+            ret = entryPoint(funcPtr, callInfo, instance, stackPtr[0], stackPtr[1], stackPtr[2], stackPtr[3], stackPtr[4], stackPtr[5]);
             break;
         default: {
-                // Don't need stack probe here- we just did so above
-                Arguments args(callInfo,stackPtr-1);
-                ret=JavascriptFunction::CallFunction<false>(funcPtr,entryPoint,args);
-            }
-            break;
+            // Don't need stack probe here- we just did so above
+            Arguments args(callInfo, stackPtr - 1);
+            ret = JavascriptFunction::CallFunction<false>(funcPtr, entryPoint, args);
+        }
+                 break;
         }
         return ret;
     }
@@ -267,6 +267,37 @@ namespace Js
 
     Var JavascriptOperators::Typeof(Var var, ScriptContext* scriptContext)
     {
+        if (IsSimdType(var) && scriptContext->GetConfig()->IsSimdjsEnabled())
+        {
+            switch ((JavascriptOperators::GetTypeId(var)))
+            {
+            case TypeIds_SIMDFloat32x4:
+                return scriptContext->GetLibrary()->GetSIMDFloat32x4DisplayString();
+            //case TypeIds_SIMDFloat64x2:  //Type under review by the spec.
+            //    return scriptContext->GetLibrary()->GetSIMDFloat64x2DisplayString();
+            case TypeIds_SIMDInt32x4:
+                return scriptContext->GetLibrary()->GetSIMDInt32x4DisplayString();
+            case TypeIds_SIMDInt16x8:
+                return scriptContext->GetLibrary()->GetSIMDInt16x8DisplayString();
+            case TypeIds_SIMDInt8x16:
+                return scriptContext->GetLibrary()->GetSIMDInt8x16DisplayString();
+            case TypeIds_SIMDUint32x4:
+                return scriptContext->GetLibrary()->GetSIMDUint32x4DisplayString();
+            case TypeIds_SIMDUint16x8:
+                return scriptContext->GetLibrary()->GetSIMDUint16x8DisplayString();
+            case TypeIds_SIMDUint8x16:
+                return scriptContext->GetLibrary()->GetSIMDUint8x16DisplayString();
+            case TypeIds_SIMDBool32x4:
+                return scriptContext->GetLibrary()->GetSIMDBool32x4DisplayString();
+            case TypeIds_SIMDBool16x8:
+                return scriptContext->GetLibrary()->GetSIMDBool16x8DisplayString();
+            case TypeIds_SIMDBool8x16:
+                return scriptContext->GetLibrary()->GetSIMDBool8x16DisplayString();
+            default:
+                Assert(UNREACHED);
+            }
+        }
+        //All remaining types.
         switch (JavascriptOperators::GetTypeId(var))
         {
         case TypeIds_Undefined:
@@ -279,28 +310,6 @@ namespace Js
         case TypeIds_Int64Number:
         case TypeIds_UInt64Number:
             return scriptContext->GetLibrary()->GetNumberTypeDisplayString();
-        case TypeIds_SIMDFloat32x4:
-            return scriptContext->GetLibrary()->GetSIMDFloat32x4DisplayString();
-        case TypeIds_SIMDFloat64x2:
-            return scriptContext->GetLibrary()->GetSIMDFloat64x2DisplayString();
-        case TypeIds_SIMDInt32x4:
-            return scriptContext->GetLibrary()->GetSIMDInt32x4DisplayString();
-        case TypeIds_SIMDInt16x8:
-            return scriptContext->GetLibrary()->GetSIMDInt16x8DisplayString();
-        case TypeIds_SIMDInt8x16:
-            return scriptContext->GetLibrary()->GetSIMDInt8x16DisplayString();
-        case TypeIds_SIMDUint32x4:
-            return scriptContext->GetLibrary()->GetSIMDUint32x4DisplayString();
-        case TypeIds_SIMDUint16x8:
-            return scriptContext->GetLibrary()->GetSIMDUint16x8DisplayString();
-        case TypeIds_SIMDUint8x16:
-            return scriptContext->GetLibrary()->GetSIMDUint8x16DisplayString();
-        case TypeIds_SIMDBool32x4:
-            return scriptContext->GetLibrary()->GetSIMDBool32x4DisplayString();
-        case TypeIds_SIMDBool16x8:
-            return scriptContext->GetLibrary()->GetSIMDBool16x8DisplayString();
-        case TypeIds_SIMDBool8x16:
-            return scriptContext->GetLibrary()->GetSIMDBool8x16DisplayString();
         default:
             // Falsy objects are typeof 'undefined'.
             if (RecyclableObject::FromVar(var)->GetType()->IsFalsy())
@@ -314,6 +323,7 @@ namespace Js
         }
     }
 
+
     Var JavascriptOperators::TypeofFld(Var instance, PropertyId propertyId, ScriptContext* scriptContext)
     {
         return TypeofFld_Internal(instance, false, propertyId, scriptContext);
@@ -547,6 +557,10 @@ namespace Js
                 return result;
             }
         }
+        else if (IsSimdType(aLeft) && IsSimdType(aRight))
+        {
+            return StrictEqualSIMD(aLeft, aRight, requestContext);
+        }
 
         if (RecyclableObject::FromVar(aLeft)->Equals(aRight, &result, requestContext))
         {
@@ -594,7 +608,10 @@ namespace Js
 
         double dblLeft, dblRight;
 
-Redo:
+        if (IsSimdType(aLeft) || IsSimdType(aRight))
+        {
+            JavascriptError::ThrowTypeError(scriptContext, JSERR_SIMDConversion, L"SIMD type");
+        }
         TypeId leftType = JavascriptOperators::GetTypeId(aLeft);
         TypeId rightType = JavascriptOperators::GetTypeId(aRight);
 
@@ -725,7 +742,9 @@ Redo:
                 aRight = JavascriptConversion::ToPrimitive(aRight, JavascriptHint::HintNumber, scriptContext);
                 aLeft = JavascriptConversion::ToPrimitive(aLeft, JavascriptHint::HintNumber, scriptContext);
             }
-            goto Redo;
+            //BugFix: When @@ToPrimitive of an object is overridden with a function that returns null/undefined
+            //this helper will fall into a inescapable goto loop as the checks for null/undefined were outside of the path 
+            return RelationalComparisonHelper(aLeft, aRight, scriptContext, leftFirst, undefinedAs);
         }
 
         //
@@ -746,6 +765,74 @@ Redo:
         return dblLeft < dblRight;
     }
 
+    BOOL JavascriptOperators::StrictEqualSIMD(Var aLeft, Var aRight, ScriptContext* scriptContext)
+    {
+        TypeId leftTid  = JavascriptOperators::GetTypeId(aLeft);
+        TypeId rightTid = JavascriptOperators::GetTypeId(aRight);
+        bool result = false;
+
+
+        if (leftTid != rightTid)
+        {
+            return result;
+        }
+        SIMDValue leftSimd;
+        SIMDValue rightSimd;
+        switch (leftTid)
+        {
+        case TypeIds_SIMDBool8x16:
+            leftSimd = JavascriptSIMDBool8x16::FromVar(aLeft)->GetValue();
+            rightSimd = JavascriptSIMDBool8x16::FromVar(aRight)->GetValue();
+            return (leftSimd == rightSimd);
+        case TypeIds_SIMDBool16x8:
+            leftSimd = JavascriptSIMDBool16x8::FromVar(aLeft)->GetValue();
+            rightSimd = JavascriptSIMDBool16x8::FromVar(aRight)->GetValue();
+            return (leftSimd == rightSimd);
+        case TypeIds_SIMDBool32x4:
+            leftSimd = JavascriptSIMDBool32x4::FromVar(aLeft)->GetValue();
+            rightSimd = JavascriptSIMDBool32x4::FromVar(aRight)->GetValue();
+            return (leftSimd == rightSimd);
+        case TypeIds_SIMDInt8x16:
+            leftSimd = JavascriptSIMDInt8x16::FromVar(aLeft)->GetValue();
+            rightSimd = JavascriptSIMDInt8x16::FromVar(aRight)->GetValue();
+            return (leftSimd == rightSimd);
+        case TypeIds_SIMDInt16x8:
+            leftSimd = JavascriptSIMDInt16x8::FromVar(aLeft)->GetValue();
+            rightSimd = JavascriptSIMDInt16x8::FromVar(aRight)->GetValue();
+            return (leftSimd == rightSimd);
+        case TypeIds_SIMDInt32x4:
+            leftSimd = JavascriptSIMDInt32x4::FromVar(aLeft)->GetValue();
+            rightSimd = JavascriptSIMDInt32x4::FromVar(aRight)->GetValue();
+            return (leftSimd == rightSimd);
+        case TypeIds_SIMDUint8x16:
+            leftSimd = JavascriptSIMDUint8x16::FromVar(aLeft)->GetValue();
+            rightSimd = JavascriptSIMDUint8x16::FromVar(aRight)->GetValue();
+            return (leftSimd == rightSimd);
+        case TypeIds_SIMDUint16x8:
+            leftSimd = JavascriptSIMDUint16x8::FromVar(aLeft)->GetValue();
+            rightSimd = JavascriptSIMDUint16x8::FromVar(aRight)->GetValue();
+            return (leftSimd == rightSimd);
+        case TypeIds_SIMDUint32x4:
+            leftSimd = JavascriptSIMDUint32x4::FromVar(aLeft)->GetValue();
+            rightSimd = JavascriptSIMDUint32x4::FromVar(aRight)->GetValue();
+            return (leftSimd == rightSimd);
+        case TypeIds_SIMDFloat32x4:
+            leftSimd = JavascriptSIMDFloat32x4::FromVar(aLeft)->GetValue();
+            rightSimd = JavascriptSIMDFloat32x4::FromVar(aRight)->GetValue();
+            result = true;
+            for (int i = 0; i < 4; ++i)
+            {
+                Var laneVarLeft  = JavascriptNumber::ToVarWithCheck(leftSimd.f32[i], scriptContext);
+                Var laneVarRight = JavascriptNumber::ToVarWithCheck(rightSimd.f32[i], scriptContext);
+                result = result && JavascriptOperators::Equal(laneVarLeft, laneVarRight, scriptContext);
+            }
+            return result;
+        default:
+            Assert(UNREACHED);
+        }
+        return result;
+    }
+
     BOOL JavascriptOperators::StrictEqualString(Var aLeft, Var aRight)
     {
         Assert(JavascriptOperators::GetTypeId(aRight) == TypeIds_String);
@@ -917,6 +1004,19 @@ CommonNumber:
                 }
             }
             break;
+        case TypeIds_SIMDBool8x16:
+        case TypeIds_SIMDInt8x16:
+        case TypeIds_SIMDUint8x16:
+        case TypeIds_SIMDBool16x8:
+        case TypeIds_SIMDInt16x8:
+        case TypeIds_SIMDUint16x8:
+        case TypeIds_SIMDBool32x4:
+        case TypeIds_SIMDInt32x4:
+        case TypeIds_SIMDUint32x4:
+        case TypeIds_SIMDFloat32x4:
+        case TypeIds_SIMDFloat64x2:
+            return StrictEqualSIMD(aLeft, aRight, requestContext);
+            break;
         }
 
         if (RecyclableObject::FromVar(aLeft)->CanHaveInterceptors())
@@ -4804,6 +4904,7 @@ CommonNumber:
             case TypeIds_Error:
             case TypeIds_BooleanObject:
             case TypeIds_NumberObject:
+            case TypeIds_SIMDObject:
             case TypeIds_StringObject:
             case TypeIds_Symbol:
             case TypeIds_SymbolObject:

+ 1 - 0
lib/Runtime/Language/JavascriptOperators.h

@@ -141,6 +141,7 @@ namespace Js
         static BOOL StrictEqual(Var aLeft, Var aRight,ScriptContext* scriptContext);
         static BOOL StrictEqualString(Var aLeft, Var aRight);
         static BOOL StrictEqualEmptyString(Var aLeft);
+        static BOOL StrictEqualSIMD(Var aLeft, Var aRight, ScriptContext* scriptContext);
         static BOOL NotStrictEqual(Var aLeft, Var aRight,ScriptContext* scriptContext);
 
         static BOOL HasOwnProperty(Var instance, PropertyId propertyId, ScriptContext * requestContext);

+ 6 - 0
lib/Runtime/Language/SimdUtils.cpp

@@ -6,6 +6,12 @@
 
 namespace Js
 {
+    bool IsSimdType(Var aVar)
+    {
+        TypeId tid = JavascriptOperators::GetTypeId(aVar); //Depends on contiguous SIMD TypeIds
+        return (TypeIds_SIMDFloat32x4 <= tid && tid <= TypeIds_SIMDBool8x16) ? true : false;
+    }
+
     int32 SIMDCheckTypedArrayIndex(ScriptContext* scriptContext, Var index)
     {
         int32 int32Value;

+ 2 - 0
lib/Runtime/Language/SimdUtils.h

@@ -144,6 +144,8 @@ CompileAssert(sizeof(SIMDValue) == 16);
 class ValueType;
 
 namespace Js {
+
+    bool IsSimdType(Var aVar);
     int32 SIMDCheckTypedArrayIndex(ScriptContext* scriptContext, Var index);
     int32 SIMDCheckLaneIndex(ScriptContext* scriptContext, Var lane, const int32 range = 4);
 

+ 4 - 0
lib/Runtime/Library/Chakra.Runtime.Library.vcxproj

@@ -42,6 +42,8 @@
     </ClCompile>
   </ItemDefinitionGroup>
   <ItemGroup>
+    <ClCompile Include="$(MSBuildThisFileDirectory)JavascriptSimdObject.cpp" />
+    <ClCompile Include="$(MSBuildThisFileDirectory)JavascriptSimdType.cpp" />
     <ClCompile Include="$(MSBuildThisFileDirectory)JavascriptSimdFloat32x4.cpp" />
     <ClCompile Include="$(MSBuildThisFileDirectory)SimdFloat32x4Lib.cpp" />
     <ClCompile Include="$(MSBuildThisFileDirectory)JavascriptSimdFloat64x2.cpp" />
@@ -162,6 +164,8 @@
     <ClInclude Include="ExternalLibraryBase.h" />
     <ClInclude Include="IntlEngineInterfaceExtensionObject.h" />
     <ClInclude Include="JavascriptErrorDebug.h" />
+    <ClInclude Include="JavascriptSimdObject.h" />
+    <ClInclude Include="JavascriptSimdType.h" />
     <ClInclude Include="JavascriptSimdFloat32x4.h" />
     <ClInclude Include="JavascriptSimdFloat64x2.h" />
     <ClInclude Include="JavascriptSimdInt32x4.h" />

+ 2 - 0
lib/Runtime/Library/Chakra.Runtime.Library.vcxproj.filters

@@ -69,6 +69,7 @@
     <ClCompile Include="$(MsBuildThisFileDirectory)JavascriptLibrary.cpp" />
     <ClCompile Include="$(MsBuildThisFileDirectory)JavascriptNumber.cpp" />
     <ClCompile Include="$(MsBuildThisFileDirectory)JavascriptNumberObject.cpp" />
+    <ClCompile Include="$(MsBuildThisFileDirectory)JavascriptSimdObject.cpp" />
     <ClCompile Include="$(MsBuildThisFileDirectory)JavascriptObject.cpp" />
     <ClCompile Include="$(MsBuildThisFileDirectory)JavascriptRegExpConstructor.cpp" />
     <ClCompile Include="$(MsBuildThisFileDirectory)JavascriptRegularExpression.cpp" />
@@ -180,6 +181,7 @@
     <ClInclude Include="JavascriptLibrary.h" />
     <ClInclude Include="JavascriptNumber.h" />
     <ClInclude Include="JavascriptNumberObject.h" />
+    <ClInclude Include="JavascriptSimdObject.h" />
     <ClInclude Include="JavascriptObject.h" />
     <ClInclude Include="JavascriptRegExpConstructor.h" />
     <ClInclude Include="JavascriptRegularExpression.h" />

Разлика између датотеке није приказан због своје велике величине
+ 299 - 299
lib/Runtime/Library/InJavascript/Intl.js.nojit.bc.32b.h


Разлика између датотеке није приказан због своје велике величине
+ 299 - 299
lib/Runtime/Library/InJavascript/Intl.js.nojit.bc.64b.h


+ 65 - 27
lib/Runtime/Library/JavascriptBuiltInFunctionList.h

@@ -291,7 +291,7 @@ BUILTIN(Math, Imul, Imul, FunctionInfo::ErrorOnNew)
 BUILTIN(Math, Clz32, Clz32, FunctionInfo::ErrorOnNew)
 
 // SIMDFloat32x4Lib entry points
-BUILTIN(SIMDFloat32x4Lib, Float32x4, EntryFloat32x4, FunctionInfo::None)
+BUILTIN(SIMDFloat32x4Lib, Float32x4, EntryFloat32x4, FunctionInfo::ErrorOnNew)
 BUILTIN(SIMDFloat32x4Lib, Check, EntryCheck, FunctionInfo::None)
 BUILTIN(SIMDFloat32x4Lib, Zero, EntryZero, FunctionInfo::None)
 BUILTIN(SIMDFloat32x4Lib, Splat, EntrySplat, FunctionInfo::None)
@@ -353,7 +353,7 @@ BUILTIN(SIMDFloat32x4Lib, Store2, EntryStore2, FunctionInfo::None)
 BUILTIN(SIMDFloat32x4Lib, Store3, EntryStore3, FunctionInfo::None)
 
 // SIMDInt32x4Lib entry points
-BUILTIN(SIMDInt32x4Lib, Int32x4, EntryInt32x4, FunctionInfo::None)
+BUILTIN(SIMDInt32x4Lib, Int32x4, EntryInt32x4, FunctionInfo::ErrorOnNew)
 BUILTIN(SIMDInt32x4Lib, Check,   EntryCheck,   FunctionInfo::None)
 BUILTIN(SIMDInt32x4Lib, Splat,   EntrySplat,   FunctionInfo::None)
 BUILTIN(SIMDInt32x4Lib, Bool,    EntryBool,    FunctionInfo::None)
@@ -414,7 +414,7 @@ BUILTIN(SIMDInt32x4Lib, Store2, EntryStore2, FunctionInfo::None)
 BUILTIN(SIMDInt32x4Lib, Store3, EntryStore3, FunctionInfo::None)
 
 // SIMDInt8x16Lib entry points
-BUILTIN(SIMDInt8x16Lib, Int8x16     , EntryInt8x16      , FunctionInfo::None)
+BUILTIN(SIMDInt8x16Lib, Int8x16     , EntryInt8x16      , FunctionInfo::ErrorOnNew)
 BUILTIN(SIMDInt8x16Lib, Check       , EntryCheck        , FunctionInfo::None)
 BUILTIN(SIMDInt8x16Lib, Splat       , EntrySplat        , FunctionInfo::None)
 
@@ -466,7 +466,7 @@ BUILTIN(SIMDInt8x16Lib, ExtractLane, EntryExtractLane, FunctionInfo::None)
 BUILTIN(SIMDInt8x16Lib, ReplaceLane, EntryReplaceLane, FunctionInfo::None)
 
 // SIMDFloat64x2Lib entry points
-BUILTIN(SIMDFloat64x2Lib, Float64x2, EntryFloat64x2, FunctionInfo::None)
+BUILTIN(SIMDFloat64x2Lib, Float64x2, EntryFloat64x2, FunctionInfo::ErrorOnNew)
 BUILTIN(SIMDFloat64x2Lib, Check,     EntryCheck,     FunctionInfo::None)
 BUILTIN(SIMDFloat64x2Lib, Zero, EntryZero, FunctionInfo::None)
 BUILTIN(SIMDFloat64x2Lib, Splat, EntrySplat, FunctionInfo::None)
@@ -507,7 +507,7 @@ BUILTIN(SIMDFloat64x2Lib, Clamp,    EntryClamp, FunctionInfo::None)
 BUILTIN(SIMDFloat64x2Lib, Select,   EntrySelect, FunctionInfo::None)
 
 // SIMDInt16x8Lib entry points
-BUILTIN(SIMDInt16x8Lib, Int16x8, EntryInt16x8, FunctionInfo::None)
+BUILTIN(SIMDInt16x8Lib, Int16x8, EntryInt16x8, FunctionInfo::ErrorOnNew)
 BUILTIN(SIMDInt16x8Lib, Check, EntryCheck, FunctionInfo::None)
 BUILTIN(SIMDInt16x8Lib, Splat, EntrySplat, FunctionInfo::None)
 
@@ -560,7 +560,7 @@ BUILTIN(SIMDFloat64x2Lib, Store,  EntryStore,  FunctionInfo::None)
 BUILTIN(SIMDFloat64x2Lib, Store1, EntryStore1, FunctionInfo::None)
 
 // SIMDBool32x4Lib entry points
-BUILTIN(SIMDBool32x4Lib, Bool32x4, EntryBool32x4, FunctionInfo::None)
+BUILTIN(SIMDBool32x4Lib, Bool32x4, EntryBool32x4, FunctionInfo::ErrorOnNew)
 BUILTIN(SIMDBool32x4Lib, Check, EntryCheck, FunctionInfo::None)
 BUILTIN(SIMDBool32x4Lib, Splat, EntrySplat, FunctionInfo::None)
 
@@ -578,7 +578,7 @@ BUILTIN(SIMDBool32x4Lib, Or, EntryOr, FunctionInfo::None)
 BUILTIN(SIMDBool32x4Lib, Xor, EntryXor, FunctionInfo::None)
 
 // SIMDBool16x8Lib entry points
-BUILTIN(SIMDBool16x8Lib, Bool16x8, EntryBool16x8, FunctionInfo::None)
+BUILTIN(SIMDBool16x8Lib, Bool16x8, EntryBool16x8, FunctionInfo::ErrorOnNew)
 BUILTIN(SIMDBool16x8Lib, Check, EntryCheck, FunctionInfo::None)
 BUILTIN(SIMDBool16x8Lib, Splat, EntrySplat, FunctionInfo::None)
 
@@ -596,7 +596,7 @@ BUILTIN(SIMDBool16x8Lib, Or, EntryOr, FunctionInfo::None)
 BUILTIN(SIMDBool16x8Lib, Xor, EntryXor, FunctionInfo::None)
 
 // SIMDBool8x16Lib entry points
-BUILTIN(SIMDBool8x16Lib, Bool8x16, EntryBool8x16, FunctionInfo::None)
+BUILTIN(SIMDBool8x16Lib, Bool8x16, EntryBool8x16, FunctionInfo::ErrorOnNew)
 BUILTIN(SIMDBool8x16Lib, Check, EntryCheck, FunctionInfo::None)
 BUILTIN(SIMDBool8x16Lib, Splat, EntrySplat, FunctionInfo::None)
 
@@ -614,7 +614,7 @@ BUILTIN(SIMDBool8x16Lib, Or, EntryOr, FunctionInfo::None)
 BUILTIN(SIMDBool8x16Lib, Xor, EntryXor, FunctionInfo::None)
 
 // SIMDUint8x16Lib entry points
-BUILTIN(SIMDUint8x16Lib, Uint8x16, EntryUint8x16, FunctionInfo::None)
+BUILTIN(SIMDUint8x16Lib, Uint8x16, EntryUint8x16, FunctionInfo::ErrorOnNew)
 BUILTIN(SIMDUint8x16Lib, Check, EntryCheck, FunctionInfo::None)
 BUILTIN(SIMDUint8x16Lib, Splat, EntrySplat, FunctionInfo::None)
 // Conversions
@@ -659,7 +659,7 @@ BUILTIN(SIMDUint8x16Lib, Shuffle, EntryShuffle, FunctionInfo::None)
 BUILTIN(SIMDUint8x16Lib, Select, EntrySelect, FunctionInfo::None)
 
 // SIMDUint16x8Lib entry points
-BUILTIN(SIMDUint16x8Lib, Uint16x8, EntryUint16x8, FunctionInfo::None)
+BUILTIN(SIMDUint16x8Lib, Uint16x8, EntryUint16x8, FunctionInfo::ErrorOnNew)
 BUILTIN(SIMDUint16x8Lib, Check, EntryCheck, FunctionInfo::None)
 BUILTIN(SIMDUint16x8Lib, Splat, EntrySplat, FunctionInfo::None)
 // Conversions
@@ -705,7 +705,7 @@ BUILTIN(SIMDUint16x8Lib, Shuffle, EntryShuffle, FunctionInfo::None)
 BUILTIN(SIMDUint16x8Lib, Select, EntrySelect, FunctionInfo::None)
 
 // Uint32x4
-BUILTIN(SIMDUint32x4Lib, Uint32x4, EntryUint32x4, FunctionInfo::None)
+BUILTIN(SIMDUint32x4Lib, Uint32x4, EntryUint32x4, FunctionInfo::ErrorOnNew)
 BUILTIN(SIMDUint32x4Lib, Check, EntryCheck, FunctionInfo::None)
 BUILTIN(SIMDUint32x4Lib, Splat, EntrySplat, FunctionInfo::None)
 
@@ -713,8 +713,8 @@ BUILTIN(SIMDUint32x4Lib, FromFloat32x4, EntryFromFloat32x4, FunctionInfo::None)
 BUILTIN(SIMDUint32x4Lib, FromFloat32x4Bits, EntryFromFloat32x4Bits, FunctionInfo::None)
 BUILTIN(SIMDUint32x4Lib, FromInt32x4Bits, EntryFromInt32x4Bits, FunctionInfo::None)
 
-BUILTIN(SIMDUint32x4Lib, FromInt16x8Bits,  EntryFromInt16x8Bits, FunctionInfo::None)
-BUILTIN(SIMDUint32x4Lib, FromInt8x16Bits,  EntryFromInt8x16Bits, FunctionInfo::None)
+BUILTIN(SIMDUint32x4Lib, FromInt16x8Bits, EntryFromInt16x8Bits, FunctionInfo::None)
+BUILTIN(SIMDUint32x4Lib, FromInt8x16Bits, EntryFromInt8x16Bits, FunctionInfo::None)
 BUILTIN(SIMDUint32x4Lib, FromUint16x8Bits, EntryFromUint16x8Bits, FunctionInfo::None)
 BUILTIN(SIMDUint32x4Lib, FromUint8x16Bits, EntryFromUint8x16Bits, FunctionInfo::None)
 
@@ -740,8 +740,8 @@ BUILTIN(SIMDUint32x4Lib, Equal, EntryEqual, FunctionInfo::None)
 BUILTIN(SIMDUint32x4Lib, NotEqual, EntryNotEqual, FunctionInfo::None)
 BUILTIN(SIMDUint32x4Lib, GreaterThan, EntryGreaterThan, FunctionInfo::None)
 BUILTIN(SIMDUint32x4Lib, GreaterThanOrEqual, EntryGreaterThanOrEqual, FunctionInfo::None)
-BUILTIN(SIMDUint32x4Lib, Min,EntryMin, FunctionInfo::None)
-BUILTIN(SIMDUint32x4Lib, Max,EntryMax, FunctionInfo::None)
+BUILTIN(SIMDUint32x4Lib, Min, EntryMin, FunctionInfo::None)
+BUILTIN(SIMDUint32x4Lib, Max, EntryMax, FunctionInfo::None)
 
 // ShiftOps
 BUILTIN(SIMDUint32x4Lib, ShiftLeftByScalar, EntryShiftLeftByScalar, FunctionInfo::None)
@@ -762,18 +762,56 @@ BUILTIN(SIMDUint32x4Lib, Store1, EntryStore1, FunctionInfo::None)
 BUILTIN(SIMDUint32x4Lib, Store2, EntryStore2, FunctionInfo::None)
 BUILTIN(SIMDUint32x4Lib, Store3, EntryStore3, FunctionInfo::None)
 
-// SIMD ToString entry point
-BUILTIN(JavascriptSIMDFloat32x4, ToString, EntryToString, FunctionInfo::None)
-BUILTIN(JavascriptSIMDFloat64x2, ToString, EntryToString, FunctionInfo::None)
-BUILTIN(JavascriptSIMDInt32x4, ToString, EntryToString, FunctionInfo::None)
-BUILTIN(JavascriptSIMDInt16x8, ToString, EntryToString, FunctionInfo::None)
-BUILTIN(JavascriptSIMDInt8x16, ToString, EntryToString, FunctionInfo::None)
-BUILTIN(JavascriptSIMDBool32x4, ToString, EntryToString, FunctionInfo::None)
-BUILTIN(JavascriptSIMDBool16x8, ToString, EntryToString, FunctionInfo::None)
-BUILTIN(JavascriptSIMDBool8x16, ToString, EntryToString, FunctionInfo::None)
-BUILTIN(JavascriptSIMDUint32x4, ToString, EntryToString, FunctionInfo::None)
-BUILTIN(JavascriptSIMDUint16x8, ToString, EntryToString, FunctionInfo::None)
-BUILTIN(JavascriptSIMDUint8x16, ToString, EntryToString, FunctionInfo::None)
+// SIMD object prototypes entry point
+BUILTIN(JavascriptSIMDBool8x16, ToLocaleString, EntryToLocaleString<JavascriptSIMDBool8x16>, FunctionInfo::ErrorOnNew)
+BUILTIN(JavascriptSIMDBool8x16, SymbolToPrimitive, EntrySymbolToPrimitive<JavascriptSIMDBool8x16>, FunctionInfo::ErrorOnNew)
+BUILTIN(JavascriptSIMDBool8x16, ToString, EntryToString<JavascriptSIMDBool8x16>, FunctionInfo::ErrorOnNew | FunctionInfo::HasNoSideEffect)
+BUILTIN(JavascriptSIMDBool8x16, ValueOf, EntryValueOf<JavascriptSIMDBool8x16>, FunctionInfo::ErrorOnNew | FunctionInfo::HasNoSideEffect | FunctionInfo::CanBeHoisted)
+
+BUILTIN(JavascriptSIMDBool16x8, ToLocaleString, EntryToLocaleString<JavascriptSIMDBool16x8>, FunctionInfo::ErrorOnNew)
+BUILTIN(JavascriptSIMDBool16x8, SymbolToPrimitive, EntrySymbolToPrimitive<JavascriptSIMDBool16x8>, FunctionInfo::ErrorOnNew)
+BUILTIN(JavascriptSIMDBool16x8, ToString, EntryToString<JavascriptSIMDBool16x8>, FunctionInfo::ErrorOnNew | FunctionInfo::HasNoSideEffect)
+BUILTIN(JavascriptSIMDBool16x8, ValueOf, EntryValueOf<JavascriptSIMDBool16x8>, FunctionInfo::ErrorOnNew | FunctionInfo::HasNoSideEffect | FunctionInfo::CanBeHoisted)
+
+BUILTIN(JavascriptSIMDBool32x4, ToLocaleString, EntryToLocaleString<JavascriptSIMDBool32x4>, FunctionInfo::ErrorOnNew)
+BUILTIN(JavascriptSIMDBool32x4, SymbolToPrimitive, EntrySymbolToPrimitive<JavascriptSIMDBool32x4>, FunctionInfo::ErrorOnNew)
+BUILTIN(JavascriptSIMDBool32x4, ToString, EntryToString<JavascriptSIMDBool32x4>, FunctionInfo::ErrorOnNew | FunctionInfo::HasNoSideEffect)
+BUILTIN(JavascriptSIMDBool32x4, ValueOf, EntryValueOf<JavascriptSIMDBool32x4>, FunctionInfo::ErrorOnNew | FunctionInfo::HasNoSideEffect | FunctionInfo::CanBeHoisted)
+
+BUILTIN(JavascriptSIMDInt8x16, ToLocaleString, EntryToLocaleString<JavascriptSIMDInt8x16>, FunctionInfo::ErrorOnNew)
+BUILTIN(JavascriptSIMDInt8x16, SymbolToPrimitive, EntrySymbolToPrimitive<JavascriptSIMDInt8x16>, FunctionInfo::ErrorOnNew)
+BUILTIN(JavascriptSIMDInt8x16, ToString, EntryToString<JavascriptSIMDInt8x16>, FunctionInfo::ErrorOnNew | FunctionInfo::HasNoSideEffect)
+BUILTIN(JavascriptSIMDInt8x16, ValueOf, EntryValueOf<JavascriptSIMDInt8x16>, FunctionInfo::ErrorOnNew | FunctionInfo::HasNoSideEffect | FunctionInfo::CanBeHoisted)
+
+BUILTIN(JavascriptSIMDInt16x8, ToLocaleString, EntryToLocaleString<JavascriptSIMDInt16x8>, FunctionInfo::ErrorOnNew)
+BUILTIN(JavascriptSIMDInt16x8, SymbolToPrimitive, EntrySymbolToPrimitive<JavascriptSIMDInt16x8>, FunctionInfo::ErrorOnNew)
+BUILTIN(JavascriptSIMDInt16x8, ToString, EntryToString<JavascriptSIMDInt16x8>, FunctionInfo::ErrorOnNew | FunctionInfo::HasNoSideEffect)
+BUILTIN(JavascriptSIMDInt16x8, ValueOf, EntryValueOf<JavascriptSIMDInt16x8>, FunctionInfo::ErrorOnNew | FunctionInfo::HasNoSideEffect | FunctionInfo::CanBeHoisted)
+
+BUILTIN(JavascriptSIMDInt32x4, ToLocaleString, EntryToLocaleString<JavascriptSIMDInt32x4>, FunctionInfo::ErrorOnNew)
+BUILTIN(JavascriptSIMDInt32x4, SymbolToPrimitive, EntrySymbolToPrimitive<JavascriptSIMDInt32x4>, FunctionInfo::ErrorOnNew)
+BUILTIN(JavascriptSIMDInt32x4, ToString, EntryToString<JavascriptSIMDInt32x4>, FunctionInfo::ErrorOnNew | FunctionInfo::HasNoSideEffect)
+BUILTIN(JavascriptSIMDInt32x4, ValueOf, EntryValueOf<JavascriptSIMDInt32x4>, FunctionInfo::ErrorOnNew | FunctionInfo::HasNoSideEffect | FunctionInfo::CanBeHoisted)
+
+BUILTIN(JavascriptSIMDUint8x16, ToLocaleString, EntryToLocaleString<JavascriptSIMDUint8x16>, FunctionInfo::ErrorOnNew)
+BUILTIN(JavascriptSIMDUint8x16, SymbolToPrimitive, EntrySymbolToPrimitive<JavascriptSIMDUint8x16>, FunctionInfo::ErrorOnNew)
+BUILTIN(JavascriptSIMDUint8x16, ToString, EntryToString<JavascriptSIMDUint8x16>, FunctionInfo::ErrorOnNew | FunctionInfo::HasNoSideEffect)
+BUILTIN(JavascriptSIMDUint8x16, ValueOf, EntryValueOf<JavascriptSIMDUint8x16>, FunctionInfo::ErrorOnNew | FunctionInfo::HasNoSideEffect | FunctionInfo::CanBeHoisted)
+
+BUILTIN(JavascriptSIMDUint16x8, ToLocaleString, EntryToLocaleString<JavascriptSIMDUint16x8>, FunctionInfo::ErrorOnNew)
+BUILTIN(JavascriptSIMDUint16x8, SymbolToPrimitive, EntrySymbolToPrimitive<JavascriptSIMDUint16x8>, FunctionInfo::ErrorOnNew)
+BUILTIN(JavascriptSIMDUint16x8, ToString, EntryToString<JavascriptSIMDUint16x8>, FunctionInfo::ErrorOnNew | FunctionInfo::HasNoSideEffect)
+BUILTIN(JavascriptSIMDUint16x8, ValueOf, EntryValueOf<JavascriptSIMDUint16x8>, FunctionInfo::ErrorOnNew | FunctionInfo::HasNoSideEffect | FunctionInfo::CanBeHoisted)
+
+BUILTIN(JavascriptSIMDUint32x4, ToLocaleString, EntryToLocaleString<JavascriptSIMDUint32x4>, FunctionInfo::ErrorOnNew)
+BUILTIN(JavascriptSIMDUint32x4, SymbolToPrimitive, EntrySymbolToPrimitive<JavascriptSIMDUint32x4>, FunctionInfo::ErrorOnNew)
+BUILTIN(JavascriptSIMDUint32x4, ToString, EntryToString<JavascriptSIMDUint32x4>, FunctionInfo::ErrorOnNew | FunctionInfo::HasNoSideEffect)
+BUILTIN(JavascriptSIMDUint32x4, ValueOf, EntryValueOf<JavascriptSIMDUint32x4>, FunctionInfo::ErrorOnNew | FunctionInfo::HasNoSideEffect | FunctionInfo::CanBeHoisted)
+
+BUILTIN(JavascriptSIMDFloat32x4, ToLocaleString, EntryToLocaleString<JavascriptSIMDFloat32x4> , FunctionInfo::ErrorOnNew)
+BUILTIN(JavascriptSIMDFloat32x4, SymbolToPrimitive, EntrySymbolToPrimitive<JavascriptSIMDFloat32x4>, FunctionInfo::ErrorOnNew)
+BUILTIN(JavascriptSIMDFloat32x4, ToString, EntryToString<JavascriptSIMDFloat32x4>, FunctionInfo::ErrorOnNew | FunctionInfo::HasNoSideEffect)
+BUILTIN(JavascriptSIMDFloat32x4, ValueOf, EntryValueOf<JavascriptSIMDFloat32x4>, FunctionInfo::ErrorOnNew | FunctionInfo::HasNoSideEffect | FunctionInfo::CanBeHoisted)
 
 BUILTIN(Math, Fround, Fround, FunctionInfo::ErrorOnNew)
 BUILTIN(TypedArrayBase, NewInstance, NewInstance, FunctionInfo::SkipDefaultNewObject)

+ 305 - 107
lib/Runtime/Library/JavascriptLibrary.cpp

@@ -326,6 +326,44 @@ namespace Js
             DynamicType::New(scriptContext, TypeIds_StringObject, objectPrototype, nullptr,
             DeferredTypeHandler<InitializeStringPrototype>::GetDefaultInstance()));
 
+        /* Initialize SIMD prototypes*/
+        if (GetScriptContext()->GetConfig()->IsSimdjsEnabled())
+        {
+            simdBool8x16Prototype = RecyclerNew(recycler, JavascriptSIMDObject, nullptr,
+                DynamicType::New(scriptContext, TypeIds_SIMDObject, objectPrototype, nullptr,
+                    DeferredTypeHandler<InitializeSIMDBool8x16Prototype>::GetDefaultInstance()));
+            simdBool16x8Prototype = RecyclerNew(recycler, JavascriptSIMDObject, nullptr,
+                DynamicType::New(scriptContext, TypeIds_SIMDObject, objectPrototype, nullptr,
+                    DeferredTypeHandler<InitializeSIMDBool16x8Prototype>::GetDefaultInstance()));
+            simdBool32x4Prototype = RecyclerNew(recycler, JavascriptSIMDObject, nullptr,
+                DynamicType::New(scriptContext, TypeIds_SIMDObject, objectPrototype, nullptr,
+                    DeferredTypeHandler<InitializeSIMDBool32x4Prototype>::GetDefaultInstance()));
+
+            simdInt8x16Prototype = RecyclerNew(recycler, JavascriptSIMDObject, nullptr,
+                DynamicType::New(scriptContext, TypeIds_SIMDObject, objectPrototype, nullptr,
+                    DeferredTypeHandler<InitializeSIMDInt8x16Prototype>::GetDefaultInstance()));
+            simdInt16x8Prototype = RecyclerNew(recycler, JavascriptSIMDObject, nullptr,
+                DynamicType::New(scriptContext, TypeIds_SIMDObject, objectPrototype, nullptr,
+                    DeferredTypeHandler<InitializeSIMDInt16x8Prototype>::GetDefaultInstance()));
+            simdInt32x4Prototype = RecyclerNew(recycler, JavascriptSIMDObject, nullptr,
+                DynamicType::New(scriptContext, TypeIds_SIMDObject, objectPrototype, nullptr,
+                    DeferredTypeHandler<InitializeSIMDInt32x4Prototype>::GetDefaultInstance()));
+
+            simdUint8x16Prototype = RecyclerNew(recycler, JavascriptSIMDObject, nullptr,
+                DynamicType::New(scriptContext, TypeIds_SIMDObject, objectPrototype, nullptr,
+                    DeferredTypeHandler<InitializeSIMDUint8x16Prototype>::GetDefaultInstance()));
+            simdUint16x8Prototype = RecyclerNew(recycler, JavascriptSIMDObject, nullptr,
+                DynamicType::New(scriptContext, TypeIds_SIMDObject, objectPrototype, nullptr,
+                    DeferredTypeHandler<InitializeSIMDUint16x8Prototype>::GetDefaultInstance()));
+            simdUint32x4Prototype = RecyclerNew(recycler, JavascriptSIMDObject, nullptr,
+                DynamicType::New(scriptContext, TypeIds_SIMDObject, objectPrototype, nullptr,
+                    DeferredTypeHandler<InitializeSIMDUint32x4Prototype>::GetDefaultInstance()));
+
+            simdFloat32x4Prototype = RecyclerNew(recycler, JavascriptSIMDObject, nullptr,
+                DynamicType::New(scriptContext, TypeIds_SIMDObject, objectPrototype, nullptr,
+                    DeferredTypeHandler<InitializeSIMDFloat32x4Prototype>::GetDefaultInstance()));
+        }
+
         if (scriptContext->GetConfig()->IsES6PrototypeChain())
         {
             datePrototype = DynamicObject::New(recycler,
@@ -666,19 +704,32 @@ namespace Js
         // Initialize types
         if (GetScriptContext()->GetConfig()->IsSimdjsEnabled())
         {
-            simdFloat32x4TypeStatic = StaticType::New(scriptContext, TypeIds_SIMDFloat32x4, nullValue /*prototype*/, nullptr);
-            simdFloat64x2TypeStatic = StaticType::New(scriptContext, TypeIds_SIMDFloat64x2, nullValue /*prototype*/, nullptr);
-            simdInt32x4TypeStatic = StaticType::New(scriptContext, TypeIds_SIMDInt32x4, nullValue /*prototype*/, nullptr);
-            simdInt16x8TypeStatic = StaticType::New(scriptContext, TypeIds_SIMDInt16x8, nullValue /*prototype*/, nullptr);
-            simdInt8x16TypeStatic = StaticType::New(scriptContext, TypeIds_SIMDInt8x16, nullValue /*prototype*/, nullptr);
+            simdBool8x16TypeDynamic  = DynamicType::New(scriptContext, TypeIds_SIMDObject, simdBool8x16Prototype, nullptr, NullTypeHandler<false>::GetDefaultInstance(), true, true);
+            simdBool16x8TypeDynamic  = DynamicType::New(scriptContext, TypeIds_SIMDObject, simdBool16x8Prototype, nullptr, NullTypeHandler<false>::GetDefaultInstance(), true, true);
+            simdBool32x4TypeDynamic  = DynamicType::New(scriptContext, TypeIds_SIMDObject, simdBool32x4Prototype, nullptr, NullTypeHandler<false>::GetDefaultInstance(), true, true);
+
+            simdInt8x16TypeDynamic   = DynamicType::New(scriptContext, TypeIds_SIMDObject, simdInt8x16Prototype, nullptr, NullTypeHandler<false>::GetDefaultInstance(), true, true);
+            simdInt16x8TypeDynamic   = DynamicType::New(scriptContext, TypeIds_SIMDObject, simdInt16x8Prototype, nullptr, NullTypeHandler<false>::GetDefaultInstance(), true, true);
+            simdInt32x4TypeDynamic   = DynamicType::New(scriptContext, TypeIds_SIMDObject, simdInt32x4Prototype, nullptr, NullTypeHandler<false>::GetDefaultInstance(), true, true);
+
+            simdUint8x16TypeDynamic  = DynamicType::New(scriptContext, TypeIds_SIMDObject, simdUint8x16Prototype, nullptr, NullTypeHandler<false>::GetDefaultInstance(), true, true);
+            simdUint16x8TypeDynamic  = DynamicType::New(scriptContext, TypeIds_SIMDObject, simdUint16x8Prototype, nullptr, NullTypeHandler<false>::GetDefaultInstance(), true, true);
+            simdUint32x4TypeDynamic  = DynamicType::New(scriptContext, TypeIds_SIMDObject, simdUint32x4Prototype, nullptr, NullTypeHandler<false>::GetDefaultInstance(), true, true);
+            simdFloat32x4TypeDynamic = DynamicType::New(scriptContext, TypeIds_SIMDObject, simdFloat32x4Prototype, nullptr, NullTypeHandler<false>::GetDefaultInstance(), true, true);
+
+            simdFloat32x4TypeStatic = StaticType::New(scriptContext, TypeIds_SIMDFloat32x4, simdFloat32x4Prototype , nullptr);
+            simdFloat64x2TypeStatic = StaticType::New(scriptContext, TypeIds_SIMDFloat64x2, simdFloat64x2Prototype, nullptr);
+            simdInt32x4TypeStatic   = StaticType::New(scriptContext, TypeIds_SIMDInt32x4, simdInt32x4Prototype, nullptr);
+            simdInt16x8TypeStatic   = StaticType::New(scriptContext, TypeIds_SIMDInt16x8, simdInt16x8Prototype, nullptr);
+            simdInt8x16TypeStatic   = StaticType::New(scriptContext, TypeIds_SIMDInt8x16, simdInt8x16Prototype, nullptr);
 
-            simdBool32x4TypeStatic = StaticType::New(scriptContext, TypeIds_SIMDBool32x4, nullValue /*prototype*/, nullptr);
-            simdBool16x8TypeStatic = StaticType::New(scriptContext, TypeIds_SIMDBool16x8, nullValue /*prototype*/, nullptr);
-            simdBool8x16TypeStatic = StaticType::New(scriptContext, TypeIds_SIMDBool8x16, nullValue /*prototype*/, nullptr);
+            simdBool32x4TypeStatic = StaticType::New(scriptContext, TypeIds_SIMDBool32x4, simdBool32x4Prototype, nullptr);
+            simdBool16x8TypeStatic = StaticType::New(scriptContext, TypeIds_SIMDBool16x8, simdBool16x8Prototype, nullptr);
+            simdBool8x16TypeStatic = StaticType::New(scriptContext, TypeIds_SIMDBool8x16, simdBool8x16Prototype, nullptr);
 
-            simdUint32x4TypeStatic = StaticType::New(scriptContext, TypeIds_SIMDUint32x4, nullValue /*prototype*/, nullptr);
-            simdUint16x8TypeStatic = StaticType::New(scriptContext, TypeIds_SIMDUint16x8, nullValue /*prototype*/, nullptr);
-            simdUint8x16TypeStatic = StaticType::New(scriptContext, TypeIds_SIMDUint8x16, nullValue /*prototype*/, nullptr);
+            simdUint32x4TypeStatic = StaticType::New(scriptContext, TypeIds_SIMDUint32x4, simdUint32x4Prototype, nullptr);
+            simdUint16x8TypeStatic = StaticType::New(scriptContext, TypeIds_SIMDUint16x8, simdUint16x8Prototype, nullptr);
+            simdUint8x16TypeStatic = StaticType::New(scriptContext, TypeIds_SIMDUint8x16, simdUint8x16Prototype, nullptr);
         }
 
         // Initialize Object types
@@ -1287,22 +1338,6 @@ namespace Js
                 DeferredTypeHandler<InitializeSIMDObject>::GetDefaultInstance()));
 
             AddMember(globalObject, PropertyIds::SIMD, simdObject, PropertyNone);
-
-            // TODO: Move these to constructors' prototypes per spec with wrapper object implementation.
-
-            // Initialize toString functions. Do it here instead of InitializeSIMDObject, since we can possible access those fields before SIMD object is deferred initialized (e.g. SIMD object coming from ASMJS code).
-            simdFloat32x4ToStringFunction = DefaultCreateFunction(&JavascriptSIMDFloat32x4::EntryInfo::ToString, 1, nullptr, nullptr, PropertyIds::toString);
-            simdFloat64x2ToStringFunction = DefaultCreateFunction(&JavascriptSIMDFloat64x2::EntryInfo::ToString, 1, nullptr, nullptr, PropertyIds::toString);
-            simdInt32x4ToStringFunction = DefaultCreateFunction(&JavascriptSIMDInt32x4::EntryInfo::ToString, 1, nullptr, nullptr, PropertyIds::toString);
-            simdInt16x8ToStringFunction = DefaultCreateFunction(&JavascriptSIMDInt16x8::EntryInfo::ToString, 1, nullptr, nullptr, PropertyIds::toString);
-            simdInt8x16ToStringFunction = DefaultCreateFunction(&JavascriptSIMDInt8x16::EntryInfo::ToString, 1, nullptr, nullptr, PropertyIds::toString);
-            simdBool32x4ToStringFunction = DefaultCreateFunction(&JavascriptSIMDBool32x4::EntryInfo::ToString, 1, nullptr, nullptr, PropertyIds::toString);
-            simdBool16x8ToStringFunction = DefaultCreateFunction(&JavascriptSIMDBool16x8::EntryInfo::ToString, 1, nullptr, nullptr, PropertyIds::toString);
-            simdBool8x16ToStringFunction = DefaultCreateFunction(&JavascriptSIMDBool8x16::EntryInfo::ToString, 1, nullptr, nullptr, PropertyIds::toString);
-
-            simdUint32x4ToStringFunction = DefaultCreateFunction(&JavascriptSIMDUint32x4::EntryInfo::ToString, 1, nullptr, nullptr, PropertyIds::toString);
-            simdUint16x8ToStringFunction = DefaultCreateFunction(&JavascriptSIMDUint16x8::EntryInfo::ToString, 1, nullptr, nullptr, PropertyIds::toString);
-            simdUint8x16ToStringFunction = DefaultCreateFunction(&JavascriptSIMDUint8x16::EntryInfo::ToString, 1, nullptr, nullptr, PropertyIds::toString);
         }
         debugObject = nullptr;
 
@@ -2631,8 +2666,8 @@ namespace Js
         JavascriptFunction ** builtinFuncs = library->GetBuiltinFunctions();
 
         /*** Float32x4 ***/
-        JavascriptFunction* float32x4Function = library->AddFunctionToLibraryObject(simdObject, PropertyIds::Float32x4, &SIMDFloat32x4Lib::EntryInfo::Float32x4, 5, PropertyNone);
-        builtinFuncs[BuiltinFunction::SIMD_Float32x4_Float32x4] = float32x4Function;        
+        JavascriptFunction* float32x4Function = library->AddFunctionToLibraryObjectWithPrototype(simdObject, PropertyIds::Float32x4, &SIMDFloat32x4Lib::EntryInfo::Float32x4, 5, library->simdFloat32x4Prototype, nullptr);
+        builtinFuncs[BuiltinFunction::SIMD_Float32x4_Float32x4] = float32x4Function;
         builtinFuncs[BuiltinFunction::SIMD_Float32x4_Check] = library->AddFunctionToLibraryObject(float32x4Function, PropertyIds::check, &SIMDFloat32x4Lib::EntryInfo::Check, 2, PropertyNone);
         library->AddFunctionToLibraryObject(float32x4Function, PropertyIds::zero, &SIMDFloat32x4Lib::EntryInfo::Zero, 1, PropertyNone);
         builtinFuncs[BuiltinFunction::SIMD_Float32x4_Splat] = library->AddFunctionToLibraryObject(float32x4Function, PropertyIds::splat, &SIMDFloat32x4Lib::EntryInfo::Splat, 2, PropertyNone);
@@ -2738,7 +2773,7 @@ namespace Js
         /*** End Float64x2 ***/
 
         /*** Int32x4 ***/
-        JavascriptFunction* int32x4Function = library->AddFunctionToLibraryObject(simdObject, PropertyIds::Int32x4, &SIMDInt32x4Lib::EntryInfo::Int32x4, 5, PropertyNone);
+        JavascriptFunction* int32x4Function = library->AddFunctionToLibraryObjectWithPrototype(simdObject, PropertyIds::Int32x4, &SIMDInt32x4Lib::EntryInfo::Int32x4, 5, library->simdInt32x4Prototype, nullptr);
         builtinFuncs[BuiltinFunction::SIMD_Int32x4_Int32x4] = int32x4Function;
         builtinFuncs[BuiltinFunction::SIMD_Int32x4_Check] = library->AddFunctionToLibraryObject(int32x4Function, PropertyIds::check,        &SIMDInt32x4Lib::EntryInfo::Check,      2, PropertyNone);
         builtinFuncs[BuiltinFunction::SIMD_Int32x4_Splat] = library->AddFunctionToLibraryObject(int32x4Function, PropertyIds::splat,        &SIMDInt32x4Lib::EntryInfo::Splat,      2, PropertyNone);
@@ -2800,7 +2835,9 @@ namespace Js
        /*** End Int32x4 ***/
 
         /*** Int16x8 ***/
-        JavascriptFunction* int16x8Function = library->AddFunctionToLibraryObject(simdObject, PropertyIds::Int16x8, &SIMDInt16x8Lib::EntryInfo::Int16x8, 5, PropertyNone);
+        JavascriptFunction* int16x8Function = library->AddFunctionToLibraryObjectWithPrototype(simdObject, PropertyIds::Int16x8,
+            &SIMDInt16x8Lib::EntryInfo::Int16x8, 9, library->simdInt16x8Prototype, nullptr);
+        builtinFuncs[BuiltinFunction::SIMD_Int16x8_Int16x8] = int16x8Function;
         library->AddFunctionToLibraryObject(int16x8Function, PropertyIds::splat, &SIMDInt16x8Lib::EntryInfo::Splat, 2, PropertyNone);
         library->AddFunctionToLibraryObject(int16x8Function, PropertyIds::check, &SIMDInt16x8Lib::EntryInfo::Check, 2, PropertyNone);
         // type conversions
@@ -2847,7 +2884,9 @@ namespace Js
         /*** End Int16x8 ***/
 
         /*** Int8x16 ***/
-        JavascriptFunction* int8x16Function = library->AddFunctionToLibraryObject(simdObject, PropertyIds::Int8x16, &SIMDInt8x16Lib::EntryInfo::Int8x16, 17, PropertyNone);
+        JavascriptFunction* int8x16Function = library->AddFunctionToLibraryObjectWithPrototype(simdObject, PropertyIds::Int8x16,
+            &SIMDInt8x16Lib::EntryInfo::Int8x16, 17, library->simdInt8x16Prototype, nullptr);
+        builtinFuncs[BuiltinFunction::SIMD_Int8x16_Int8x16] = int8x16Function;
         library->AddFunctionToLibraryObject(int8x16Function, PropertyIds::check, &SIMDInt8x16Lib::EntryInfo::Check, 2, PropertyNone);
         library->AddFunctionToLibraryObject(int8x16Function, PropertyIds::splat, &SIMDInt8x16Lib::EntryInfo::Splat, 2, PropertyNone);
         // type conversions
@@ -2895,7 +2934,9 @@ namespace Js
         /*** End Int8x16 ***/
 
         /*** Bool32x4 ***/
-        JavascriptFunction* bool32x4Function = library->AddFunctionToLibraryObject(simdObject, PropertyIds::Bool32x4, &SIMDBool32x4Lib::EntryInfo::Bool32x4, 5, PropertyNone);
+        JavascriptFunction* bool32x4Function = library->AddFunctionToLibraryObjectWithPrototype(simdObject, PropertyIds::Bool32x4,
+            &SIMDBool32x4Lib::EntryInfo::Bool32x4, 5, library->simdBool32x4Prototype, nullptr);
+        builtinFuncs[BuiltinFunction::SIMD_Bool32x4_Bool32x4] = bool32x4Function;
         library->AddFunctionToLibraryObject(bool32x4Function, PropertyIds::check, &SIMDBool32x4Lib::EntryInfo::Check, 2, PropertyNone);
         library->AddFunctionToLibraryObject(bool32x4Function, PropertyIds::splat, &SIMDBool32x4Lib::EntryInfo::Splat, 2, PropertyNone);
         // UnaryOps
@@ -2912,7 +2953,9 @@ namespace Js
         /*** End Bool32x4 ***/
 
         /*** Bool16x8 ***/
-        JavascriptFunction* bool16x8Function = library->AddFunctionToLibraryObject(simdObject, PropertyIds::Bool16x8, &SIMDBool16x8Lib::EntryInfo::Bool16x8, 9, PropertyNone);
+        JavascriptFunction* bool16x8Function = library->AddFunctionToLibraryObjectWithPrototype(simdObject, PropertyIds::Bool16x8,
+                &SIMDBool16x8Lib::EntryInfo::Bool16x8, 9, library->simdBool16x8Prototype, nullptr);
+        builtinFuncs[BuiltinFunction::SIMD_Bool16x8_Bool16x8] = bool16x8Function;
         library->AddFunctionToLibraryObject(bool16x8Function, PropertyIds::check, &SIMDBool16x8Lib::EntryInfo::Check, 2, PropertyNone);
         library->AddFunctionToLibraryObject(bool16x8Function, PropertyIds::splat, &SIMDBool16x8Lib::EntryInfo::Splat, 2, PropertyNone);
         // UnaryOps
@@ -2929,7 +2972,9 @@ namespace Js
         /*** End Bool16x8 ***/
 
         /*** Bool8x16 ***/
-        JavascriptFunction* bool8x16Function = library->AddFunctionToLibraryObject(simdObject, PropertyIds::Bool8x16, &SIMDBool8x16Lib::EntryInfo::Bool8x16, 17, PropertyNone);
+        JavascriptFunction* bool8x16Function = library->AddFunctionToLibraryObjectWithPrototype(simdObject, PropertyIds::Bool8x16,
+            &SIMDBool8x16Lib::EntryInfo::Bool8x16, 17, library->simdBool8x16Prototype, nullptr);
+        builtinFuncs[BuiltinFunction::SIMD_Bool8x16_Bool8x16] = bool8x16Function;
         library->AddFunctionToLibraryObject(bool8x16Function, PropertyIds::check, &SIMDBool8x16Lib::EntryInfo::Check, 2, PropertyNone);
         library->AddFunctionToLibraryObject(bool8x16Function, PropertyIds::splat, &SIMDBool8x16Lib::EntryInfo::Splat, 2, PropertyNone);
         // UnaryOps
@@ -2946,7 +2991,9 @@ namespace Js
         /*** End Bool8x16 ***/
 
         /*** Uint32x4 ***/
-        JavascriptFunction* uint32x4Function = library->AddFunctionToLibraryObject(simdObject, PropertyIds::Uint32x4, &SIMDUint32x4Lib::EntryInfo::Uint32x4, 5, PropertyNone);
+        JavascriptFunction* uint32x4Function = library->AddFunctionToLibraryObjectWithPrototype(simdObject, PropertyIds::Uint32x4,
+            &SIMDUint32x4Lib::EntryInfo::Uint32x4, 5, library->simdUint32x4Prototype, nullptr);
+        builtinFuncs[BuiltinFunction::SIMD_Uint32x4_Uint32x4] = uint32x4Function;
         library->AddFunctionToLibraryObject(uint32x4Function, PropertyIds::check, &SIMDUint32x4Lib::EntryInfo::Check, 2, PropertyNone);
         library->AddFunctionToLibraryObject(uint32x4Function, PropertyIds::splat, &SIMDUint32x4Lib::EntryInfo::Splat, 2, PropertyNone);
         // Lane Access
@@ -2997,97 +3044,101 @@ namespace Js
         /*** End Uint32x4 ***/
 
         /** Uint16x8 **/
-        JavascriptFunction* Uint16x8Function = library->AddFunctionToLibraryObject(simdObject, PropertyIds::Uint16x8, &SIMDUint16x8Lib::EntryInfo::Uint16x8, 5, PropertyNone);
-        library->AddFunctionToLibraryObject(Uint16x8Function, PropertyIds::splat, &SIMDUint16x8Lib::EntryInfo::Splat, 2, PropertyNone);
-        library->AddFunctionToLibraryObject(Uint16x8Function, PropertyIds::check, &SIMDUint16x8Lib::EntryInfo::Check, 2, PropertyNone);
+        JavascriptFunction* uint16x8Function = library->AddFunctionToLibraryObjectWithPrototype(simdObject, PropertyIds::Uint16x8,
+            &SIMDUint16x8Lib::EntryInfo::Uint16x8, 9, library->simdUint16x8Prototype, nullptr);
+        builtinFuncs[BuiltinFunction::SIMD_Uint16x8_Uint16x8] = uint16x8Function;
+        library->AddFunctionToLibraryObject(uint16x8Function, PropertyIds::splat, &SIMDUint16x8Lib::EntryInfo::Splat, 2, PropertyNone);
+        library->AddFunctionToLibraryObject(uint16x8Function, PropertyIds::check, &SIMDUint16x8Lib::EntryInfo::Check, 2, PropertyNone);
         //// type conversions
-        library->AddFunctionToLibraryObject(Uint16x8Function, PropertyIds::fromFloat32x4Bits, &SIMDUint16x8Lib::EntryInfo::FromFloat32x4Bits, 2, PropertyNone);
-        library->AddFunctionToLibraryObject(Uint16x8Function, PropertyIds::fromInt32x4Bits, &SIMDUint16x8Lib::EntryInfo::FromInt32x4Bits, 2, PropertyNone);
-        library->AddFunctionToLibraryObject(Uint16x8Function, PropertyIds::fromInt16x8Bits, &SIMDUint16x8Lib::EntryInfo::FromInt16x8Bits, 2, PropertyNone);
-        library->AddFunctionToLibraryObject(Uint16x8Function, PropertyIds::fromInt8x16Bits, &SIMDUint16x8Lib::EntryInfo::FromInt8x16Bits, 2, PropertyNone);
-        library->AddFunctionToLibraryObject(Uint16x8Function, PropertyIds::fromUint32x4Bits, &SIMDUint16x8Lib::EntryInfo::FromUint32x4Bits, 2, PropertyNone);
-        library->AddFunctionToLibraryObject(Uint16x8Function, PropertyIds::fromUint8x16Bits, &SIMDUint16x8Lib::EntryInfo::FromUint8x16Bits, 2, PropertyNone);
+        library->AddFunctionToLibraryObject(uint16x8Function, PropertyIds::fromFloat32x4Bits, &SIMDUint16x8Lib::EntryInfo::FromFloat32x4Bits, 2, PropertyNone);
+        library->AddFunctionToLibraryObject(uint16x8Function, PropertyIds::fromInt32x4Bits, &SIMDUint16x8Lib::EntryInfo::FromInt32x4Bits, 2, PropertyNone);
+        library->AddFunctionToLibraryObject(uint16x8Function, PropertyIds::fromInt16x8Bits, &SIMDUint16x8Lib::EntryInfo::FromInt16x8Bits, 2, PropertyNone);
+        library->AddFunctionToLibraryObject(uint16x8Function, PropertyIds::fromInt8x16Bits, &SIMDUint16x8Lib::EntryInfo::FromInt8x16Bits, 2, PropertyNone);
+        library->AddFunctionToLibraryObject(uint16x8Function, PropertyIds::fromUint32x4Bits, &SIMDUint16x8Lib::EntryInfo::FromUint32x4Bits, 2, PropertyNone);
+        library->AddFunctionToLibraryObject(uint16x8Function, PropertyIds::fromUint8x16Bits, &SIMDUint16x8Lib::EntryInfo::FromUint8x16Bits, 2, PropertyNone);
 
         //// UnaryOps
-        library->AddFunctionToLibraryObject(Uint16x8Function, PropertyIds::not, &SIMDUint16x8Lib::EntryInfo::Not, 2, PropertyNone);
+        library->AddFunctionToLibraryObject(uint16x8Function, PropertyIds::not, &SIMDUint16x8Lib::EntryInfo::Not, 2, PropertyNone);
         //// binary ops
-        library->AddFunctionToLibraryObject(Uint16x8Function, PropertyIds::add, &SIMDUint16x8Lib::EntryInfo::Add, 3, PropertyNone);
-        library->AddFunctionToLibraryObject(Uint16x8Function, PropertyIds::sub, &SIMDUint16x8Lib::EntryInfo::Sub, 3, PropertyNone);
-        library->AddFunctionToLibraryObject(Uint16x8Function, PropertyIds::mul, &SIMDUint16x8Lib::EntryInfo::Mul, 3, PropertyNone);
-        library->AddFunctionToLibraryObject(Uint16x8Function, PropertyIds::and, &SIMDUint16x8Lib::EntryInfo::And, 3, PropertyNone);
-        library->AddFunctionToLibraryObject(Uint16x8Function, PropertyIds::or , &SIMDUint16x8Lib::EntryInfo::Or, 3, PropertyNone);
-        library->AddFunctionToLibraryObject(Uint16x8Function, PropertyIds::xor, &SIMDUint16x8Lib::EntryInfo::Xor, 3, PropertyNone);
-        library->AddFunctionToLibraryObject(Uint16x8Function, PropertyIds::addSaturate, &SIMDUint16x8Lib::EntryInfo::AddSaturate, 3, PropertyNone);
-        library->AddFunctionToLibraryObject(Uint16x8Function, PropertyIds::subSaturate, &SIMDUint16x8Lib::EntryInfo::SubSaturate, 3, PropertyNone);
-        library->AddFunctionToLibraryObject(Uint16x8Function, PropertyIds::min, &SIMDUint16x8Lib::EntryInfo::Min, 3, PropertyNone);
-        library->AddFunctionToLibraryObject(Uint16x8Function, PropertyIds::max, &SIMDUint16x8Lib::EntryInfo::Max, 3, PropertyNone);
+        library->AddFunctionToLibraryObject(uint16x8Function, PropertyIds::add, &SIMDUint16x8Lib::EntryInfo::Add, 3, PropertyNone);
+        library->AddFunctionToLibraryObject(uint16x8Function, PropertyIds::sub, &SIMDUint16x8Lib::EntryInfo::Sub, 3, PropertyNone);
+        library->AddFunctionToLibraryObject(uint16x8Function, PropertyIds::mul, &SIMDUint16x8Lib::EntryInfo::Mul, 3, PropertyNone);
+        library->AddFunctionToLibraryObject(uint16x8Function, PropertyIds::and, &SIMDUint16x8Lib::EntryInfo::And, 3, PropertyNone);
+        library->AddFunctionToLibraryObject(uint16x8Function, PropertyIds::or , &SIMDUint16x8Lib::EntryInfo::Or, 3, PropertyNone);
+        library->AddFunctionToLibraryObject(uint16x8Function, PropertyIds::xor, &SIMDUint16x8Lib::EntryInfo::Xor, 3, PropertyNone);
+        library->AddFunctionToLibraryObject(uint16x8Function, PropertyIds::addSaturate, &SIMDUint16x8Lib::EntryInfo::AddSaturate, 3, PropertyNone);
+        library->AddFunctionToLibraryObject(uint16x8Function, PropertyIds::subSaturate, &SIMDUint16x8Lib::EntryInfo::SubSaturate, 3, PropertyNone);
+        library->AddFunctionToLibraryObject(uint16x8Function, PropertyIds::min, &SIMDUint16x8Lib::EntryInfo::Min, 3, PropertyNone);
+        library->AddFunctionToLibraryObject(uint16x8Function, PropertyIds::max, &SIMDUint16x8Lib::EntryInfo::Max, 3, PropertyNone);
         //// compare ops
-        library->AddFunctionToLibraryObject(Uint16x8Function, PropertyIds::lessThan, &SIMDUint16x8Lib::EntryInfo::LessThan, 3, PropertyNone);
-        library->AddFunctionToLibraryObject(Uint16x8Function, PropertyIds::lessThanOrEqual, &SIMDUint16x8Lib::EntryInfo::LessThanOrEqual, 3, PropertyNone);
-        library->AddFunctionToLibraryObject(Uint16x8Function, PropertyIds::equal, &SIMDUint16x8Lib::EntryInfo::Equal, 3, PropertyNone);
-        library->AddFunctionToLibraryObject(Uint16x8Function, PropertyIds::notEqual, &SIMDUint16x8Lib::EntryInfo::NotEqual, 3, PropertyNone);
-        library->AddFunctionToLibraryObject(Uint16x8Function, PropertyIds::greaterThan, &SIMDUint16x8Lib::EntryInfo::GreaterThan, 3, PropertyNone);
-        library->AddFunctionToLibraryObject(Uint16x8Function, PropertyIds::greaterThanOrEqual, &SIMDUint16x8Lib::EntryInfo::GreaterThanOrEqual, 3, PropertyNone);
+        library->AddFunctionToLibraryObject(uint16x8Function, PropertyIds::lessThan, &SIMDUint16x8Lib::EntryInfo::LessThan, 3, PropertyNone);
+        library->AddFunctionToLibraryObject(uint16x8Function, PropertyIds::lessThanOrEqual, &SIMDUint16x8Lib::EntryInfo::LessThanOrEqual, 3, PropertyNone);
+        library->AddFunctionToLibraryObject(uint16x8Function, PropertyIds::equal, &SIMDUint16x8Lib::EntryInfo::Equal, 3, PropertyNone);
+        library->AddFunctionToLibraryObject(uint16x8Function, PropertyIds::notEqual, &SIMDUint16x8Lib::EntryInfo::NotEqual, 3, PropertyNone);
+        library->AddFunctionToLibraryObject(uint16x8Function, PropertyIds::greaterThan, &SIMDUint16x8Lib::EntryInfo::GreaterThan, 3, PropertyNone);
+        library->AddFunctionToLibraryObject(uint16x8Function, PropertyIds::greaterThanOrEqual, &SIMDUint16x8Lib::EntryInfo::GreaterThanOrEqual, 3, PropertyNone);
         //// Lane Access
-        library->AddFunctionToLibraryObject(Uint16x8Function, PropertyIds::extractLane, &SIMDUint16x8Lib::EntryInfo::ExtractLane, 3, PropertyNone);
-        library->AddFunctionToLibraryObject(Uint16x8Function, PropertyIds::replaceLane, &SIMDUint16x8Lib::EntryInfo::ReplaceLane, 3, PropertyNone);
+        library->AddFunctionToLibraryObject(uint16x8Function, PropertyIds::extractLane, &SIMDUint16x8Lib::EntryInfo::ExtractLane, 3, PropertyNone);
+        library->AddFunctionToLibraryObject(uint16x8Function, PropertyIds::replaceLane, &SIMDUint16x8Lib::EntryInfo::ReplaceLane, 3, PropertyNone);
         //// shift
-        library->AddFunctionToLibraryObject(Uint16x8Function, PropertyIds::shiftLeftByScalar, &SIMDUint16x8Lib::EntryInfo::ShiftLeftByScalar, 3, PropertyNone);
-        library->AddFunctionToLibraryObject(Uint16x8Function, PropertyIds::shiftRightByScalar, &SIMDUint16x8Lib::EntryInfo::ShiftRightByScalar, 3, PropertyNone);
+        library->AddFunctionToLibraryObject(uint16x8Function, PropertyIds::shiftLeftByScalar, &SIMDUint16x8Lib::EntryInfo::ShiftLeftByScalar, 3, PropertyNone);
+        library->AddFunctionToLibraryObject(uint16x8Function, PropertyIds::shiftRightByScalar, &SIMDUint16x8Lib::EntryInfo::ShiftRightByScalar, 3, PropertyNone);
         //// load/store
-        library->AddFunctionToLibraryObject(Uint16x8Function, PropertyIds::load, &SIMDUint16x8Lib::EntryInfo::Load, 3, PropertyNone);
-        library->AddFunctionToLibraryObject(Uint16x8Function, PropertyIds::store, &SIMDUint16x8Lib::EntryInfo::Store, 3, PropertyNone);
+        library->AddFunctionToLibraryObject(uint16x8Function, PropertyIds::load, &SIMDUint16x8Lib::EntryInfo::Load, 3, PropertyNone);
+        library->AddFunctionToLibraryObject(uint16x8Function, PropertyIds::store, &SIMDUint16x8Lib::EntryInfo::Store, 3, PropertyNone);
         //// others
-        library->AddFunctionToLibraryObject(Uint16x8Function, PropertyIds::swizzle, &SIMDUint16x8Lib::EntryInfo::Swizzle, 10, PropertyNone);
-        library->AddFunctionToLibraryObject(Uint16x8Function, PropertyIds::shuffle, &SIMDUint16x8Lib::EntryInfo::Shuffle, 11, PropertyNone);
-        library->AddFunctionToLibraryObject(Uint16x8Function, PropertyIds::select, &SIMDUint16x8Lib::EntryInfo::Select, 4, PropertyNone);
+        library->AddFunctionToLibraryObject(uint16x8Function, PropertyIds::swizzle, &SIMDUint16x8Lib::EntryInfo::Swizzle, 10, PropertyNone);
+        library->AddFunctionToLibraryObject(uint16x8Function, PropertyIds::shuffle, &SIMDUint16x8Lib::EntryInfo::Shuffle, 11, PropertyNone);
+        library->AddFunctionToLibraryObject(uint16x8Function, PropertyIds::select, &SIMDUint16x8Lib::EntryInfo::Select, 4, PropertyNone);
         /** end Uint16x8 **/
 
         /** Uint8x16**/
-        JavascriptFunction* Uint8x16Function = library->AddFunctionToLibraryObject(simdObject, PropertyIds::Uint8x16, &SIMDUint8x16Lib::EntryInfo::Uint8x16, 5, PropertyNone);
-        library->AddFunctionToLibraryObject(Uint8x16Function, PropertyIds::splat, &SIMDUint8x16Lib::EntryInfo::Splat, 2, PropertyNone);
-        library->AddFunctionToLibraryObject(Uint8x16Function, PropertyIds::check, &SIMDUint8x16Lib::EntryInfo::Check, 2, PropertyNone);
+        JavascriptFunction* uint8x16Function = library->AddFunctionToLibraryObjectWithPrototype(simdObject, PropertyIds::Uint8x16,
+            &SIMDUint8x16Lib::EntryInfo::Uint8x16, 17, library->simdUint8x16Prototype, nullptr);
+        builtinFuncs[BuiltinFunction::SIMD_Uint8x16_Uint8x16] = uint8x16Function;
+        library->AddFunctionToLibraryObject(uint8x16Function, PropertyIds::splat, &SIMDUint8x16Lib::EntryInfo::Splat, 2, PropertyNone);
+        library->AddFunctionToLibraryObject(uint8x16Function, PropertyIds::check, &SIMDUint8x16Lib::EntryInfo::Check, 2, PropertyNone);
         //// type conversions
-        library->AddFunctionToLibraryObject(Uint8x16Function, PropertyIds::fromInt32x4Bits, &SIMDUint8x16Lib::EntryInfo::FromInt32x4Bits, 2, PropertyNone);
-        library->AddFunctionToLibraryObject(Uint8x16Function, PropertyIds::fromInt16x8Bits, &SIMDUint8x16Lib::EntryInfo::FromInt16x8Bits, 2, PropertyNone);
-        library->AddFunctionToLibraryObject(Uint8x16Function, PropertyIds::fromInt8x16Bits, &SIMDUint8x16Lib::EntryInfo::FromInt8x16Bits, 2, PropertyNone);
-        library->AddFunctionToLibraryObject(Uint8x16Function, PropertyIds::fromUint32x4Bits, &SIMDUint8x16Lib::EntryInfo::FromUint32x4Bits, 2, PropertyNone);
-        library->AddFunctionToLibraryObject(Uint8x16Function, PropertyIds::fromUint16x8Bits, &SIMDUint8x16Lib::EntryInfo::FromUint16x8Bits, 2, PropertyNone);
-        library->AddFunctionToLibraryObject(Uint8x16Function, PropertyIds::fromFloat32x4Bits, &SIMDUint8x16Lib::EntryInfo::FromFloat32x4Bits, 2, PropertyNone);
+        library->AddFunctionToLibraryObject(uint8x16Function, PropertyIds::fromInt32x4Bits, &SIMDUint8x16Lib::EntryInfo::FromInt32x4Bits, 2, PropertyNone);
+        library->AddFunctionToLibraryObject(uint8x16Function, PropertyIds::fromInt16x8Bits, &SIMDUint8x16Lib::EntryInfo::FromInt16x8Bits, 2, PropertyNone);
+        library->AddFunctionToLibraryObject(uint8x16Function, PropertyIds::fromInt8x16Bits, &SIMDUint8x16Lib::EntryInfo::FromInt8x16Bits, 2, PropertyNone);
+        library->AddFunctionToLibraryObject(uint8x16Function, PropertyIds::fromUint32x4Bits, &SIMDUint8x16Lib::EntryInfo::FromUint32x4Bits, 2, PropertyNone);
+        library->AddFunctionToLibraryObject(uint8x16Function, PropertyIds::fromUint16x8Bits, &SIMDUint8x16Lib::EntryInfo::FromUint16x8Bits, 2, PropertyNone);
+        library->AddFunctionToLibraryObject(uint8x16Function, PropertyIds::fromFloat32x4Bits, &SIMDUint8x16Lib::EntryInfo::FromFloat32x4Bits, 2, PropertyNone);
 
         //// UnaryOps
-        library->AddFunctionToLibraryObject(Uint8x16Function, PropertyIds::not, &SIMDUint8x16Lib::EntryInfo::Not, 2, PropertyNone);
+        library->AddFunctionToLibraryObject(uint8x16Function, PropertyIds::not, &SIMDUint8x16Lib::EntryInfo::Not, 2, PropertyNone);
         //// binary ops
-        library->AddFunctionToLibraryObject(Uint8x16Function, PropertyIds::add, &SIMDUint8x16Lib::EntryInfo::Add, 3, PropertyNone);
-        library->AddFunctionToLibraryObject(Uint8x16Function, PropertyIds::sub, &SIMDUint8x16Lib::EntryInfo::Sub, 3, PropertyNone);
-        library->AddFunctionToLibraryObject(Uint8x16Function, PropertyIds::mul, &SIMDUint8x16Lib::EntryInfo::Mul, 3, PropertyNone);
-        library->AddFunctionToLibraryObject(Uint8x16Function, PropertyIds::and, &SIMDUint8x16Lib::EntryInfo::And, 3, PropertyNone);
-        library->AddFunctionToLibraryObject(Uint8x16Function, PropertyIds::or , &SIMDUint8x16Lib::EntryInfo::Or, 3, PropertyNone);
-        library->AddFunctionToLibraryObject(Uint8x16Function, PropertyIds::xor, &SIMDUint8x16Lib::EntryInfo::Xor, 3, PropertyNone);
-        library->AddFunctionToLibraryObject(Uint8x16Function, PropertyIds::addSaturate, &SIMDUint8x16Lib::EntryInfo::AddSaturate, 3, PropertyNone);
-        library->AddFunctionToLibraryObject(Uint8x16Function, PropertyIds::subSaturate, &SIMDUint8x16Lib::EntryInfo::SubSaturate, 3, PropertyNone);
-        library->AddFunctionToLibraryObject(Uint8x16Function, PropertyIds::min, &SIMDUint8x16Lib::EntryInfo::Min, 3, PropertyNone);
-        library->AddFunctionToLibraryObject(Uint8x16Function, PropertyIds::max, &SIMDUint8x16Lib::EntryInfo::Max, 3, PropertyNone);
+        library->AddFunctionToLibraryObject(uint8x16Function, PropertyIds::add, &SIMDUint8x16Lib::EntryInfo::Add, 3, PropertyNone);
+        library->AddFunctionToLibraryObject(uint8x16Function, PropertyIds::sub, &SIMDUint8x16Lib::EntryInfo::Sub, 3, PropertyNone);
+        library->AddFunctionToLibraryObject(uint8x16Function, PropertyIds::mul, &SIMDUint8x16Lib::EntryInfo::Mul, 3, PropertyNone);
+        library->AddFunctionToLibraryObject(uint8x16Function, PropertyIds::and, &SIMDUint8x16Lib::EntryInfo::And, 3, PropertyNone);
+        library->AddFunctionToLibraryObject(uint8x16Function, PropertyIds::or , &SIMDUint8x16Lib::EntryInfo::Or, 3, PropertyNone);
+        library->AddFunctionToLibraryObject(uint8x16Function, PropertyIds::xor, &SIMDUint8x16Lib::EntryInfo::Xor, 3, PropertyNone);
+        library->AddFunctionToLibraryObject(uint8x16Function, PropertyIds::addSaturate, &SIMDUint8x16Lib::EntryInfo::AddSaturate, 3, PropertyNone);
+        library->AddFunctionToLibraryObject(uint8x16Function, PropertyIds::subSaturate, &SIMDUint8x16Lib::EntryInfo::SubSaturate, 3, PropertyNone);
+        library->AddFunctionToLibraryObject(uint8x16Function, PropertyIds::min, &SIMDUint8x16Lib::EntryInfo::Min, 3, PropertyNone);
+        library->AddFunctionToLibraryObject(uint8x16Function, PropertyIds::max, &SIMDUint8x16Lib::EntryInfo::Max, 3, PropertyNone);
         //// compare ops
-        library->AddFunctionToLibraryObject(Uint8x16Function, PropertyIds::lessThan, &SIMDUint8x16Lib::EntryInfo::LessThan, 3, PropertyNone);
-        library->AddFunctionToLibraryObject(Uint8x16Function, PropertyIds::lessThanOrEqual, &SIMDUint8x16Lib::EntryInfo::LessThanOrEqual, 3, PropertyNone);
-        library->AddFunctionToLibraryObject(Uint8x16Function, PropertyIds::equal, &SIMDUint8x16Lib::EntryInfo::Equal, 3, PropertyNone);
-        library->AddFunctionToLibraryObject(Uint8x16Function, PropertyIds::notEqual, &SIMDUint8x16Lib::EntryInfo::NotEqual, 3, PropertyNone);
-        library->AddFunctionToLibraryObject(Uint8x16Function, PropertyIds::greaterThan, &SIMDUint8x16Lib::EntryInfo::GreaterThan, 3, PropertyNone);
-        library->AddFunctionToLibraryObject(Uint8x16Function, PropertyIds::greaterThanOrEqual, &SIMDUint8x16Lib::EntryInfo::GreaterThanOrEqual, 3, PropertyNone);
+        library->AddFunctionToLibraryObject(uint8x16Function, PropertyIds::lessThan, &SIMDUint8x16Lib::EntryInfo::LessThan, 3, PropertyNone);
+        library->AddFunctionToLibraryObject(uint8x16Function, PropertyIds::lessThanOrEqual, &SIMDUint8x16Lib::EntryInfo::LessThanOrEqual, 3, PropertyNone);
+        library->AddFunctionToLibraryObject(uint8x16Function, PropertyIds::equal, &SIMDUint8x16Lib::EntryInfo::Equal, 3, PropertyNone);
+        library->AddFunctionToLibraryObject(uint8x16Function, PropertyIds::notEqual, &SIMDUint8x16Lib::EntryInfo::NotEqual, 3, PropertyNone);
+        library->AddFunctionToLibraryObject(uint8x16Function, PropertyIds::greaterThan, &SIMDUint8x16Lib::EntryInfo::GreaterThan, 3, PropertyNone);
+        library->AddFunctionToLibraryObject(uint8x16Function, PropertyIds::greaterThanOrEqual, &SIMDUint8x16Lib::EntryInfo::GreaterThanOrEqual, 3, PropertyNone);
         //// Lane Access
-        library->AddFunctionToLibraryObject(Uint8x16Function, PropertyIds::extractLane, &SIMDUint8x16Lib::EntryInfo::ExtractLane, 3, PropertyNone);
-        library->AddFunctionToLibraryObject(Uint8x16Function, PropertyIds::replaceLane, &SIMDUint8x16Lib::EntryInfo::ReplaceLane, 3, PropertyNone);
+        library->AddFunctionToLibraryObject(uint8x16Function, PropertyIds::extractLane, &SIMDUint8x16Lib::EntryInfo::ExtractLane, 3, PropertyNone);
+        library->AddFunctionToLibraryObject(uint8x16Function, PropertyIds::replaceLane, &SIMDUint8x16Lib::EntryInfo::ReplaceLane, 3, PropertyNone);
         //// shift
-        library->AddFunctionToLibraryObject(Uint8x16Function, PropertyIds::shiftLeftByScalar, &SIMDUint8x16Lib::EntryInfo::ShiftLeftByScalar, 3, PropertyNone);
-        library->AddFunctionToLibraryObject(Uint8x16Function, PropertyIds::shiftRightByScalar, &SIMDUint8x16Lib::EntryInfo::ShiftRightByScalar, 3, PropertyNone);
+        library->AddFunctionToLibraryObject(uint8x16Function, PropertyIds::shiftLeftByScalar, &SIMDUint8x16Lib::EntryInfo::ShiftLeftByScalar, 3, PropertyNone);
+        library->AddFunctionToLibraryObject(uint8x16Function, PropertyIds::shiftRightByScalar, &SIMDUint8x16Lib::EntryInfo::ShiftRightByScalar, 3, PropertyNone);
         //// load/store
-        library->AddFunctionToLibraryObject(Uint8x16Function, PropertyIds::load, &SIMDUint8x16Lib::EntryInfo::Load, 3, PropertyNone);
-        library->AddFunctionToLibraryObject(Uint8x16Function, PropertyIds::store, &SIMDUint8x16Lib::EntryInfo::Store, 3, PropertyNone);
+        library->AddFunctionToLibraryObject(uint8x16Function, PropertyIds::load, &SIMDUint8x16Lib::EntryInfo::Load, 3, PropertyNone);
+        library->AddFunctionToLibraryObject(uint8x16Function, PropertyIds::store, &SIMDUint8x16Lib::EntryInfo::Store, 3, PropertyNone);
         //// others
-        library->AddFunctionToLibraryObject(Uint8x16Function, PropertyIds::swizzle, &SIMDUint8x16Lib::EntryInfo::Swizzle, 18, PropertyNone);
-        library->AddFunctionToLibraryObject(Uint8x16Function, PropertyIds::shuffle, &SIMDUint8x16Lib::EntryInfo::Shuffle, 19, PropertyNone);
-        library->AddFunctionToLibraryObject(Uint8x16Function, PropertyIds::select, &SIMDUint8x16Lib::EntryInfo::Select, 4, PropertyNone);
+        library->AddFunctionToLibraryObject(uint8x16Function, PropertyIds::swizzle, &SIMDUint8x16Lib::EntryInfo::Swizzle, 18, PropertyNone);
+        library->AddFunctionToLibraryObject(uint8x16Function, PropertyIds::shuffle, &SIMDUint8x16Lib::EntryInfo::Shuffle, 19, PropertyNone);
+        library->AddFunctionToLibraryObject(uint8x16Function, PropertyIds::select, &SIMDUint8x16Lib::EntryInfo::Select, 4, PropertyNone);
         /** end Uint8x16 **/
     }
 
@@ -3733,7 +3784,114 @@ namespace Js
 
         numberPrototype->SetHasNoEnumerableProperties(true);
     }
+    template<typename SIMDTypeName>
+    void JavascriptLibrary::SIMDPrototypeInitHelper(DynamicObject* simdPrototype, JavascriptLibrary* library, JavascriptFunction* constructorFn, JavascriptString* strLiteral)
+    {
+        ScriptContext* scriptContext = simdPrototype->GetScriptContext();
+        //The initial value of SIMDConstructor.prototype.constructor is the intrinsic object %SIMDConstructor%
+        library->AddMember(simdPrototype, PropertyIds::constructor, constructorFn);
+
+        scriptContext->SetBuiltInLibraryFunction(SIMDTypeName::EntryInfo::ToLocaleString.GetOriginalEntryPoint(),
+            library->AddFunctionToLibraryObject(simdPrototype, PropertyIds::toLocaleString, &SIMDTypeName::EntryInfo::ToLocaleString, 0));
+        scriptContext->SetBuiltInLibraryFunction(SIMDTypeName::EntryInfo::ToString.GetOriginalEntryPoint(),
+            library->AddFunctionToLibraryObject(simdPrototype, PropertyIds::toString, &SIMDTypeName::EntryInfo::ToString, 1));
+        scriptContext->SetBuiltInLibraryFunction(SIMDTypeName::EntryInfo::ValueOf.GetOriginalEntryPoint(),
+            library->AddFunctionToLibraryObject(simdPrototype, PropertyIds::valueOf, &SIMDTypeName::EntryInfo::ValueOf, 0));
+
+        if (scriptContext->GetConfig()->IsES6ToStringTagEnabled())
+        {
+            library->AddMember(simdPrototype, PropertyIds::_symbolToStringTag, strLiteral, PropertyConfigurable);
+        }
+
+        if (scriptContext->GetConfig()->IsES6ToPrimitiveEnabled())
+        {
+            scriptContext->SetBuiltInLibraryFunction(SIMDTypeName::EntryInfo::SymbolToPrimitive.GetOriginalEntryPoint(),
+                library->AddFunctionToLibraryObjectWithName(simdPrototype, PropertyIds::_symbolToPrimitive, PropertyIds::_RuntimeFunctionNameId_toPrimitive,
+                    &SIMDTypeName::EntryInfo::SymbolToPrimitive, 1));
+            simdPrototype->SetWritable(PropertyIds::_symbolToPrimitive, false);
+        }
+        simdPrototype->SetHasNoEnumerableProperties(true);
+
+    }
+    void JavascriptLibrary::InitializeSIMDBool8x16Prototype(DynamicObject* simdPrototype, DeferredTypeHandlerBase * typeHandler, DeferredInitializeMode mode)
+    {
+        typeHandler->Convert(simdPrototype, mode, 6);
+        JavascriptLibrary* library = simdPrototype->GetLibrary();
+        SIMDPrototypeInitHelper<JavascriptSIMDBool8x16>(simdPrototype, library, library->GetBuiltinFunctions()[BuiltinFunction::SIMD_Bool8x16_Bool8x16],
+            library->CreateStringFromCppLiteral(L"SIMD.Bool8x16"));
+    }
 
+    void JavascriptLibrary::InitializeSIMDBool16x8Prototype(DynamicObject* simdPrototype, DeferredTypeHandlerBase * typeHandler, DeferredInitializeMode mode)
+    {
+        typeHandler->Convert(simdPrototype, mode, 6);
+        JavascriptLibrary* library = simdPrototype->GetLibrary();
+        SIMDPrototypeInitHelper<JavascriptSIMDBool16x8>(simdPrototype, library, library->GetBuiltinFunctions()[BuiltinFunction::SIMD_Bool16x8_Bool16x8],
+            library->CreateStringFromCppLiteral(L"SIMD.Bool16x8"));
+    }
+
+    void JavascriptLibrary::InitializeSIMDBool32x4Prototype(DynamicObject* simdPrototype, DeferredTypeHandlerBase * typeHandler, DeferredInitializeMode mode)
+    {
+        typeHandler->Convert(simdPrototype, mode, 6);
+        JavascriptLibrary* library = simdPrototype->GetLibrary();
+        SIMDPrototypeInitHelper<JavascriptSIMDBool32x4>(simdPrototype, library, library->GetBuiltinFunctions()[BuiltinFunction::SIMD_Bool32x4_Bool32x4],
+            library->CreateStringFromCppLiteral(L"SIMD.Bool32x4"));
+    }
+
+    void JavascriptLibrary::InitializeSIMDInt8x16Prototype(DynamicObject* simdPrototype, DeferredTypeHandlerBase * typeHandler, DeferredInitializeMode mode)
+    {
+        typeHandler->Convert(simdPrototype, mode, 6);
+        JavascriptLibrary* library = simdPrototype->GetLibrary();
+        SIMDPrototypeInitHelper<JavascriptSIMDInt8x16>(simdPrototype, library, library->GetBuiltinFunctions()[BuiltinFunction::SIMD_Int8x16_Int8x16],
+            library->CreateStringFromCppLiteral(L"SIMD.Int8x16"));
+    }
+
+    void JavascriptLibrary::InitializeSIMDInt16x8Prototype(DynamicObject* simdPrototype, DeferredTypeHandlerBase * typeHandler, DeferredInitializeMode mode)
+    {
+        typeHandler->Convert(simdPrototype, mode, 6);
+        JavascriptLibrary* library = simdPrototype->GetLibrary();
+        SIMDPrototypeInitHelper<JavascriptSIMDInt16x8>(simdPrototype, library, library->GetBuiltinFunctions()[BuiltinFunction::SIMD_Int16x8_Int16x8],
+            library->CreateStringFromCppLiteral(L"SIMD.Int16x8"));
+    }
+
+    void JavascriptLibrary::InitializeSIMDInt32x4Prototype(DynamicObject* simdPrototype, DeferredTypeHandlerBase * typeHandler, DeferredInitializeMode mode)
+    {
+        typeHandler->Convert(simdPrototype, mode, 6);
+        JavascriptLibrary* library = simdPrototype->GetLibrary();
+        SIMDPrototypeInitHelper<JavascriptSIMDInt32x4>(simdPrototype, library, library->GetBuiltinFunctions()[BuiltinFunction::SIMD_Int32x4_Int32x4],
+            library->CreateStringFromCppLiteral(L"SIMD.Int32x4"));
+    }
+
+    void JavascriptLibrary::InitializeSIMDUint8x16Prototype(DynamicObject* simdPrototype, DeferredTypeHandlerBase * typeHandler, DeferredInitializeMode mode)
+    {
+        typeHandler->Convert(simdPrototype, mode, 6);
+        JavascriptLibrary* library = simdPrototype->GetLibrary();
+        SIMDPrototypeInitHelper<JavascriptSIMDUint8x16>(simdPrototype, library, library->GetBuiltinFunctions()[BuiltinFunction::SIMD_Uint8x16_Uint8x16],
+            library->CreateStringFromCppLiteral(L"SIMD.Uint8x16"));
+    }
+
+    void JavascriptLibrary::InitializeSIMDUint16x8Prototype(DynamicObject* simdPrototype, DeferredTypeHandlerBase * typeHandler, DeferredInitializeMode mode)
+    {
+        typeHandler->Convert(simdPrototype, mode, 6);
+        JavascriptLibrary* library = simdPrototype->GetLibrary();
+        SIMDPrototypeInitHelper<JavascriptSIMDUint16x8>(simdPrototype, library, library->GetBuiltinFunctions()[BuiltinFunction::SIMD_Uint16x8_Uint16x8],
+            library->CreateStringFromCppLiteral(L"SIMD.Uint16x8"));
+    }
+
+    void JavascriptLibrary::InitializeSIMDUint32x4Prototype(DynamicObject* simdPrototype, DeferredTypeHandlerBase * typeHandler, DeferredInitializeMode mode)
+    {
+        typeHandler->Convert(simdPrototype, mode, 6);
+        JavascriptLibrary* library = simdPrototype->GetLibrary();
+        SIMDPrototypeInitHelper<JavascriptSIMDUint32x4>(simdPrototype, library, library->GetBuiltinFunctions()[BuiltinFunction::SIMD_Uint32x4_Uint32x4],
+            library->CreateStringFromCppLiteral(L"SIMD.Uint32x4"));
+    }
+
+    void JavascriptLibrary::InitializeSIMDFloat32x4Prototype(DynamicObject* simdPrototype, DeferredTypeHandlerBase * typeHandler, DeferredInitializeMode mode)
+    {
+        typeHandler->Convert(simdPrototype, mode, 6);
+        JavascriptLibrary* library = simdPrototype->GetLibrary(); 
+        SIMDPrototypeInitHelper<JavascriptSIMDFloat32x4>(simdPrototype, library, library->GetBuiltinFunctions()[BuiltinFunction::SIMD_Float32x4_Float32x4], 
+            library->CreateStringFromCppLiteral(L"SIMD.Float32x4"));
+    }
 
     void JavascriptLibrary::InitializeObjectConstructor(DynamicObject* objectConstructor, DeferredTypeHandlerBase * typeHandler, DeferredInitializeMode mode)
     {
@@ -4458,7 +4616,7 @@ namespace Js
         return function;
     }
 
-    JavascriptFunction * JavascriptLibrary::AddFunctionToLibraryObjectWithPrototype(GlobalObject * object, PropertyId propertyId, FunctionInfo * functionInfo, int length, DynamicObject * prototype, DynamicType * functionType)
+    JavascriptFunction * JavascriptLibrary::AddFunctionToLibraryObjectWithPrototype(DynamicObject * object, PropertyId propertyId, FunctionInfo * functionInfo, int length, DynamicObject * prototype, DynamicType * functionType)
     {
         RuntimeFunction* function = DefaultCreateFunction(functionInfo, length, prototype, functionType, propertyId);
         AddMember(object, propertyId, function);
@@ -5948,6 +6106,46 @@ namespace Js
         return RecyclerNew(this->GetRecycler(), JavascriptSymbolObject, value, symbolTypeDynamic);
     }
 
+    JavascriptSIMDObject* JavascriptLibrary::CreateSIMDObject(Var simdValue, TypeId typeDescriptor)
+    {
+        switch (typeDescriptor)
+        {
+        case TypeIds_SIMDBool8x16:
+            AssertMsg(simdBool8x16TypeDynamic, "Where's simdTypeDynamic?");
+            return RecyclerNew(this->GetRecycler(), JavascriptSIMDObject, simdValue, simdBool8x16TypeDynamic, typeDescriptor);
+        case TypeIds_SIMDBool16x8:
+            AssertMsg(simdBool16x8TypeDynamic, "Where's simdTypeDynamic?");
+            return RecyclerNew(this->GetRecycler(), JavascriptSIMDObject, simdValue, simdBool16x8TypeDynamic, typeDescriptor);
+        case TypeIds_SIMDBool32x4:
+            AssertMsg(simdBool32x4TypeDynamic, "Where's simdTypeDynamic?");
+            return RecyclerNew(this->GetRecycler(), JavascriptSIMDObject, simdValue, simdBool32x4TypeDynamic, typeDescriptor);
+        case TypeIds_SIMDInt8x16:
+            AssertMsg(simdInt8x16TypeDynamic, "Where's simdTypeDynamic?");
+            return RecyclerNew(this->GetRecycler(), JavascriptSIMDObject, simdValue, simdInt8x16TypeDynamic, typeDescriptor);
+        case TypeIds_SIMDInt16x8:
+            AssertMsg(simdInt16x8TypeDynamic, "Where's simdTypeDynamic?");
+            return RecyclerNew(this->GetRecycler(), JavascriptSIMDObject, simdValue, simdInt16x8TypeDynamic, typeDescriptor);
+        case TypeIds_SIMDInt32x4:
+            AssertMsg(simdInt32x4TypeDynamic, "Where's simdTypeDynamic?");
+            return RecyclerNew(this->GetRecycler(), JavascriptSIMDObject, simdValue, simdInt32x4TypeDynamic, typeDescriptor);
+        case TypeIds_SIMDUint8x16:
+            AssertMsg(simdUint8x16TypeDynamic, "Where's simdTypeDynamic?");
+            return RecyclerNew(this->GetRecycler(), JavascriptSIMDObject, simdValue, simdUint8x16TypeDynamic, typeDescriptor);
+        case TypeIds_SIMDUint16x8:
+            AssertMsg(simdUint16x8TypeDynamic, "Where's simdTypeDynamic?");
+            return RecyclerNew(this->GetRecycler(), JavascriptSIMDObject, simdValue, simdUint16x8TypeDynamic, typeDescriptor);
+        case TypeIds_SIMDUint32x4:
+            AssertMsg(simdUint32x4TypeDynamic, "Where's simdTypeDynamic?");
+            return RecyclerNew(this->GetRecycler(), JavascriptSIMDObject, simdValue, simdUint32x4TypeDynamic, typeDescriptor);
+        case TypeIds_SIMDFloat32x4:
+            AssertMsg(simdFloat32x4TypeDynamic, "Where's simdTypeDynamic?");
+            return RecyclerNew(this->GetRecycler(), JavascriptSIMDObject, simdValue, simdFloat32x4TypeDynamic, typeDescriptor);
+        default:
+            Assert(UNREACHED);
+        }
+        return nullptr;
+    }
+
     JavascriptNumberObject* JavascriptLibrary::CreateNumberObject(Var number)
     {
         AssertMsg(numberTypeDynamic, "Where's numberTypeDynamic?");

+ 39 - 1
lib/Runtime/Library/JavascriptLibrary.h

@@ -261,6 +261,17 @@ namespace Js
         StaticType  * uint64NumberTypeStatic;
 
         // SIMD_JS
+        DynamicType * simdBool8x16TypeDynamic;
+        DynamicType * simdBool16x8TypeDynamic;
+        DynamicType * simdBool32x4TypeDynamic;
+        DynamicType * simdInt8x16TypeDynamic;
+        DynamicType * simdInt16x8TypeDynamic;
+        DynamicType * simdInt32x4TypeDynamic;
+        DynamicType * simdUint8x16TypeDynamic;
+        DynamicType * simdUint16x8TypeDynamic;
+        DynamicType * simdUint32x4TypeDynamic;
+        DynamicType * simdFloat32x4TypeDynamic;
+
         StaticType * simdFloat32x4TypeStatic;
         StaticType * simdInt32x4TypeStatic;
         StaticType * simdInt8x16TypeStatic;
@@ -429,7 +440,7 @@ namespace Js
         bool inDispatchProfileMode;
         bool arrayObjectHasUserDefinedSpecies;
 
-        JavascriptFunction * AddFunctionToLibraryObjectWithPrototype(GlobalObject * globalObject, PropertyId propertyId, FunctionInfo * functionInfo, int length, DynamicObject * prototype = nullptr, DynamicType * functionType = nullptr);
+        JavascriptFunction * AddFunctionToLibraryObjectWithPrototype(DynamicObject * object, PropertyId propertyId, FunctionInfo * functionInfo, int length, DynamicObject * prototype = nullptr, DynamicType * functionType = nullptr);
         JavascriptFunction * AddFunctionToLibraryObject(DynamicObject* object, PropertyId propertyId, FunctionInfo * functionInfo, int length, PropertyAttributes attributes = PropertyBuiltInMethodDefaults);
 
         JavascriptFunction * AddFunctionToLibraryObjectWithName(DynamicObject* object, PropertyId propertyId, PropertyId nameId, FunctionInfo * functionInfo, int length);
@@ -645,6 +656,17 @@ namespace Js
         DynamicType * GetPromiseType() const { return promiseType; }
 
         // SIMD_JS
+        DynamicType * GetSIMDBool8x16TypeDynamic()  const { return simdBool8x16TypeDynamic;  }
+        DynamicType * GetSIMDBool16x8TypeDynamic()  const { return simdBool16x8TypeDynamic;  }
+        DynamicType * GetSIMDBool32x4TypeDynamic()  const { return simdBool32x4TypeDynamic;  }
+        DynamicType * GetSIMDInt8x16TypeDynamic()   const { return simdInt8x16TypeDynamic;   }
+        DynamicType * GetSIMDInt16x8TypeDynamic()   const { return simdInt16x8TypeDynamic;   }
+        DynamicType * GetSIMDInt32x4TypeDynamic()   const { return simdInt32x4TypeDynamic;   }
+        DynamicType * GetSIMDUint8x16TypeDynamic()  const { return simdUint8x16TypeDynamic;  }
+        DynamicType * GetSIMDUint16x8TypeDynamic()  const { return simdUint16x8TypeDynamic;  }
+        DynamicType * GetSIMDUint32x4TypeDynamic()  const { return simdUint32x4TypeDynamic;  }
+        DynamicType * GetSIMDFloat32x4TypeDynamic() const { return simdFloat32x4TypeDynamic; }
+        
         StaticType* GetSIMDFloat32x4TypeStatic() const { return simdFloat32x4TypeStatic; }
         StaticType* GetSIMDFloat64x2TypeStatic() const { return simdFloat64x2TypeStatic; }
         StaticType* GetSIMDInt32x4TypeStatic()   const { return simdInt32x4TypeStatic; }
@@ -905,6 +927,7 @@ namespace Js
         JavascriptBooleanObject* CreateBooleanObject();
         JavascriptNumberObject* CreateNumberObjectWithCheck(double value);
         JavascriptNumberObject* CreateNumberObject(Var number);
+        JavascriptSIMDObject* CreateSIMDObject(Var simdValue, TypeId typeDescriptor);
         JavascriptStringObject* CreateStringObject(JavascriptString* value);
         JavascriptStringObject* CreateStringObject(const wchar_t* value, charcount_t length);
         JavascriptSymbolObject* CreateSymbolObject(JavascriptSymbol* value);
@@ -1096,6 +1119,21 @@ namespace Js
         static void __cdecl InitializeSIMDObject(DynamicObject* simdObject, DeferredTypeHandlerBase * typeHandler, DeferredInitializeMode mode);
         static void __cdecl InitializeSIMDOpCodeMaps();
 
+        template<typename SIMDTypeName>
+        static void SIMDPrototypeInitHelper(DynamicObject* simdPrototype, JavascriptLibrary* library, JavascriptFunction* constructorFn, JavascriptString* strLiteral);
+
+        static void __cdecl InitializeSIMDBool8x16Prototype(DynamicObject* simdPrototype, DeferredTypeHandlerBase * typeHandler, DeferredInitializeMode mode);
+        static void __cdecl InitializeSIMDBool16x8Prototype(DynamicObject* simdPrototype, DeferredTypeHandlerBase * typeHandler, DeferredInitializeMode mode);
+        static void __cdecl InitializeSIMDBool32x4Prototype(DynamicObject* simdPrototype, DeferredTypeHandlerBase * typeHandler, DeferredInitializeMode mode);
+        static void __cdecl InitializeSIMDInt8x16Prototype(DynamicObject* simdPrototype, DeferredTypeHandlerBase * typeHandler, DeferredInitializeMode mode);
+        static void __cdecl InitializeSIMDInt16x8Prototype(DynamicObject* simdPrototype, DeferredTypeHandlerBase * typeHandler, DeferredInitializeMode mode);
+        static void __cdecl InitializeSIMDInt32x4Prototype(DynamicObject* simdPrototype, DeferredTypeHandlerBase * typeHandler, DeferredInitializeMode mode);
+        static void __cdecl InitializeSIMDUint8x16Prototype(DynamicObject* simdPrototype, DeferredTypeHandlerBase * typeHandler, DeferredInitializeMode mode);
+        static void __cdecl InitializeSIMDUint16x8Prototype(DynamicObject* simdPrototype, DeferredTypeHandlerBase * typeHandler, DeferredInitializeMode mode);
+        static void __cdecl InitializeSIMDUint32x4Prototype(DynamicObject* simdPrototype, DeferredTypeHandlerBase * typeHandler, DeferredInitializeMode mode);
+        static void __cdecl InitializeSIMDFloat32x4Prototype(DynamicObject* simdPrototype, DeferredTypeHandlerBase * typeHandler, DeferredInitializeMode mode);
+        static void __cdecl InitializeSIMDFloat64x2Prototype(DynamicObject* simdPrototype, DeferredTypeHandlerBase * typeHandler, DeferredInitializeMode mode);
+
         static void __cdecl InitializeNumberConstructor(DynamicObject* numberConstructor, DeferredTypeHandlerBase * typeHandler, DeferredInitializeMode mode);
         static void __cdecl InitializeNumberPrototype(DynamicObject* numberPrototype, DeferredTypeHandlerBase * typeHandler, DeferredInitializeMode mode);
         static void __cdecl InitializeObjectConstructor(DynamicObject* objectConstructor, DeferredTypeHandlerBase * typeHandler, DeferredInitializeMode mode);

+ 24 - 0
lib/Runtime/Library/JavascriptLibraryBase.h

@@ -92,6 +92,17 @@ namespace Js
         DynamicObject* GetDatePrototype() { return datePrototype; }
         DynamicObject* GetFunctionPrototype() { return functionPrototype; }
         DynamicObject* GetNumberPrototype() { return numberPrototype; }
+        DynamicObject* GetSIMDBool8x16Prototype()  { return simdBool8x16Prototype;  }
+        DynamicObject* GetSIMDBool16x8Prototype()  { return simdBool16x8Prototype;  }
+        DynamicObject* GetSIMDBool32x4Prototype()  { return simdBool32x4Prototype;  }
+        DynamicObject* GetSIMDInt8x16Prototype()   { return simdInt8x16Prototype;   }
+        DynamicObject* GetSIMDInt16x8Prototype()   { return simdInt16x8Prototype;   }
+        DynamicObject* GetSIMDInt32x4Prototype()   { return simdInt32x4Prototype;   }
+        DynamicObject* GetSIMDUint8x16Prototype()  { return simdUint8x16Prototype;  }
+        DynamicObject* GetSIMDUint16x8Prototype()  { return simdUint16x8Prototype;  }
+        DynamicObject* GetSIMDUint32x4Prototype()  { return simdUint32x4Prototype;  }
+        DynamicObject* GetSIMDFloat32x4Prototype() { return simdFloat32x4Prototype; }
+        DynamicObject* GetSIMDFloat64x2Prototype() { return simdFloat64x2Prototype; }
         ObjectPrototypeObject* GetObjectPrototypeObject() { return objectPrototype; }
         DynamicObject* GetObjectPrototype();
         DynamicObject* GetRegExpPrototype() { return regexPrototype; }
@@ -235,6 +246,19 @@ namespace Js
         DynamicObject* typeErrorPrototype;
         DynamicObject* uriErrorPrototype;
 
+        //SIMD Prototypes
+        DynamicObject* simdBool8x16Prototype;
+        DynamicObject* simdBool16x8Prototype;
+        DynamicObject* simdBool32x4Prototype;
+        DynamicObject* simdInt8x16Prototype;
+        DynamicObject* simdInt16x8Prototype;
+        DynamicObject* simdInt32x4Prototype;
+        DynamicObject* simdUint8x16Prototype;
+        DynamicObject* simdUint16x8Prototype;
+        DynamicObject* simdUint32x4Prototype;
+        DynamicObject* simdFloat32x4Prototype;
+        DynamicObject* simdFloat64x2Prototype;
+
         JavascriptBoolean* booleanTrue;
         JavascriptBoolean* booleanFalse;
 

+ 15 - 3
lib/Runtime/Library/JavascriptNumber.cpp

@@ -650,7 +650,19 @@ namespace Js
         {
             JavascriptError::ThrowTypeError(scriptContext, JSERR_This_NeedNumber, L"Number.prototype.toLocaleString");
         }
+        return JavascriptNumber::ToLocaleStringIntl(args, callInfo, scriptContext);
+    }
+    
+    JavascriptString* JavascriptNumber::ToLocaleStringIntl(Var* values, CallInfo callInfo, ScriptContext* scriptContext)
+    {
+        Assert(values);
+        ArgumentReader args(&callInfo, values);
+        return JavascriptNumber::ToLocaleStringIntl(args, callInfo, scriptContext);
+    }
 
+    JavascriptString* JavascriptNumber::ToLocaleStringIntl(ArgumentReader& args, CallInfo callInfo, ScriptContext* scriptContext)
+    {
+       Assert(scriptContext);
 #ifdef ENABLE_INTL_OBJECT
         if(CONFIG_FLAG(IntlBuiltIns) && scriptContext->IsIntlEnabled()){
 
@@ -661,14 +673,14 @@ namespace Js
                 JavascriptFunction* func = intlExtensionObject->GetNumberToLocaleString();
                 if (func)
                 {
-                    return func->CallFunction(args);
+                    return JavascriptString::FromVar(func->CallFunction(args));
                 }
                 // Initialize Number.prototype.toLocaleString
                 scriptContext->GetLibrary()->InitializeIntlForNumberPrototype();
                 func = intlExtensionObject->GetNumberToLocaleString();
                 if (func)
                 {
-                    return func->CallFunction(args);
+                    return JavascriptString::FromVar(func->CallFunction(args));
                 }
             }
         }
@@ -682,7 +694,7 @@ namespace Js
                 Var result;
                 if (RecyclableObject::FromVar(args[0])->InvokeBuiltInOperationRemotely(EntryToLocaleString, args, &result))
                 {
-                    return result;
+                    return JavascriptString::FromVar(result);
                 }
             }
 

+ 2 - 0
lib/Runtime/Library/JavascriptNumber.h

@@ -126,6 +126,8 @@ namespace Js
         // when radix is 10, ToStringRadix10 should be used instead
         static JavascriptString* ToStringRadixHelper(double value, int radix, ScriptContext* scriptContext);
         static JavascriptString* ToLocaleString(double dValue, ScriptContext* scriptContext);
+        static JavascriptString* ToLocaleStringIntl(ArgumentReader& args, CallInfo callInfo, ScriptContext* scriptContext);
+        static JavascriptString* ToLocaleStringIntl(Var* values, CallInfo callInfo, ScriptContext* scriptContext);
         static Var CloneToScriptContext(Var aValue, ScriptContext* requestContext);
 
 #if !FLOATVAR

+ 8 - 0
lib/Runtime/Library/JavascriptObject.cpp

@@ -38,6 +38,7 @@ namespace Js
             case TypeIds_ES5Array:
             case TypeIds_RegEx:
             case TypeIds_NumberObject:
+            case TypeIds_SIMDObject:
             case TypeIds_Date:
             case TypeIds_BooleanObject:
             case TypeIds_Error:
@@ -405,6 +406,12 @@ namespace Js
                     return library->CreateStringFromCppLiteral(L"[object Number]");
                 }
                 break;
+            case TypeIds_SIMDObject:
+                if (!isES6ToStringTagEnabled || tag == nullptr || wcscmp(tag->UnsafeGetBuffer(), L"SIMD") == 0)
+                {
+                    return library->CreateStringFromCppLiteral(L"[object SIMD]");
+                }
+                break;
 
             case TypeIds_RegEx:
                 if (!isES6ToStringTagEnabled || tag == nullptr || wcscmp(tag->UnsafeGetBuffer(), L"RegExp") == 0)
@@ -574,6 +581,7 @@ namespace Js
         case TypeIds_UInt64Number:
         case TypeIds_Integer:
         case TypeIds_NumberObject:
+        case TypeIds_SIMDObject:
         case TypeIds_RegEx:
         case TypeIds_Array:
         case TypeIds_ES5Array:

+ 6 - 59
lib/Runtime/Library/JavascriptSimdBool16x8.cpp

@@ -6,12 +6,12 @@
 
 namespace Js
 {
-    JavascriptSIMDBool16x8::JavascriptSIMDBool16x8(StaticType *type) : RecyclableObject(type)
+    JavascriptSIMDBool16x8::JavascriptSIMDBool16x8(StaticType *type) : JavascriptSIMDType(type)
     {
         Assert(type->GetTypeId() == TypeIds_SIMDBool16x8);
     }
 
-    JavascriptSIMDBool16x8::JavascriptSIMDBool16x8(SIMDValue *val, StaticType *type) : RecyclableObject(type), value(*val)
+    JavascriptSIMDBool16x8::JavascriptSIMDBool16x8(SIMDValue *val, StaticType *type) : JavascriptSIMDType(val, type)
     {
         Assert(type->GetTypeId() == TypeIds_SIMDBool16x8);
     }
@@ -44,64 +44,11 @@ namespace Js
         return JavascriptSIMDBool16x8::New(&value, requestContext);
     }
 
-    BOOL JavascriptSIMDBool16x8::GetProperty(Var originalInstance, PropertyId propertyId, Var* value, PropertyValueInfo* info, ScriptContext* requestContext)
+    const wchar_t* JavascriptSIMDBool16x8::GetFullBuiltinName(wchar_t** aBuffer, const wchar_t* name)
     {
-        return GetPropertyBuiltIns(propertyId, value, requestContext);
-    }
-
-    BOOL JavascriptSIMDBool16x8::GetProperty(Var originalInstance, JavascriptString* propertyNameString, Var* value, PropertyValueInfo* info, ScriptContext* requestContext)
-    {
-        PropertyRecord const* propertyRecord;
-        this->GetScriptContext()->FindPropertyRecord(propertyNameString, &propertyRecord);
-
-        if (propertyRecord != nullptr && GetPropertyBuiltIns(propertyRecord->GetPropertyId(), value, requestContext))
-        {
-            return true;
-        }
-        return false;
-    }
-
-    BOOL JavascriptSIMDBool16x8::GetPropertyReference(Var originalInstance, PropertyId propertyId, Var* value, PropertyValueInfo* info, ScriptContext* requestContext)
-    {
-        return JavascriptSIMDBool16x8::GetProperty(originalInstance, propertyId, value, info, requestContext);
-    }
-
-    bool JavascriptSIMDBool16x8::GetPropertyBuiltIns(PropertyId propertyId, Var* value, ScriptContext* requestContext)
-    {
-        if (propertyId == PropertyIds::toString)
-        {
-            *value = requestContext->GetLibrary()->GetSIMDBool16x8ToStringFunction();
-            return true;
-        }
-        return false;
-    }
-
-    Var JavascriptSIMDBool16x8::EntryToString(RecyclableObject* function, CallInfo callInfo, ...)
-    {
-        PROBE_STACK(function->GetScriptContext(), Js::Constants::MinStackDefault);
-
-        ARGUMENTS(args, callInfo);
-        ScriptContext* scriptContext = function->GetScriptContext();
-
-        AssertMsg(args.Info.Count > 0, "Should always have implicit 'this'");
-        Assert(!(callInfo.Flags & CallFlags_New));
-
-        if (args.Info.Count == 0 || !JavascriptSIMDBool16x8::Is(args[0]))
-        {
-            JavascriptError::ThrowTypeError(scriptContext, JSERR_This_NeedSimd, L"SIMDBool32x4.toString");
-        }
-
-        JavascriptSIMDBool16x8 *instance = JavascriptSIMDBool16x8::FromVar(args[0]);
-        Assert(instance);
-
-        wchar_t stringBuffer[SIMD_STRING_BUFFER_MAX];
-        SIMDValue value = instance->GetValue();
-        
-        JavascriptSIMDBool16x8::ToStringBuffer(value, stringBuffer, SIMD_STRING_BUFFER_MAX);
-
-        JavascriptString* string = JavascriptString::NewCopySzFromArena(stringBuffer, scriptContext, scriptContext->GeneralAllocator());
-
-        return string;
+        Assert(aBuffer && *aBuffer);
+        swprintf_s(*aBuffer, SIMD_STRING_BUFFER_MAX, L"SIMD.Bool16x8.%s", name);
+        return *aBuffer;
     }
 
     Var JavascriptSIMDBool16x8::Copy(ScriptContext* requestContext)

+ 14 - 26
lib/Runtime/Library/JavascriptSimdBool16x8.h

@@ -6,19 +6,19 @@
 
 namespace Js
 {
-    class JavascriptSIMDBool16x8 sealed : public RecyclableObject
+    class JavascriptSIMDBool16x8 sealed : public JavascriptSIMDType
     {
     private:
-        SIMDValue value;
-
-        DEFINE_VTABLE_CTOR(JavascriptSIMDBool16x8, RecyclableObject);
+        DEFINE_VTABLE_CTOR(JavascriptSIMDBool16x8, JavascriptSIMDType);
 
     public:
         class EntryInfo
         {
         public:
             static FunctionInfo ToString;
-
+            static FunctionInfo ToLocaleString;
+            static FunctionInfo ValueOf;
+            static FunctionInfo SymbolToPrimitive;
         };
 
 
@@ -29,25 +29,14 @@ namespace Js
         static JavascriptSIMDBool16x8* New(SIMDValue *val, ScriptContext* requestContext);
         static bool Is(Var instance);
         static JavascriptSIMDBool16x8* FromVar(Var aValue);
-
-        __inline SIMDValue GetValue() { return value; }
-
-        virtual BOOL GetPropertyReference(Var originalInstance, PropertyId propertyId, Var* value, PropertyValueInfo* info, ScriptContext* requestContext) override;
-        virtual BOOL GetProperty(Var originalInstance, PropertyId propertyId, Var* value, PropertyValueInfo* info, ScriptContext* requestContext) override;
-        virtual BOOL GetProperty(Var originalInstance, JavascriptString* propertyNameString, Var* value, PropertyValueInfo* info, ScriptContext* requestContext) override;
-        virtual RecyclableObject * CloneToScriptContext(ScriptContext* requestContext) override;
-
+        static const wchar_t* GetFullBuiltinName(wchar_t** aBuffer, const wchar_t* name);
         static size_t GetOffsetOfValue() { return offsetof(JavascriptSIMDBool16x8, value); }
-
-
-        // Entry Points
-        /*
-        There is one toString per SIMD type. The code is entrant from value objects (e.g. a.toString()) or on arithmetic operations.
-        It will also be a property of SIMD.*.prototype for SIMD dynamic objects.
-        */
-        static Var EntryToString(RecyclableObject* function, CallInfo callInfo, ...);
-        // End Entry Points
-
+        static Var CallToLocaleString(RecyclableObject&, ScriptContext&, SIMDValue, const Var, uint, CallInfo) 
+        { 
+            Assert(UNREACHED);
+            return nullptr;
+        };
+ 
         static void ToStringBuffer(SIMDValue& value, __out_ecount(countBuffer) wchar_t* stringBuffer, size_t countBuffer, ScriptContext* scriptContext = nullptr)
         {
             swprintf_s(stringBuffer, countBuffer, L"SIMD.Bool16x8(%s, %s, %s, %s, %s, %s, %s, %s)", \
@@ -55,10 +44,9 @@ namespace Js
                 value.i16[4] ? L"true" : L"false", value.i16[5] ? L"true" : L"false", value.i16[6] ? L"true" : L"false", value.i16[7] ? L"true" : L"false"
                 );
         }
+        virtual RecyclableObject * CloneToScriptContext(ScriptContext* requestContext) override;
 
+        __inline SIMDValue GetValue() { return value; }
         Var  Copy(ScriptContext* requestContext);
-
-    private:
-        bool GetPropertyBuiltIns(PropertyId propertyId, Var* value, ScriptContext* requestContext);
     };
 }

+ 11 - 68
lib/Runtime/Library/JavascriptSimdBool32x4.cpp

@@ -4,15 +4,15 @@
 //-------------------------------------------------------------------------------------------------------
 #include "RuntimeLibraryPch.h"
 
-
 namespace Js
 {
-    JavascriptSIMDBool32x4::JavascriptSIMDBool32x4(StaticType *type) : RecyclableObject(type)
+
+    JavascriptSIMDBool32x4::JavascriptSIMDBool32x4(StaticType *type) : JavascriptSIMDType(type)
     {
         Assert(type->GetTypeId() == TypeIds_SIMDBool32x4);
     }
 
-    JavascriptSIMDBool32x4::JavascriptSIMDBool32x4(SIMDValue *val, StaticType *type) : RecyclableObject(type), value(*val)
+    JavascriptSIMDBool32x4::JavascriptSIMDBool32x4(SIMDValue *val, StaticType *type) : JavascriptSIMDType(val, type)
     {
         Assert(type->GetTypeId() == TypeIds_SIMDBool32x4);
     }
@@ -40,77 +40,20 @@ namespace Js
         return reinterpret_cast<JavascriptSIMDBool32x4 *>(aValue);
     }
 
-    RecyclableObject * JavascriptSIMDBool32x4::CloneToScriptContext(ScriptContext* requestContext)
-    {
-        return JavascriptSIMDBool32x4::New(&value, requestContext);
-    }
-
-    BOOL JavascriptSIMDBool32x4::GetProperty(Var originalInstance, PropertyId propertyId, Var* value, PropertyValueInfo* info, ScriptContext* requestContext)
-    {
-        return GetPropertyBuiltIns(propertyId, value, requestContext);
-    }
-
-    BOOL JavascriptSIMDBool32x4::GetProperty(Var originalInstance, JavascriptString* propertyNameString, Var* value, PropertyValueInfo* info, ScriptContext* requestContext)
-    {
-        PropertyRecord const* propertyRecord;
-        this->GetScriptContext()->FindPropertyRecord(propertyNameString, &propertyRecord);
-
-        if (propertyRecord != nullptr && GetPropertyBuiltIns(propertyRecord->GetPropertyId(), value, requestContext))
-        {
-            return true;
-        }
-        return false;
-    }
-
-    BOOL JavascriptSIMDBool32x4::GetPropertyReference(Var originalInstance, PropertyId propertyId, Var* value, PropertyValueInfo* info, ScriptContext* requestContext)
-    {
-        return JavascriptSIMDBool32x4::GetProperty(originalInstance, propertyId, value, info, requestContext);
-    }
-
-    bool JavascriptSIMDBool32x4::GetPropertyBuiltIns(PropertyId propertyId, Var* value, ScriptContext* requestContext)
+    const wchar_t* JavascriptSIMDBool32x4::GetFullBuiltinName(wchar_t** aBuffer, const wchar_t* name)
     {
-        if (propertyId == PropertyIds::toString)
-        {
-            *value = requestContext->GetLibrary()->GetSIMDBool32x4ToStringFunction();
-            return true;
-        }
-        return false;
+        Assert(aBuffer && *aBuffer);
+        swprintf_s(*aBuffer, SIMD_STRING_BUFFER_MAX, L"SIMD.Bool32x4.%s", name);
+        return *aBuffer;
     }
 
-    // Entry Points
-
-    Var JavascriptSIMDBool32x4::EntryToString(RecyclableObject* function, CallInfo callInfo, ...)
+    Var JavascriptSIMDBool32x4::Copy(ScriptContext* requestContext)
     {
-        PROBE_STACK(function->GetScriptContext(), Js::Constants::MinStackDefault);
-
-        ARGUMENTS(args, callInfo);
-        ScriptContext* scriptContext = function->GetScriptContext();
-
-        AssertMsg(args.Info.Count > 0, "Should always have implicit 'this'");
-        Assert(!(callInfo.Flags & CallFlags_New));
-
-        if (args.Info.Count == 0 || !JavascriptSIMDBool32x4::Is(args[0]))
-        {
-            JavascriptError::ThrowTypeError(scriptContext, JSERR_This_NeedSimd, L"SIMDBool32x4.toString");
-        }
-
-        JavascriptSIMDBool32x4 *instance = JavascriptSIMDBool32x4::FromVar(args[0]);
-        Assert(instance);
-
-        wchar_t stringBuffer[SIMD_STRING_BUFFER_MAX];
-        SIMDValue value = instance->GetValue();
-
-        JavascriptSIMDBool32x4::ToStringBuffer(value, stringBuffer, SIMD_STRING_BUFFER_MAX);
-
-        JavascriptString* string = JavascriptString::NewCopySzFromArena(stringBuffer, scriptContext, scriptContext->GeneralAllocator());
-
-        return string;
+        return JavascriptSIMDBool32x4::New(&this->value, requestContext);
     }
 
-    // End Entry Points
-
-    Var JavascriptSIMDBool32x4::Copy(ScriptContext* requestContext)
+    RecyclableObject * JavascriptSIMDBool32x4::CloneToScriptContext(ScriptContext* requestContext)
     {
-        return JavascriptSIMDBool32x4::New(&this->value, requestContext);
+        return JavascriptSIMDBool32x4::New(&value, requestContext);
     }
 }

+ 19 - 32
lib/Runtime/Library/JavascriptSimdBool32x4.h

@@ -6,57 +6,44 @@
 
 namespace Js
 {
-    class JavascriptSIMDBool32x4 sealed : public RecyclableObject
+    class JavascriptSIMDBool32x4 sealed : public JavascriptSIMDType
     {
     private:
-        SIMDValue value;
-
-        DEFINE_VTABLE_CTOR(JavascriptSIMDBool32x4, RecyclableObject);
-
-
+        DEFINE_VTABLE_CTOR(JavascriptSIMDBool32x4, JavascriptSIMDType);
     public:
         class EntryInfo
         {
         public:
+            static FunctionInfo ValueOf;
             static FunctionInfo ToString;
-
+            static FunctionInfo ToLocaleString;
+            static FunctionInfo SymbolToPrimitive;
         };
 
-        JavascriptSIMDBool32x4(StaticType *type);
-        JavascriptSIMDBool32x4(SIMDValue *val, StaticType *type);
-
-        static JavascriptSIMDBool32x4* AllocUninitialized(ScriptContext* requestContext);
-        static JavascriptSIMDBool32x4* New(SIMDValue *val, ScriptContext* requestContext);
         static bool Is(Var instance);
         static JavascriptSIMDBool32x4* FromVar(Var aValue);
-
-        __inline SIMDValue GetValue() { return value; }
-
-        virtual BOOL GetPropertyReference(Var originalInstance, PropertyId propertyId, Var* value, PropertyValueInfo* info, ScriptContext* requestContext) override;
-        virtual BOOL GetProperty(Var originalInstance, PropertyId propertyId, Var* value, PropertyValueInfo* info, ScriptContext* requestContext) override;
-        virtual BOOL GetProperty(Var originalInstance, JavascriptString* propertyNameString, Var* value, PropertyValueInfo* info, ScriptContext* requestContext) override;
-        virtual RecyclableObject * CloneToScriptContext(ScriptContext* requestContext) override;
-
+        static const wchar_t* GetFullBuiltinName(wchar_t** aBuffer, const wchar_t* name);
+        static JavascriptSIMDBool32x4* AllocUninitialized(ScriptContext* requestContext);
+        static JavascriptSIMDBool32x4* New(SIMDValue *val, ScriptContext* requestContext);
         static size_t GetOffsetOfValue() { return offsetof(JavascriptSIMDBool32x4, value); }
-
-        // Entry Points
-        /*
-        There is one toString per SIMD type. The code is entrant from value objects (e.g. a.toString()) or on arithmetic operations.
-        It will also be a property of SIMD.*.prototype for SIMD dynamic objects.
-        */
-        static Var EntryToString(RecyclableObject* function, CallInfo callInfo, ...);
-        // End Entry Points
-
+        static Var CallToLocaleString(RecyclableObject&, ScriptContext&, SIMDValue, const Var, uint, CallInfo) 
+        {
+            Assert(UNREACHED);
+            return nullptr;
+        };
         static void ToStringBuffer(SIMDValue& value, __out_ecount(countBuffer) wchar_t* stringBuffer, size_t countBuffer, ScriptContext* scriptContext = nullptr)
         {
             swprintf_s(stringBuffer, countBuffer, L"SIMD.Bool32x4(%s, %s, %s, %s)", value.i32[SIMD_X] ? L"true" : L"false",
                 value.i32[SIMD_Y] ? L"true" : L"false", value.i32[SIMD_Z] ? L"true" : L"false", value.i32[SIMD_W] ? L"true" : L"false");
         }
 
-        Var  Copy(ScriptContext* requestContext);
+        JavascriptSIMDBool32x4(StaticType *type);
+        JavascriptSIMDBool32x4(SIMDValue *val, StaticType *type);
+
+        Var Copy(ScriptContext* requestContext);
+        __inline SIMDValue GetValue() { return value; }
+        virtual RecyclableObject* CloneToScriptContext(ScriptContext* requestContext) override;
 
-    private:
-        bool GetPropertyBuiltIns(PropertyId propertyId, Var* value, ScriptContext* requestContext);
     };
 }
 

+ 6 - 63
lib/Runtime/Library/JavascriptSimdBool8x16.cpp

@@ -6,12 +6,12 @@
 
 namespace Js
 {
-    JavascriptSIMDBool8x16::JavascriptSIMDBool8x16(StaticType *type) : RecyclableObject(type)
+    JavascriptSIMDBool8x16::JavascriptSIMDBool8x16(StaticType *type) : JavascriptSIMDType(type)
     {
         Assert(type->GetTypeId() == TypeIds_SIMDBool8x16);
     }
 
-    JavascriptSIMDBool8x16::JavascriptSIMDBool8x16(SIMDValue *val, StaticType *type) : RecyclableObject(type), value(*val)
+    JavascriptSIMDBool8x16::JavascriptSIMDBool8x16(SIMDValue *val, StaticType *type) : JavascriptSIMDType(val, type)
     {
         Assert(type->GetTypeId() == TypeIds_SIMDBool8x16);
     }
@@ -44,70 +44,13 @@ namespace Js
         return JavascriptSIMDBool8x16::New(&value, requestContext);
     }
 
-    BOOL JavascriptSIMDBool8x16::GetProperty(Var originalInstance, PropertyId propertyId, Var* value, PropertyValueInfo* info, ScriptContext* requestContext)
+    const wchar_t* JavascriptSIMDBool8x16::GetFullBuiltinName(wchar_t** aBuffer, const wchar_t* name)
     {
-        return GetPropertyBuiltIns(propertyId, value, requestContext);
+        Assert(aBuffer && *aBuffer);
+        swprintf_s(*aBuffer, SIMD_STRING_BUFFER_MAX, L"SIMD.Bool8x16.%s", name);
+        return *aBuffer;
     }
 
-    BOOL JavascriptSIMDBool8x16::GetProperty(Var originalInstance, JavascriptString* propertyNameString, Var* value, PropertyValueInfo* info, ScriptContext* requestContext)
-    {
-        PropertyRecord const* propertyRecord;
-        this->GetScriptContext()->FindPropertyRecord(propertyNameString, &propertyRecord);
-
-        if (propertyRecord != nullptr && GetPropertyBuiltIns(propertyRecord->GetPropertyId(), value, requestContext))
-        {
-            return true;
-        }
-        return false;
-    }
-
-    BOOL JavascriptSIMDBool8x16::GetPropertyReference(Var originalInstance, PropertyId propertyId, Var* value, PropertyValueInfo* info, ScriptContext* requestContext)
-    {
-        return JavascriptSIMDBool8x16::GetProperty(originalInstance, propertyId, value, info, requestContext);
-    }
-
-    bool JavascriptSIMDBool8x16::GetPropertyBuiltIns(PropertyId propertyId, Var* value, ScriptContext* requestContext)
-    {
-        if (propertyId == PropertyIds::toString)
-        {
-            *value = requestContext->GetLibrary()->GetSIMDBool8x16ToStringFunction();
-            return true;
-        }
-        return false;
-    }
-
-    // Entry Points
-
-    Var JavascriptSIMDBool8x16::EntryToString(RecyclableObject* function, CallInfo callInfo, ...)
-    {
-        PROBE_STACK(function->GetScriptContext(), Js::Constants::MinStackDefault);
-
-        ARGUMENTS(args, callInfo);
-        ScriptContext* scriptContext = function->GetScriptContext();
-
-        AssertMsg(args.Info.Count > 0, "Should always have implicit 'this'");
-        Assert(!(callInfo.Flags & CallFlags_New));
-
-        if (args.Info.Count == 0 || !JavascriptSIMDBool8x16::Is(args[0]))
-        {
-            JavascriptError::ThrowTypeError(scriptContext, JSERR_This_NeedSimd, L"SIMDBool8x16.toString");
-        }
-
-        JavascriptSIMDBool8x16 *instance = JavascriptSIMDBool8x16::FromVar(args[0]);
-        Assert(instance);
-
-        wchar_t stringBuffer[SIMD_STRING_BUFFER_MAX];
-        SIMDValue value = instance->GetValue();
-
-        JavascriptSIMDBool8x16::ToStringBuffer(value, stringBuffer, SIMD_STRING_BUFFER_MAX);
-
-        JavascriptString* string = JavascriptString::NewCopySzFromArena(stringBuffer, scriptContext, scriptContext->GeneralAllocator());
-
-        return string;
-    }
-
-    // End Entry Points
-
     Var JavascriptSIMDBool8x16::Copy(ScriptContext* requestContext)
     {
         return JavascriptSIMDBool8x16::New(&this->value, requestContext);

+ 13 - 23
lib/Runtime/Library/JavascriptSimdBool8x16.h

@@ -6,19 +6,19 @@
 
 namespace Js
 {
-    class JavascriptSIMDBool8x16 sealed : public RecyclableObject
+    class JavascriptSIMDBool8x16 sealed : public JavascriptSIMDType
     {
     private:
-        SIMDValue value;
-
-        DEFINE_VTABLE_CTOR(JavascriptSIMDBool8x16, RecyclableObject);
+        DEFINE_VTABLE_CTOR(JavascriptSIMDBool8x16, JavascriptSIMDType);
 
     public:
         class EntryInfo
         {
         public:
             static FunctionInfo ToString;
-
+            static FunctionInfo ToLocaleString;
+            static FunctionInfo ValueOf;
+            static FunctionInfo SymbolToPrimitive;
         };
         JavascriptSIMDBool8x16(StaticType *type);
         JavascriptSIMDBool8x16(SIMDValue *val, StaticType *type);
@@ -27,24 +27,17 @@ namespace Js
         static JavascriptSIMDBool8x16* New(SIMDValue *val, ScriptContext* requestContext);
         static bool Is(Var instance);
         static JavascriptSIMDBool8x16* FromVar(Var aValue);
-
-        __inline SIMDValue GetValue() { return value; }
-
-        virtual BOOL GetPropertyReference(Var originalInstance, PropertyId propertyId, Var* value, PropertyValueInfo* info, ScriptContext* requestContext) override;
-        virtual BOOL GetProperty(Var originalInstance, PropertyId propertyId, Var* value, PropertyValueInfo* info, ScriptContext* requestContext) override;
-        virtual BOOL GetProperty(Var originalInstance, JavascriptString* propertyNameString, Var* value, PropertyValueInfo* info, ScriptContext* requestContext) override;
-        virtual RecyclableObject * CloneToScriptContext(ScriptContext* requestContext) override;
-
+        static const wchar_t* GetFullBuiltinName(wchar_t** aBuffer, const wchar_t* name);
         static size_t GetOffsetOfValue() { return offsetof(JavascriptSIMDBool8x16, value); }
+        static Var CallToLocaleString(RecyclableObject&, ScriptContext&, SIMDValue, const Var, uint, CallInfo)
+        {
+            Assert(UNREACHED);
+            return nullptr;
+        };
 
+        virtual RecyclableObject * CloneToScriptContext(ScriptContext* requestContext) override;
 
-        // Entry Points
-        /*
-        There is one toString per SIMD type. The code is entrant from value objects (e.g. a.toString()) or on arithmetic operations.
-        It will also be a property of SIMD.*.prototype for SIMD dynamic objects.
-        */
-        static Var EntryToString(RecyclableObject* function, CallInfo callInfo, ...);
-        // End Entry Points
+        __inline SIMDValue GetValue() { return value; }
 
         static void ToStringBuffer(SIMDValue& value, __out_ecount(countBuffer) wchar_t* stringBuffer, size_t countBuffer, ScriptContext* scriptContext = nullptr)
         {
@@ -57,9 +50,6 @@ namespace Js
         }
 
         Var  Copy(ScriptContext* requestContext);
-
-    private:
-        bool GetPropertyBuiltIns(PropertyId propertyId, Var* value, ScriptContext* requestContext);
     };
 }
 

+ 20 - 64
lib/Runtime/Library/JavascriptSimdFloat32x4.cpp

@@ -6,12 +6,12 @@
 
 namespace Js
 {
-    JavascriptSIMDFloat32x4::JavascriptSIMDFloat32x4(StaticType *type) : RecyclableObject(type)
+    JavascriptSIMDFloat32x4::JavascriptSIMDFloat32x4(StaticType *type) : JavascriptSIMDType(type)
     {
         Assert(type->GetTypeId() == TypeIds_SIMDFloat32x4);
     }
 
-    JavascriptSIMDFloat32x4::JavascriptSIMDFloat32x4(SIMDValue *val, StaticType *type) : RecyclableObject(type), value(*val)
+    JavascriptSIMDFloat32x4::JavascriptSIMDFloat32x4(SIMDValue *val, StaticType *type) : JavascriptSIMDType(val, type)
     {
         Assert(type->GetTypeId() == TypeIds_SIMDFloat32x4);
     }
@@ -39,40 +39,40 @@ namespace Js
         return reinterpret_cast<JavascriptSIMDFloat32x4 *>(aValue);
     }
 
-    RecyclableObject * JavascriptSIMDFloat32x4::CloneToScriptContext(ScriptContext* requestContext)
+    Var JavascriptSIMDFloat32x4::CallToLocaleString(RecyclableObject& obj, ScriptContext& requestContext, SIMDValue simdValue,
+        const Var* args, uint numArgs, CallInfo callInfo)
     {
-        return JavascriptSIMDFloat32x4::New(&value, requestContext);
+        wchar_t *typeString = L"SIMD.Float32x4(";
+        return JavascriptSIMDObject::FromVar(&obj)->ToLocaleString<float, 4>(args, numArgs, typeString,
+            simdValue.f32, &callInfo, &requestContext);
     }
 
-    BOOL JavascriptSIMDFloat32x4::GetProperty(Var originalInstance, PropertyId propertyId, Var* value, PropertyValueInfo* info, ScriptContext* requestContext)
+    void JavascriptSIMDFloat32x4::ToStringBuffer(SIMDValue& value, __out_ecount(countBuffer) wchar_t* stringBuffer, size_t countBuffer, ScriptContext* scriptContext)
     {
-        return GetPropertyBuiltIns(propertyId, value, requestContext);
+        const wchar_t* f0 = JavascriptNumber::ToStringRadix10((double)value.f32[0], scriptContext)->GetSz();
+        const wchar_t* f1 = JavascriptNumber::ToStringRadix10((double)value.f32[1], scriptContext)->GetSz();
+        const wchar_t* f2 = JavascriptNumber::ToStringRadix10((double)value.f32[2], scriptContext)->GetSz();
+        const wchar_t* f3 = JavascriptNumber::ToStringRadix10((double)value.f32[3], scriptContext)->GetSz();
+
+        swprintf_s(stringBuffer, countBuffer, L"SIMD.Float32x4(%s, %s, %s, %s)", f0, f1, f2, f3);
     }
 
-    BOOL JavascriptSIMDFloat32x4::GetProperty(Var originalInstance, JavascriptString* propertyNameString, Var* value, PropertyValueInfo* info, ScriptContext* requestContext)
+    const wchar_t* JavascriptSIMDFloat32x4::GetFullBuiltinName(wchar_t** aBuffer, const wchar_t* name)
     {
-        PropertyRecord const* propertyRecord;
-        this->GetScriptContext()->FindPropertyRecord(propertyNameString, &propertyRecord);
-
-        if (propertyRecord != nullptr && GetPropertyBuiltIns(propertyRecord->GetPropertyId(), value, requestContext))
-        {
-            return true;
-        }
-        return false;
+        Assert(aBuffer && *aBuffer);
+        swprintf_s(*aBuffer, SIMD_STRING_BUFFER_MAX, L"SIMD.Float32x4.%s", name);
+        return *aBuffer;
     }
 
-    BOOL JavascriptSIMDFloat32x4::GetPropertyReference(Var originalInstance, PropertyId propertyId, Var* value, PropertyValueInfo* info, ScriptContext* requestContext)
+    RecyclableObject * JavascriptSIMDFloat32x4::CloneToScriptContext(ScriptContext* requestContext)
     {
-        return JavascriptSIMDFloat32x4::GetProperty(originalInstance, propertyId, value, info, requestContext);
+        return JavascriptSIMDFloat32x4::New(&value, requestContext);
     }
 
     bool JavascriptSIMDFloat32x4::GetPropertyBuiltIns(PropertyId propertyId, Var* value, ScriptContext* requestContext)
     {
         switch (propertyId)
         {
-        case PropertyIds::toString:
-            *value = requestContext->GetLibrary()->GetSIMDFloat32x4ToStringFunction();
-            return true;
         case PropertyIds::signMask:
             *value = GetSignMask();
             return true;
@@ -81,50 +81,6 @@ namespace Js
         return false;
     }
 
-    // Entry Points
-
-    Var JavascriptSIMDFloat32x4::EntryToString(RecyclableObject* function, CallInfo callInfo, ...)
-    {
-        PROBE_STACK(function->GetScriptContext(), Js::Constants::MinStackDefault);
-
-        ARGUMENTS(args, callInfo);
-        ScriptContext* scriptContext = function->GetScriptContext();
-
-        AssertMsg(args.Info.Count > 0, "Should always have implicit 'this'");
-        Assert(!(callInfo.Flags & CallFlags_New));
-
-        if (args.Info.Count == 0 || JavascriptOperators::GetTypeId(args[0]) != TypeIds_SIMDFloat32x4)
-        {
-            JavascriptError::ThrowTypeError(scriptContext, JSERR_This_NeedSimd, L"SIMDFloat32x4.toString");
-        }
-
-        JavascriptSIMDFloat32x4 *instance = JavascriptSIMDFloat32x4::FromVar(args[0]);
-        Assert(instance);
-
-
-        SIMDValue value = instance->GetValue();
-        wchar_t stringBuffer[SIMD_STRING_BUFFER_MAX];
-
-        JavascriptSIMDFloat32x4::ToStringBuffer(value, stringBuffer, SIMD_STRING_BUFFER_MAX, scriptContext);
-
-        JavascriptString* string = JavascriptString::NewCopySzFromArena(stringBuffer, scriptContext, scriptContext->GeneralAllocator());
-
-        return string;
-    }
-
-    // End Entry Points
-    
-    void JavascriptSIMDFloat32x4::ToStringBuffer(SIMDValue& value, __out_ecount(countBuffer) wchar_t* stringBuffer, size_t countBuffer, ScriptContext* scriptContext)
-    {
-        JavascriptString *s0, *s1, *s2, *s3;
-        s0 = JavascriptNumber::ToStringRadix10((double)value.f32[0], scriptContext);
-        s1 = JavascriptNumber::ToStringRadix10((double)value.f32[1], scriptContext);
-        s2 = JavascriptNumber::ToStringRadix10((double)value.f32[2], scriptContext);
-        s3 = JavascriptNumber::ToStringRadix10((double)value.f32[3], scriptContext);
-
-        swprintf_s(stringBuffer, countBuffer, L"SIMD.Float32x4(%s, %s, %s, %s)", s0->GetSz(), s1->GetSz(), s2->GetSz(), s3->GetSz());
-    }
-
     Var JavascriptSIMDFloat32x4::Copy(ScriptContext* requestContext)
     {
         return JavascriptSIMDFloat32x4::New(&this->value, requestContext);

+ 11 - 20
lib/Runtime/Library/JavascriptSimdFloat32x4.h

@@ -9,18 +9,19 @@ class JavascriptSIMDFloat64x2;
 
 namespace Js
 {
-    class JavascriptSIMDFloat32x4 sealed : public RecyclableObject
+    class JavascriptSIMDFloat32x4 sealed : public JavascriptSIMDType
     {
     private:
-        SIMDValue value;
-
-        DEFINE_VTABLE_CTOR(JavascriptSIMDFloat32x4, RecyclableObject);
+        DEFINE_VTABLE_CTOR(JavascriptSIMDFloat32x4, JavascriptSIMDType);
 
     public:
         class EntryInfo
         {
         public:
             static FunctionInfo ToString;
+            static FunctionInfo ToLocaleString;
+            static FunctionInfo ValueOf;
+            static FunctionInfo SymbolToPrimitive;
         };
 
         JavascriptSIMDFloat32x4(StaticType *type);
@@ -30,33 +31,23 @@ namespace Js
         static JavascriptSIMDFloat32x4* New(SIMDValue *val, ScriptContext* requestContext);
         static bool Is(Var instance);
         static JavascriptSIMDFloat32x4* FromVar(Var aValue);
-
+        static const wchar_t* GetFullBuiltinName(wchar_t** aBuffer, const wchar_t* name);
         static JavascriptSIMDFloat32x4* FromFloat64x2(JavascriptSIMDFloat64x2 *instance, ScriptContext* requestContext);
         static JavascriptSIMDFloat32x4* FromInt32x4(JavascriptSIMDInt32x4   *instance, ScriptContext* requestContext);
+        static Var CallToLocaleString(RecyclableObject& obj, ScriptContext& requestContext, SIMDValue simdValue,
+            const Var* args, uint numArgs, CallInfo callInfo);
+        static void ToStringBuffer(SIMDValue& value, __out_ecount(countBuffer) wchar_t* stringBuffer, size_t countBuffer,
+            ScriptContext* scriptContext);
 
         __inline SIMDValue GetValue() { return value; }
-
-        virtual BOOL GetPropertyReference(Var originalInstance, PropertyId propertyId, Var* value, PropertyValueInfo* info, ScriptContext* requestContext) override;
-        virtual BOOL GetProperty(Var originalInstance, PropertyId propertyId, Var* value, PropertyValueInfo* info, ScriptContext* requestContext) override;
-        virtual BOOL GetProperty(Var originalInstance, JavascriptString* propertyNameString, Var* value, PropertyValueInfo* info, ScriptContext* requestContext) override;
         virtual RecyclableObject * CloneToScriptContext(ScriptContext* requestContext) override;
 
         static size_t GetOffsetOfValue() { return offsetof(JavascriptSIMDFloat32x4, value); }
 
-        // Entry Points
-        /*
-        There is one toString per SIMD type. The code is entrant from value objects (e.g. a.toString()) or on arithmetic operations.
-        It will also be a property of SIMD.float32x4.prototype for SIMD dynamic objects.
-        */
-        static Var EntryToString(RecyclableObject* function, CallInfo callInfo, ...);
-        // End Entry Points
-
-        static void ToStringBuffer(SIMDValue& value, __out_ecount(countBuffer) wchar_t* stringBuffer, size_t countBuffer, ScriptContext* scriptContext);
-
         Var  Copy(ScriptContext* requestContext);
 
     private:
-        bool GetPropertyBuiltIns(PropertyId propertyId, Var* value, ScriptContext* requestContext);
+        virtual bool GetPropertyBuiltIns(PropertyId propertyId, Var* value, ScriptContext* requestContext) override;
         Var  GetSignMask();
     };
 }

+ 6 - 0
lib/Runtime/Library/JavascriptSimdFloat64x2.h

@@ -21,6 +21,9 @@ namespace Js
         {
         public:
             static FunctionInfo ToString;
+            static FunctionInfo ToLocaleString;
+            static FunctionInfo ValueOf;
+            static FunctionInfo SymbolToPrimitive;
         };
 
         JavascriptSIMDFloat64x2(SIMDValue *val, StaticType *type);
@@ -45,6 +48,9 @@ namespace Js
         It will also be a property of SIMD.float64x2.prototype for SIMD dynamic objects.
         */
         static Var EntryToString(RecyclableObject* function, CallInfo callInfo, ...);
+        static Var EntryToLocaleString(RecyclableObject* function, CallInfo callInfo, ...);
+        static Var EntryValueOf(RecyclableObject* function, CallInfo callInfo, ...);
+        static Var EntrySymbolToPrimitive(RecyclableObject* function, CallInfo callInfo, ...);
         // End Entry Points
 
         static void ToStringBuffer(SIMDValue& value, __out_ecount(countBuffer) wchar_t* stringBuffer, size_t countBuffer, ScriptContext* scriptContext = nullptr)

+ 12 - 60
lib/Runtime/Library/JavascriptSimdInt16x8.cpp

@@ -8,7 +8,7 @@
 
 namespace Js
 {
-    JavascriptSIMDInt16x8::JavascriptSIMDInt16x8(SIMDValue *val, StaticType *type) : RecyclableObject(type), value(*val)
+    JavascriptSIMDInt16x8::JavascriptSIMDInt16x8(SIMDValue *val, StaticType *type) : JavascriptSIMDType(val, type)
     {
         Assert(type->GetTypeId() == TypeIds_SIMDInt16x8);
     }
@@ -31,72 +31,24 @@ namespace Js
         return reinterpret_cast<JavascriptSIMDInt16x8 *>(aValue);
     }
 
-    RecyclableObject * JavascriptSIMDInt16x8::CloneToScriptContext(ScriptContext* requestContext)
-    {
-        return JavascriptSIMDInt16x8::New(&value, requestContext);
-    }
-
-    BOOL JavascriptSIMDInt16x8::GetProperty(Var originalInstance, PropertyId propertyId, Var* value, PropertyValueInfo* info, ScriptContext* requestContext)
-    {
-        return GetPropertyBuiltIns(propertyId, value, requestContext);
-
-    }
-
-    BOOL JavascriptSIMDInt16x8::GetProperty(Var originalInstance, JavascriptString* propertyNameString, Var* value, PropertyValueInfo* info, ScriptContext* requestContext)
-    {
-        PropertyRecord const* propertyRecord;
-        this->GetScriptContext()->FindPropertyRecord(propertyNameString, &propertyRecord);
-
-        if (propertyRecord != nullptr && GetPropertyBuiltIns(propertyRecord->GetPropertyId(), value, requestContext))
-        {
-            return true;
-        }
-        return false;
-    }
-
-    BOOL JavascriptSIMDInt16x8::GetPropertyReference(Var originalInstance, PropertyId propertyId, Var* value, PropertyValueInfo* info, ScriptContext* requestContext)
+    Var JavascriptSIMDInt16x8::CallToLocaleString(RecyclableObject& obj, ScriptContext& requestContext, SIMDValue simdValue,
+        const Var* args, uint numArgs, CallInfo callInfo)
     {
-        return JavascriptSIMDInt16x8::GetProperty(originalInstance, propertyId, value, info, requestContext);
+        wchar_t *typeString = L"SIMD.Int16x8(";
+        return JavascriptSIMDObject::FromVar(&obj)->ToLocaleString<int16, 8>(args, numArgs, typeString,
+            simdValue.i16, &callInfo, &requestContext);
     }
 
-    bool JavascriptSIMDInt16x8::GetPropertyBuiltIns(PropertyId propertyId, Var* value, ScriptContext* requestContext)
+    RecyclableObject * JavascriptSIMDInt16x8::CloneToScriptContext(ScriptContext* requestContext)
     {
-        switch (propertyId)
-        {
-        case PropertyIds::toString:
-            *value = requestContext->GetLibrary()->GetSIMDInt16x8ToStringFunction();
-            return true;
-        }
-
-        return false;
+        return JavascriptSIMDInt16x8::New(&value, requestContext);
     }
 
-    Var JavascriptSIMDInt16x8::EntryToString(RecyclableObject* function, CallInfo callInfo, ...)
+    const wchar_t* JavascriptSIMDInt16x8::GetFullBuiltinName(wchar_t** aBuffer, const wchar_t* name)
     {
-        PROBE_STACK(function->GetScriptContext(), Js::Constants::MinStackDefault);
-
-        ARGUMENTS(args, callInfo);
-        ScriptContext* scriptContext = function->GetScriptContext();
-
-        AssertMsg(args.Info.Count > 0, "Should always have implicit 'this'");
-        Assert(!(callInfo.Flags & CallFlags_New));
-
-        if (args.Info.Count == 0 || JavascriptOperators::GetTypeId(args[0]) != TypeIds_SIMDInt16x8)
-        {
-            JavascriptError::ThrowTypeError(scriptContext, JSERR_This_NeedSimd, L"SIMDInt16x8.toString");
-        }
-
-        JavascriptSIMDInt16x8* instance = JavascriptSIMDInt16x8::FromVar(args[0]);
-        Assert(instance);
-
-        wchar_t stringBuffer[SIMD_STRING_BUFFER_MAX];
-        SIMDValue value = instance->GetValue();
-
-        JavascriptSIMDInt16x8::ToStringBuffer(value, stringBuffer, SIMD_STRING_BUFFER_MAX);
-
-        JavascriptString* string = JavascriptString::NewCopySzFromArena(stringBuffer, scriptContext, scriptContext->GeneralAllocator());
-
-        return string;
+        Assert(aBuffer && *aBuffer);
+        swprintf_s(*aBuffer, SIMD_STRING_BUFFER_MAX, L"SIMD.Int16x8.%s", name);
+        return *aBuffer;
     }
 
     Var JavascriptSIMDInt16x8::Copy(ScriptContext* requestContext)

+ 12 - 19
lib/Runtime/Library/JavascriptSimdInt16x8.h

@@ -11,19 +11,19 @@ class JavascriptSIMDFloat64x2;
 
 namespace Js
 {
-    class JavascriptSIMDInt16x8 sealed : public RecyclableObject
+    class JavascriptSIMDInt16x8 sealed : public JavascriptSIMDType
     {
     private:
-        SIMDValue value;
-
-        DEFINE_VTABLE_CTOR(JavascriptSIMDInt16x8, RecyclableObject);
-
+        DEFINE_VTABLE_CTOR(JavascriptSIMDInt16x8, JavascriptSIMDType);
 
     public:
         class EntryInfo
         {
         public:
             static FunctionInfo ToString;
+            static FunctionInfo ToLocaleString;
+            static FunctionInfo ValueOf;
+            static FunctionInfo SymbolToPrimitive;
             static FunctionInfo Bool;
         };
 
@@ -31,17 +31,12 @@ namespace Js
         static JavascriptSIMDInt16x8* New(SIMDValue *val, ScriptContext* requestContext);
         static bool Is(Var instance);
         static JavascriptSIMDInt16x8* FromVar(Var aValue);
+        static const wchar_t* GetFullBuiltinName(wchar_t** aBuffer, const wchar_t* name);
+        static Var CallToLocaleString(RecyclableObject& obj, ScriptContext& requestContext, SIMDValue simdValue, const Var* args, uint numArgs, CallInfo callInfo);
 
-        __inline SIMDValue GetValue() { return value; }
-
-        virtual BOOL GetPropertyReference(Var originalInstance, PropertyId propertyId, Var* value, PropertyValueInfo* info, ScriptContext* requestContext) override;
-        virtual BOOL GetProperty(Var originalInstance, PropertyId propertyId, Var* value, PropertyValueInfo* info, ScriptContext* requestContext) override;
-        virtual BOOL GetProperty(Var originalInstance, JavascriptString* propertyNameString, Var* value, PropertyValueInfo* info, ScriptContext* requestContext) override;
         virtual RecyclableObject * CloneToScriptContext(ScriptContext* requestContext) override;
 
-        // Entry Points
-        static Var EntryToString(RecyclableObject* function, CallInfo callInfo, ...);
-        // End Entry Points
+        __inline SIMDValue GetValue() { return value; }
 
         static void ToStringBuffer(SIMDValue& value, __out_ecount(countBuffer) wchar_t* stringBuffer, size_t countBuffer, ScriptContext* scriptContext = nullptr)
         {
@@ -49,13 +44,11 @@ namespace Js
                 value.i16[4], value.i16[5], value.i16[6], value.i16[7]);
         }
 
-        Var  Copy(ScriptContext* requestContext);
-        Var  CopyAndSetLane(uint index, int value, ScriptContext* requestContext);
+        Var Copy(ScriptContext* requestContext);
+        Var CopyAndSetLane(uint index, int value, ScriptContext* requestContext);
 
     private:
-        bool GetPropertyBuiltIns(PropertyId propertyId, Var* value, ScriptContext* requestContext);
-        Var  GetLaneAsNumber(uint index, ScriptContext* requestContext);
-        Var  GetLaneAsFlag(uint index, ScriptContext* requestContext);
+        Var GetLaneAsNumber(uint index, ScriptContext* requestContext);
+        Var GetLaneAsFlag(uint index, ScriptContext* requestContext);
     };
 }
-

+ 14 - 54
lib/Runtime/Library/JavascriptSimdInt32x4.cpp

@@ -6,12 +6,12 @@
 
 namespace Js
 {
-    JavascriptSIMDInt32x4::JavascriptSIMDInt32x4(StaticType *type) : RecyclableObject(type)
+    JavascriptSIMDInt32x4::JavascriptSIMDInt32x4(StaticType *type) : JavascriptSIMDType(type)
     {
         Assert(type->GetTypeId() == TypeIds_SIMDInt32x4);
     }
 
-    JavascriptSIMDInt32x4::JavascriptSIMDInt32x4(SIMDValue *val, StaticType *type) : RecyclableObject(type), value(*val)
+    JavascriptSIMDInt32x4::JavascriptSIMDInt32x4(SIMDValue *val, StaticType *type) : JavascriptSIMDType(val, type)
     {
         Assert(type->GetTypeId() == TypeIds_SIMDInt32x4);
     }
@@ -56,37 +56,10 @@ namespace Js
         return JavascriptSIMDInt32x4::New(&value, requestContext);
     }
 
-    BOOL JavascriptSIMDInt32x4::GetProperty(Var originalInstance, PropertyId propertyId, Var* value, PropertyValueInfo* info, ScriptContext* requestContext)
-    {
-        return GetPropertyBuiltIns(propertyId, value, requestContext);
-
-    }
-
-    BOOL JavascriptSIMDInt32x4::GetProperty(Var originalInstance, JavascriptString* propertyNameString, Var* value, PropertyValueInfo* info, ScriptContext* requestContext)
-    {
-        PropertyRecord const* propertyRecord;
-        this->GetScriptContext()->FindPropertyRecord(propertyNameString, &propertyRecord);
-
-        if (propertyRecord != nullptr && GetPropertyBuiltIns(propertyRecord->GetPropertyId(), value, requestContext))
-        {
-            return true;
-        }
-        return false;
-    }
-
-    BOOL JavascriptSIMDInt32x4::GetPropertyReference(Var originalInstance, PropertyId propertyId, Var* value, PropertyValueInfo* info, ScriptContext* requestContext)
-    {
-        return JavascriptSIMDInt32x4::GetProperty(originalInstance, propertyId, value, info, requestContext);
-    }
-
     bool JavascriptSIMDInt32x4::GetPropertyBuiltIns(PropertyId propertyId, Var* value, ScriptContext* requestContext)
     {
         switch (propertyId)
         {
-        case PropertyIds::toString:
-            *value = requestContext->GetLibrary()->GetSIMDInt32x4ToStringFunction();
-            return true;
-
         case PropertyIds::signMask:
             *value = GetSignMask();
             return true;
@@ -102,32 +75,11 @@ namespace Js
         return false;
     }
 
-    Var JavascriptSIMDInt32x4::EntryToString(RecyclableObject* function, CallInfo callInfo, ...)
+    const wchar_t* JavascriptSIMDInt32x4::GetFullBuiltinName(wchar_t** aBuffer, const wchar_t* name)
     {
-        PROBE_STACK(function->GetScriptContext(), Js::Constants::MinStackDefault);
-
-        ARGUMENTS(args, callInfo);
-        ScriptContext* scriptContext = function->GetScriptContext();
-
-        AssertMsg(args.Info.Count > 0, "Should always have implicit 'this'");
-        Assert(!(callInfo.Flags & CallFlags_New));
-
-        if (args.Info.Count == 0 || JavascriptOperators::GetTypeId(args[0]) != TypeIds_SIMDInt32x4)
-        {
-            JavascriptError::ThrowTypeError(scriptContext, JSERR_This_NeedSimd, L"SIMDInt32x4.toString");
-        }
-
-        JavascriptSIMDInt32x4* instance = JavascriptSIMDInt32x4::FromVar(args[0]);
-        Assert(instance);
-
-        wchar_t stringBuffer[SIMD_STRING_BUFFER_MAX];
-        SIMDValue value = instance->GetValue();
-
-        JavascriptSIMDInt32x4::ToStringBuffer(value, stringBuffer, SIMD_STRING_BUFFER_MAX);
-
-        JavascriptString* string = JavascriptString::NewCopySzFromArena(stringBuffer, scriptContext, scriptContext->GeneralAllocator());
-
-        return string;
+        Assert(aBuffer && *aBuffer);
+        swprintf_s(*aBuffer, SIMD_STRING_BUFFER_MAX, L"SIMD.Int32x4.%s", name);
+        return *aBuffer;
     }
 
     Var JavascriptSIMDInt32x4::Copy(ScriptContext* requestContext)
@@ -135,6 +87,14 @@ namespace Js
         return JavascriptSIMDInt32x4::New(&this->value, requestContext);
     }
 
+    Var JavascriptSIMDInt32x4::CallToLocaleString(RecyclableObject& obj, ScriptContext& requestContext, SIMDValue simdValue,
+        const Var* args, uint numArgs, CallInfo callInfo)
+    {
+        wchar_t *typeString = L"SIMD.Int32x4(";
+        return JavascriptSIMDObject::FromVar(&obj)->ToLocaleString<int, 4>(args, numArgs, typeString,
+            simdValue.i32, &callInfo, &requestContext);
+    }
+
     Var  JavascriptSIMDInt32x4::CopyAndSetLaneFlag(uint index, BOOL value, ScriptContext* requestContext)
     {
         AnalysisAssert(index < 4);

+ 13 - 21
lib/Runtime/Library/JavascriptSimdInt32x4.h

@@ -8,18 +8,19 @@ namespace Js
 {
     class JavascriptSIMDUint32x4;
 
-    class JavascriptSIMDInt32x4 sealed : public RecyclableObject
+    class JavascriptSIMDInt32x4 sealed : public JavascriptSIMDType
     {
     private:
-        SIMDValue value;
-
-        DEFINE_VTABLE_CTOR(JavascriptSIMDInt32x4, RecyclableObject);
+        DEFINE_VTABLE_CTOR(JavascriptSIMDInt32x4, JavascriptSIMDType);
 
     public:
         class EntryInfo
         {
         public:
             static FunctionInfo ToString;
+            static FunctionInfo ToLocaleString;
+            static FunctionInfo ValueOf;
+            static FunctionInfo SymbolToPrimitive;
             static FunctionInfo Bool;
         };
 
@@ -30,36 +31,27 @@ namespace Js
         static JavascriptSIMDInt32x4* New(SIMDValue *val, ScriptContext* requestContext);
         static bool Is(Var instance);
         static JavascriptSIMDInt32x4* FromVar(Var aValue);
+        static const wchar_t* GetFullBuiltinName(wchar_t** aBuffer, const wchar_t* name);
 
         static JavascriptSIMDInt32x4* FromBool(SIMDValue *val, ScriptContext* requestContext);
         static JavascriptSIMDInt32x4* FromFloat64x2(JavascriptSIMDFloat64x2 *instance, ScriptContext* requestContext);
-
-        __inline SIMDValue GetValue() { return value; }
-
-        virtual BOOL GetPropertyReference(Var originalInstance, PropertyId propertyId, Var* value, PropertyValueInfo* info, ScriptContext* requestContext) override;
-        virtual BOOL GetProperty(Var originalInstance, PropertyId propertyId, Var* value, PropertyValueInfo* info, ScriptContext* requestContext) override;
-        virtual BOOL GetProperty(Var originalInstance, JavascriptString* propertyNameString, Var* value, PropertyValueInfo* info, ScriptContext* requestContext) override;
-        virtual RecyclableObject * CloneToScriptContext(ScriptContext* requestContext) override;
-        static size_t GetOffsetOfValue() { return offsetof(JavascriptSIMDInt32x4, value); }
-
-        // Entry Points
-        /*
-        There is one toString per SIMD type. The code is entrant from value objects explicitly (e.g. a.toString()) or on overloaded operations.
-        It will also be a property of SIMD.int32x4.prototype for SIMD dynamic objects.
-        */
-        static Var EntryToString(RecyclableObject* function, CallInfo callInfo, ...);
-        // End Entry Points
+        static JavascriptSIMDInt32x4* FromFloat32x4(JavascriptSIMDFloat32x4   *instance, ScriptContext* requestContext);
+        static Var CallToLocaleString(RecyclableObject& obj, ScriptContext& requestContext, SIMDValue simdValue, const Var* args, uint numArgs, CallInfo callInfo);
 
         static void ToStringBuffer(SIMDValue& value, __out_ecount(countBuffer) wchar_t* stringBuffer, size_t countBuffer, ScriptContext* scriptContext = nullptr)
         {
             swprintf_s(stringBuffer, countBuffer, L"SIMD.Int32x4(%d, %d, %d, %d)", value.i32[SIMD_X], value.i32[SIMD_Y], value.i32[SIMD_Z], value.i32[SIMD_W]);
         }
+        __inline SIMDValue GetValue() { return value; }
+
+        virtual RecyclableObject * CloneToScriptContext(ScriptContext* requestContext) override;
+        static size_t GetOffsetOfValue() { return offsetof(JavascriptSIMDInt32x4, value); }
 
         Var  Copy(ScriptContext* requestContext);
         Var  CopyAndSetLaneFlag(uint index, BOOL value, ScriptContext* requestContext);
 
     private:
-        bool GetPropertyBuiltIns(PropertyId propertyId, Var* value, ScriptContext* requestContext);
+        virtual bool GetPropertyBuiltIns(PropertyId propertyId, Var* value, ScriptContext* requestContext) override;
         Var  GetLaneAsFlag(uint index, ScriptContext* requestContext);
         Var  GetSignMask();
     };

+ 12 - 56
lib/Runtime/Library/JavascriptSimdInt8x16.cpp

@@ -6,7 +6,7 @@
 
 namespace Js
 {
-    JavascriptSIMDInt8x16::JavascriptSIMDInt8x16(SIMDValue *val, StaticType *type) : RecyclableObject(type), value(*val)
+    JavascriptSIMDInt8x16::JavascriptSIMDInt8x16(SIMDValue *val, StaticType *type) : JavascriptSIMDType(type), value(*val)
     {
         Assert(type->GetTypeId() == TypeIds_SIMDInt8x16);
     }
@@ -29,68 +29,24 @@ namespace Js
         return reinterpret_cast<JavascriptSIMDInt8x16 *>(aValue);
     }
 
-    RecyclableObject * JavascriptSIMDInt8x16::CloneToScriptContext(ScriptContext* requestContext)
-    {
-        return JavascriptSIMDInt8x16::New(&value, requestContext);
-    }
-
-    BOOL JavascriptSIMDInt8x16::GetProperty(Var originalInstance, PropertyId propertyId, Var* value, PropertyValueInfo* info, ScriptContext* requestContext)
+    Var JavascriptSIMDInt8x16::CallToLocaleString(RecyclableObject& obj, ScriptContext& requestContext, SIMDValue simdValue,
+        const Var* args, uint numArgs, CallInfo callInfo)
     {
-        return GetPropertyBuiltIns(propertyId, value, requestContext);
+        wchar_t *typeString = L"SIMD.Int8x16(";
+        return JavascriptSIMDObject::FromVar(&obj)->ToLocaleString<int8, 16>(args, numArgs, typeString,
+            simdValue.i8, &callInfo, &requestContext);
     }
 
-    BOOL JavascriptSIMDInt8x16::GetProperty(Var originalInstance, JavascriptString* propertyNameString, Var* value, PropertyValueInfo* info, ScriptContext* requestContext)
-    {
-        PropertyRecord const* propertyRecord;
-        this->GetScriptContext()->FindPropertyRecord(propertyNameString, &propertyRecord);
-
-        if (propertyRecord != nullptr && GetPropertyBuiltIns(propertyRecord->GetPropertyId(), value, requestContext))
-        {
-            return true;
-        }
-        return false;
-    }
-
-    BOOL JavascriptSIMDInt8x16::GetPropertyReference(Var originalInstance, PropertyId propertyId, Var* value, PropertyValueInfo* info, ScriptContext* requestContext)
-    {
-        return JavascriptSIMDInt8x16::GetProperty(originalInstance, propertyId, value, info, requestContext);
-    }
-
-    bool JavascriptSIMDInt8x16::GetPropertyBuiltIns(PropertyId propertyId, Var* value, ScriptContext* requestContext)
+    RecyclableObject * JavascriptSIMDInt8x16::CloneToScriptContext(ScriptContext* requestContext)
     {
-        if (propertyId == PropertyIds::toString)
-        {
-            *value = requestContext->GetLibrary()->GetSIMDInt8x16ToStringFunction();
-            return true;
-        }
-        return false;
+        return JavascriptSIMDInt8x16::New(&value, requestContext);
     }
 
-    Var JavascriptSIMDInt8x16::EntryToString(RecyclableObject* function, CallInfo callInfo, ...)
+    const wchar_t* JavascriptSIMDInt8x16::GetFullBuiltinName(wchar_t** aBuffer, const wchar_t* name)
     {
-        PROBE_STACK(function->GetScriptContext(), Js::Constants::MinStackDefault);
-
-        ARGUMENTS(args, callInfo);
-        ScriptContext* scriptContext = function->GetScriptContext();
-
-        AssertMsg(args.Info.Count > 0, "Should always have implicit 'this'");
-        Assert(!(callInfo.Flags & CallFlags_New));
-        if (args.Info.Count == 0 || JavascriptOperators::GetTypeId(args[0]) != TypeIds_SIMDInt8x16)
-        {
-            JavascriptError::ThrowTypeError(scriptContext, JSERR_This_NeedSimd, L"SIMDInt8x16.toString");
-        }
-
-        JavascriptSIMDInt8x16* instance = JavascriptSIMDInt8x16::FromVar(args[0]);
-        Assert(instance);
-
-        wchar_t stringBuffer[SIMD_STRING_BUFFER_MAX];
-        SIMDValue value = instance->GetValue();
-
-        JavascriptSIMDInt8x16::ToStringBuffer(value, stringBuffer, SIMD_STRING_BUFFER_MAX);
-
-        JavascriptString* string = JavascriptString::NewCopySzFromArena(stringBuffer, scriptContext, scriptContext->GeneralAllocator());
-
-        return string;
+        Assert(aBuffer && *aBuffer);
+        swprintf_s(*aBuffer, SIMD_STRING_BUFFER_MAX, L"SIMD.Int8x16.%s", name);
+        return *aBuffer;
     }
 
     Var JavascriptSIMDInt8x16::Copy(ScriptContext* requestContext)

+ 10 - 21
lib/Runtime/Library/JavascriptSimdInt8x16.h

@@ -10,40 +10,29 @@ class JavascriptSIMDInt16x8;
 
 namespace Js
 {
-    class JavascriptSIMDInt8x16 sealed : public RecyclableObject
+    class JavascriptSIMDInt8x16 sealed : public JavascriptSIMDType
     {
     private:
         SIMDValue value;
 
-        DEFINE_VTABLE_CTOR(JavascriptSIMDInt8x16, RecyclableObject);
+        DEFINE_VTABLE_CTOR(JavascriptSIMDInt8x16, JavascriptSIMDType);
 
     public:
         class EntryInfo
         {
         public:
             static FunctionInfo ToString;
+            static FunctionInfo ToLocaleString;
+            static FunctionInfo ValueOf;
+            static FunctionInfo SymbolToPrimitive;
         };
 
         JavascriptSIMDInt8x16(SIMDValue *val, StaticType *type);
         static JavascriptSIMDInt8x16* New(SIMDValue *val, ScriptContext* requestContext);
         static bool Is(Var instance);
         static JavascriptSIMDInt8x16* FromVar(Var aValue);
-
-        __inline SIMDValue GetValue() { return value; }
-
-        virtual BOOL GetPropertyReference(Var originalInstance, PropertyId propertyId, Var* value, PropertyValueInfo* info, ScriptContext* requestContext) override;
-        virtual BOOL GetProperty(Var originalInstance, PropertyId propertyId, Var* value, PropertyValueInfo* info, ScriptContext* requestContext) override;
-        virtual BOOL GetProperty(Var originalInstance, JavascriptString* propertyNameString, Var* value, PropertyValueInfo* info, ScriptContext* requestContext) override;
-        virtual RecyclableObject * CloneToScriptContext(ScriptContext* requestContext) override;
-
-        // Entry Points
-        /*
-        There is one toString per SIMD type. The code is entrant from value objects explicitly (e.g. a.toString()) or on overloaded operations.
-        It will also be a property of SIMD.int8x16.prototype for SIMD dynamic objects.
-        */
-
-        static Var EntryToString(RecyclableObject* function, CallInfo callInfo, ...);
-        // End Entry Points
+        static const wchar_t* GetFullBuiltinName(wchar_t** aBuffer, const wchar_t* name);
+        static Var CallToLocaleString(RecyclableObject& obj, ScriptContext& requestContext, SIMDValue simdValue, const Var* args, uint numArgs, CallInfo callInfo);
 
         static void ToStringBuffer(SIMDValue& value, __out_ecount(countBuffer) wchar_t* stringBuffer, size_t countBuffer, ScriptContext* scriptContext = nullptr)
         {
@@ -52,9 +41,9 @@ namespace Js
                 value.i8[8], value.i8[9], value.i8[10], value.i8[11], value.i8[12], value.i8[13], value.i8[14], value.i8[15]);
         }
 
-        Var  Copy(ScriptContext* requestContext);
+        virtual RecyclableObject * CloneToScriptContext(ScriptContext* requestContext) override;
 
-    private:
-        bool GetPropertyBuiltIns(PropertyId propertyId, Var* value, ScriptContext* requestContext);
+        __inline SIMDValue GetValue() { return value; }
+        Var  Copy(ScriptContext* requestContext);
     };
 }

+ 257 - 0
lib/Runtime/Library/JavascriptSimdObject.cpp

@@ -0,0 +1,257 @@
+//-------------------------------------------------------------------------------------------------------
+// Copyright (C) Microsoft. All rights reserved.
+// Licensed under the MIT license. See LICENSE.txt file in the project root for full license information.
+//-------------------------------------------------------------------------------------------------------
+#include "RuntimeLibraryPch.h"
+
+namespace Js
+{
+    JavascriptSIMDObject::JavascriptSIMDObject(DynamicType * type)
+        : DynamicObject(type), value(Js::TaggedInt::ToVarUnchecked(0))
+    {
+        Assert(type->GetTypeId() == TypeIds_SIMDObject);
+    }
+
+    JavascriptSIMDObject::JavascriptSIMDObject(Var value,  DynamicType * type, TypeId typeDescriptor)
+        : DynamicObject(type), typeDescriptor(typeDescriptor), value(value)
+    {
+        Assert(type->GetTypeId() == TypeIds_SIMDObject);
+        switch (typeDescriptor)
+        {
+        //typeDescriptor is TypeIds_SIMDObject only while initializing the SIMDObject prototypes.
+        //Dynamically created wrapper objects must have a concrete typeDescriptor of a SIMDType.
+        case TypeIds_SIMDObject: 
+            numLanes = 0;
+            break;
+        case TypeIds_SIMDBool8x16:
+        case TypeIds_SIMDInt8x16:
+        case TypeIds_SIMDUint8x16:
+            numLanes = 16;
+            break;
+        case TypeIds_SIMDBool16x8:
+        case TypeIds_SIMDInt16x8:
+        case TypeIds_SIMDUint16x8:
+            numLanes = 8;
+            break;
+        case TypeIds_SIMDBool32x4:
+        case TypeIds_SIMDInt32x4:
+        case TypeIds_SIMDUint32x4:
+        case TypeIds_SIMDFloat32x4:
+            numLanes = 4;
+            break;
+        default:
+            Assert(UNREACHED);
+        }
+    }
+    void JavascriptSIMDObject::SetTypeDescriptor(TypeId tid)
+    {
+        Assert(tid != TypeIds_SIMDObject);
+
+        typeDescriptor = tid;
+        switch (typeDescriptor)
+        {
+        case TypeIds_SIMDBool8x16:
+        case TypeIds_SIMDInt8x16:
+        case TypeIds_SIMDUint8x16:
+            numLanes = 16;
+            break;
+        case TypeIds_SIMDBool16x8:
+        case TypeIds_SIMDInt16x8:
+        case TypeIds_SIMDUint16x8:
+            numLanes = 8;
+            break;
+        case TypeIds_SIMDBool32x4:
+        case TypeIds_SIMDInt32x4:
+        case TypeIds_SIMDUint32x4:
+        case TypeIds_SIMDFloat32x4:
+            numLanes = 4;
+            break;
+        default:
+            Assert(UNREACHED);
+        }
+    }
+
+    bool JavascriptSIMDObject::Is(Var aValue)
+    {
+        return JavascriptOperators::GetTypeId(aValue) == TypeIds_SIMDObject;
+    }
+
+    JavascriptSIMDObject* JavascriptSIMDObject::FromVar(Var aValue)
+    {
+        AssertMsg(Is(aValue), "Ensure var is actually a 'JavascriptSIMD'");
+
+        return static_cast<JavascriptSIMDObject *>(RecyclableObject::FromVar(aValue));
+    }
+
+    Var JavascriptSIMDObject::Unwrap() const
+    {        
+        return value;
+    }
+
+    Var JavascriptSIMDObject::ToString(ScriptContext* scriptContext) const
+    {
+        Assert(scriptContext);
+        Assert(typeDescriptor != TypeIds_SIMDObject);
+
+        BEGIN_TEMP_ALLOCATOR(tempAllocator, scriptContext, L"fromCodePoint");
+        wchar_t* stringBuffer = AnewArray(tempAllocator, wchar_t, SIMD_STRING_BUFFER_MAX);
+        SIMDValue simdValue;
+        switch (typeDescriptor)
+        {
+        case TypeIds_SIMDBool8x16:
+            simdValue = JavascriptSIMDBool8x16::FromVar(value)->GetValue();
+            JavascriptSIMDBool8x16::ToStringBuffer(simdValue, stringBuffer, SIMD_STRING_BUFFER_MAX, scriptContext);
+            break;
+        case TypeIds_SIMDInt8x16:
+            simdValue = JavascriptSIMDInt8x16::FromVar(value)->GetValue();
+            JavascriptSIMDInt8x16::ToStringBuffer(simdValue, stringBuffer, SIMD_STRING_BUFFER_MAX, scriptContext);
+            break;
+        case TypeIds_SIMDUint8x16:
+            simdValue = JavascriptSIMDUint8x16::FromVar(value)->GetValue();
+            JavascriptSIMDUint8x16::ToStringBuffer(simdValue, stringBuffer, SIMD_STRING_BUFFER_MAX, scriptContext);
+            break;
+        case TypeIds_SIMDBool16x8:
+            simdValue = JavascriptSIMDBool16x8::FromVar(value)->GetValue();
+            JavascriptSIMDBool16x8::ToStringBuffer(simdValue, stringBuffer, SIMD_STRING_BUFFER_MAX, scriptContext);
+            break;
+        case TypeIds_SIMDInt16x8:
+            simdValue = JavascriptSIMDInt16x8::FromVar(value)->GetValue();
+            JavascriptSIMDInt16x8::ToStringBuffer(simdValue, stringBuffer, SIMD_STRING_BUFFER_MAX, scriptContext);
+            break;
+        case TypeIds_SIMDUint16x8:
+            simdValue = JavascriptSIMDUint16x8::FromVar(value)->GetValue();
+            JavascriptSIMDUint16x8::ToStringBuffer(simdValue, stringBuffer, SIMD_STRING_BUFFER_MAX, scriptContext);
+            break;
+        case TypeIds_SIMDBool32x4:
+            simdValue = JavascriptSIMDBool32x4::FromVar(value)->GetValue();
+            JavascriptSIMDBool32x4::ToStringBuffer(simdValue, stringBuffer, SIMD_STRING_BUFFER_MAX, scriptContext);
+            break;
+        case TypeIds_SIMDInt32x4:
+            simdValue = JavascriptSIMDInt32x4::FromVar(value)->GetValue();
+            JavascriptSIMDInt32x4::ToStringBuffer(simdValue, stringBuffer, SIMD_STRING_BUFFER_MAX, scriptContext);
+            break;
+        case TypeIds_SIMDUint32x4:
+            simdValue = JavascriptSIMDUint32x4::FromVar(value)->GetValue();
+            JavascriptSIMDUint32x4::ToStringBuffer(simdValue, stringBuffer, SIMD_STRING_BUFFER_MAX, scriptContext);
+            break;
+        case TypeIds_SIMDFloat32x4:
+            simdValue = JavascriptSIMDFloat32x4::FromVar(value)->GetValue();
+            JavascriptSIMDFloat32x4::ToStringBuffer(simdValue, stringBuffer, SIMD_STRING_BUFFER_MAX, scriptContext);
+            break;
+        default:
+            Assert(UNREACHED);
+        }
+        JavascriptString* string = JavascriptString::NewCopySzFromArena(stringBuffer, scriptContext, scriptContext->GeneralAllocator());
+        END_TEMP_ALLOCATOR(tempAllocator, scriptContext);
+        return string;
+    }
+
+    template <typename T, size_t N>
+    Var JavascriptSIMDObject::ToLocaleString(const Var* args, uint numArgs, const wchar_t *typeString, const T (&laneValues)[N], 
+        CallInfo* callInfo, ScriptContext* scriptContext) const
+    {
+        Assert(args);
+        Assert(N == 4 || N == 8 || N == 16);
+        if (typeDescriptor == TypeIds_SIMDBool8x16 ||
+            typeDescriptor == TypeIds_SIMDBool16x8 ||
+            typeDescriptor == TypeIds_SIMDBool32x4)
+        {
+            return ToString(scriptContext);   //Boolean types does not have toLocaleString.
+        }
+
+        // Creating a new arguments list for the JavascriptNumber generated from each lane.The optional SIMDToLocaleString Args are
+        //added to this argument list. 
+        Var* newArgs = HeapNewArray(Var, numArgs);
+        switch (numArgs)
+        {
+        case 1:
+            break;
+        case 2:
+            newArgs[1] = args[1];
+            break;
+        case 3:
+            newArgs[1] = args[1];
+            newArgs[2] = args[2];
+            break;
+        default:
+            Assert(UNREACHED);
+        }
+        //Locale specifc seperator?? 
+        JavascriptString *seperator = JavascriptString::NewWithSz(L", ", scriptContext);
+        uint idx = 0;
+        Var laneVar = nullptr;
+        BEGIN_TEMP_ALLOCATOR(tempAllocator, scriptContext, L"fromCodePoint");
+        wchar_t* stringBuffer = AnewArray(tempAllocator, wchar_t, SIMD_STRING_BUFFER_MAX);
+        JavascriptString *result = nullptr;
+
+        swprintf_s(stringBuffer, 1024, typeString);
+        result = JavascriptString::NewCopySzFromArena(stringBuffer, scriptContext, scriptContext->GeneralAllocator());
+
+        if (typeDescriptor == TypeIds_SIMDFloat32x4)
+        {
+            for (; idx < numLanes - 1; ++idx)
+            {
+                laneVar = JavascriptNumber::ToVarWithCheck(laneValues[idx], scriptContext);
+                newArgs[0] = laneVar;
+                JavascriptString *laneValue = JavascriptNumber::ToLocaleStringIntl(newArgs, *callInfo, scriptContext);
+                result = JavascriptString::Concat(result, laneValue);
+                result = JavascriptString::Concat(result, seperator);
+            }
+            laneVar = JavascriptNumber::ToVarWithCheck(laneValues[idx], scriptContext);
+            newArgs[0] = laneVar;
+            result = JavascriptString::Concat(result, JavascriptNumber::ToLocaleStringIntl(newArgs, *callInfo, scriptContext));
+        }
+        else if (typeDescriptor == TypeIds_SIMDInt8x16 || typeDescriptor == TypeIds_SIMDInt16x8 || typeDescriptor == TypeIds_SIMDInt32x4)
+        {
+            for (; idx < numLanes - 1; ++idx)
+            {
+                laneVar = JavascriptNumber::ToVar(static_cast<int>(laneValues[idx]), scriptContext); 
+                newArgs[0] = laneVar;
+                JavascriptString *laneValue = JavascriptNumber::ToLocaleStringIntl(newArgs, *callInfo, scriptContext);
+                result = JavascriptString::Concat(result, laneValue);
+                result = JavascriptString::Concat(result, seperator);
+            }
+            laneVar = JavascriptNumber::ToVar(static_cast<int>(laneValues[idx]), scriptContext);
+            newArgs[0] = laneVar;
+            result = JavascriptString::Concat(result, JavascriptNumber::ToLocaleStringIntl(newArgs, *callInfo, scriptContext));
+        }
+        else
+        {
+            Assert((typeDescriptor == TypeIds_SIMDUint8x16 || typeDescriptor == TypeIds_SIMDUint16x8 || typeDescriptor == TypeIds_SIMDUint32x4));
+            for (; idx < numLanes - 1; ++idx)
+            {
+                laneVar = JavascriptNumber::ToVar(static_cast<uint>(laneValues[idx]), scriptContext); 
+                newArgs[0] = laneVar;
+                JavascriptString *laneValue = JavascriptNumber::ToLocaleStringIntl(newArgs, *callInfo, scriptContext);
+                result = JavascriptString::Concat(result, laneValue);
+                result = JavascriptString::Concat(result, seperator);
+            }
+            laneVar = JavascriptNumber::ToVar(static_cast<uint>(laneValues[idx]), scriptContext);
+            newArgs[0] = laneVar;
+            result = JavascriptString::Concat(result, JavascriptNumber::ToLocaleStringIntl(newArgs, *callInfo, scriptContext));
+        }
+        HeapDeleteArray(numArgs, newArgs);
+        END_TEMP_ALLOCATOR(tempAllocator, scriptContext);
+        return JavascriptString::Concat(result, JavascriptString::NewWithSz(L")", scriptContext));
+    }
+    template Var JavascriptSIMDObject::ToLocaleString(const Var* args, uint numArgs, const wchar_t *typeString, 
+        const float (&laneValues)[4], CallInfo* callInfo, ScriptContext* scriptContext) const;
+    template Var JavascriptSIMDObject::ToLocaleString(const Var* args, uint numArgs, const wchar_t *typeString,
+        const int(&laneValues)[4], CallInfo* callInfo, ScriptContext* scriptContext) const;
+    template Var JavascriptSIMDObject::ToLocaleString(const Var* args, uint numArgs, const wchar_t *typeString,
+        const int16(&laneValues)[8], CallInfo* callInfo, ScriptContext* scriptContext) const;
+    template Var JavascriptSIMDObject::ToLocaleString(const Var* args, uint numArgs, const wchar_t *typeString,
+        const int8(&laneValues)[16], CallInfo* callInfo, ScriptContext* scriptContext) const;
+    template Var JavascriptSIMDObject::ToLocaleString(const Var* args, uint numArgs, const wchar_t *typeString,
+        const uint(&laneValues)[4], CallInfo* callInfo, ScriptContext* scriptContext) const;
+    template Var JavascriptSIMDObject::ToLocaleString(const Var* args, uint numArgs, const wchar_t *typeString,
+        const uint16(&laneValues)[8], CallInfo* callInfo, ScriptContext* scriptContext) const;
+    template Var JavascriptSIMDObject::ToLocaleString(const Var* args, uint numArgs, const wchar_t *typeString,
+        const uint8(&laneValues)[16], CallInfo* callInfo, ScriptContext* scriptContext) const;
+
+    Var JavascriptSIMDObject::GetValue() const
+    {
+        Assert(IsSimdType(value));
+        return value;
+    }
+}

+ 37 - 0
lib/Runtime/Library/JavascriptSimdObject.h

@@ -0,0 +1,37 @@
+//-------------------------------------------------------------------------------------------------------
+// Copyright (C) Microsoft. All rights reserved.
+// Licensed under the MIT license. See LICENSE.txt file in the project root for full license information.
+//-------------------------------------------------------------------------------------------------------
+#pragma once
+
+namespace Js
+{
+    class JavascriptSIMDObject : public DynamicObject
+    {
+    private:
+        Var value;            //The SIMDType var contained by the wrapper object
+        uint numLanes;        //Number of lanes
+        TypeId typeDescriptor;//The SIMDType contained by the wrapper object. 
+        DEFINE_VTABLE_CTOR(JavascriptSIMDObject, DynamicObject);
+        DEFINE_MARSHAL_OBJECT_TO_SCRIPT_CONTEXT(JavascriptSIMDObject);
+        void SetTypeDescriptor(TypeId tid);
+
+    protected:
+        JavascriptSIMDObject(DynamicType * type);
+
+    public:
+        JavascriptSIMDObject(Var value, DynamicType * type, TypeId typeDescriptor = TypeIds_SIMDObject);
+
+        static bool Is(Var aValue);
+        static JavascriptSIMDObject* FromVar(Var aValue);
+
+        Var ToString(ScriptContext* scriptContext) const;
+        template <typename T, size_t N>
+        Var ToLocaleString(const Var* args, uint numArgs, wchar_t const *typeString, const T (&laneValues)[N], CallInfo* callInfo, ScriptContext* scriptContext) const;
+
+        Var Unwrap() const;
+        Var GetValue() const;
+        TypeId GetTypeDescriptor() const { return typeDescriptor; }
+        uint GetLaneCount() const { Assert(typeDescriptor != TypeIds_SIMDObject); return numLanes; };
+     };
+} 

+ 213 - 0
lib/Runtime/Library/JavascriptSimdType.cpp

@@ -0,0 +1,213 @@
+//-------------------------------------------------------------------------------------------------------
+// Copyright (C) Microsoft. All rights reserved.
+// Licensed under the MIT license. See LICENSE.txt file in the project root for full license information.
+//-------------------------------------------------------------------------------------------------------
+#include "RuntimeLibraryPch.h"
+
+namespace Js
+{
+    // Constructors
+    JavascriptSIMDType::JavascriptSIMDType(StaticType *type) : RecyclableObject(type)
+    { }
+    JavascriptSIMDType::JavascriptSIMDType(SIMDValue *val, StaticType *type) : RecyclableObject(type), value(*val)
+    { }
+
+    // Entry Points
+    template <typename SIMDType>
+    Var JavascriptSIMDType::EntryToString(RecyclableObject* function, CallInfo callInfo, ...)
+    {
+        PROBE_STACK(function->GetScriptContext(), Js::Constants::MinStackDefault);
+
+        ARGUMENTS(args, callInfo);
+        ScriptContext* scriptContext = function->GetScriptContext();
+
+        AssertMsg(args.Info.Count > 0, "Should always have implicit 'this'");
+        Assert(!(callInfo.Flags & CallFlags_New));
+
+        if (args.Info.Count == 0 || !SIMDType::Is(args[0]))
+        {
+            wchar_t buffer[512] = L"";
+            wchar_t* bufferPtr = buffer;
+            JavascriptError::ThrowTypeError(scriptContext, JSERR_This_NeedSimd, SIMDType::GetFullBuiltinName(&bufferPtr, L"toString()"));
+        }
+
+        JavascriptSIMDType* instance = SIMDType::FromVar(args[0]);
+        return JavascriptConversion::ToString(instance, scriptContext);
+    }
+
+    template<typename SIMDType>
+    Var JavascriptSIMDType::EntryToLocaleString(RecyclableObject* function, CallInfo callInfo, ...)
+    {
+        PROBE_STACK(function->GetScriptContext(), Js::Constants::MinStackDefault);
+
+        ARGUMENTS(args, callInfo);
+        ScriptContext* scriptContext = function->GetScriptContext();
+
+        AssertMsg(args.Info.Count > 0, "Should always have implicit 'this'");
+        Assert(!(callInfo.Flags & CallFlags_New));
+
+        wchar_t buffer[512] = L"";
+        wchar_t* bufferPtr = buffer;
+
+        if (args.Info.Count == 0 || !SIMDType::Is(args[0]))
+        {
+            JavascriptError::ThrowTypeError(scriptContext, JSERR_This_NeedSimd, SIMDType::GetFullBuiltinName(&bufferPtr, L"toLocaleString")); //todo
+        }
+
+        //SPEC: The meanings of the optional parameters to this method are defined in the ECMA - 402 specification; 
+        //implementations that do not include ECMA - 402 support must not use those parameter positions for anything else.
+        //args[1] and args[2] are optional reserved parameters.
+        RecyclableObject *obj = nullptr;
+        if (!JavascriptConversion::ToObject(args[0], scriptContext, &obj))  //Is this needed?
+        {
+            JavascriptError::ThrowTypeError(scriptContext, JSERR_This_NeedSimd, SIMDType::GetFullBuiltinName(&bufferPtr, L"toLocaleString"));
+        }
+
+        if (JavascriptSIMDBool32x4::Is(args[0]) || JavascriptSIMDBool16x8::Is(args[0]) || JavascriptSIMDBool8x16::Is(args[0]))
+        {   //Boolean types  are independent of locale.
+            return JavascriptSIMDObject::FromVar(obj)->ToString(scriptContext);
+        }
+
+        //For all other SIMD types, call helper. 
+        SIMDValue simdValue = SIMDType::FromVar(args[0])->GetValue();
+        return SIMDType::CallToLocaleString(*obj, *scriptContext, simdValue, args.Values, args.Info.Count, callInfo);
+    }
+
+    // SIMDType.prototype[@@toPrimitive] as described in SIMD spec 
+    template<typename SIMDType>
+    Var JavascriptSIMDType::EntrySymbolToPrimitive(RecyclableObject* function, CallInfo callInfo, ...)
+    {
+        PROBE_STACK(function->GetScriptContext(), Js::Constants::MinStackDefault);
+
+        ARGUMENTS(args, callInfo);
+        ScriptContext* scriptContext = function->GetScriptContext();
+
+        Assert(!(callInfo.Flags & CallFlags_New));
+
+        // One argument given will be hint
+        //The allowed values for hint are "default", "number", and "string"
+        if (args.Info.Count == 2)
+        {
+            if (JavascriptString::Is(args[1]))
+            {
+                JavascriptString* StringObject = JavascriptString::FromVar(args[1]);
+
+                if (wcscmp(StringObject->UnsafeGetBuffer(), L"default") == 0 ||
+                    wcscmp(StringObject->UnsafeGetBuffer(), L"number") == 0 ||
+                    wcscmp(StringObject->UnsafeGetBuffer(), L"string") == 0)
+                {
+                    // The hint values are validated when provided but ignored for simd types.
+                    if (SIMDType::Is(args[0]))
+                    {
+                        return SIMDType::FromVar(args[0]);
+                    }
+                    else if (JavascriptSIMDObject::Is(args[0]))
+                    {
+                        return SIMDType::FromVar(JavascriptSIMDObject::FromVar(args[0])->GetValue());
+                    }
+                }
+            }
+        }
+        wchar_t buffer[512] = L"";
+        wchar_t* bufferPtr = buffer;
+        JavascriptError::ThrowTypeError(scriptContext, JSERR_FunctionArgument_Invalid, SIMDType::GetFullBuiltinName(&bufferPtr, L"[Symbol.toPrimitive]")); //todo
+    }
+
+    template<typename SIMDType>
+    Var JavascriptSIMDType::EntryValueOf(RecyclableObject* function, CallInfo callInfo, ...)
+    {
+        PROBE_STACK(function->GetScriptContext(), Js::Constants::MinStackDefault);
+
+        ARGUMENTS(args, callInfo);
+        ScriptContext* scriptContext = function->GetScriptContext();
+
+        AssertMsg(args.Info.Count > 0, "Should always have implicit 'this'");
+        Assert(!(callInfo.Flags & CallFlags_New));
+
+        if (args.Info.Count == 0 || SIMDType::Is(args[0]))
+        {
+            return SIMDType::FromVar(args[0]);
+        }
+        else if (JavascriptSIMDObject::Is(args[0]))
+        {
+            return SIMDType::FromVar((JavascriptSIMDObject::FromVar(args[0]))->GetValue());
+        }
+        wchar_t buffer[512] = L"";
+        wchar_t* bufferPtr = buffer;
+        JavascriptError::ThrowTypeError(scriptContext, JSERR_SIMDConversion, SIMDType::GetFullBuiltinName(&bufferPtr, L"valueOf"));
+    }
+    // End Entry Points
+
+    //Shared utility methods.
+    BOOL JavascriptSIMDType::GetProperty(Var originalInstance, PropertyId propertyId, Var* value, PropertyValueInfo* info, ScriptContext* requestContext)
+    {
+        return GetPropertyBuiltIns(propertyId, value, requestContext);
+    }
+
+    BOOL JavascriptSIMDType::GetProperty(Var originalInstance, JavascriptString* propertyNameString, Var* value, PropertyValueInfo* info, ScriptContext* requestContext)
+    {
+        PropertyRecord const* propertyRecord;
+        this->GetScriptContext()->FindPropertyRecord(propertyNameString, &propertyRecord);
+
+        if (propertyRecord != nullptr && GetPropertyBuiltIns(propertyRecord->GetPropertyId(), value, requestContext))
+        {
+            return true;
+        }
+        return false;
+    }
+
+    BOOL JavascriptSIMDType::GetPropertyReference(Var originalInstance, PropertyId propertyId, Var* value, PropertyValueInfo* info, ScriptContext* requestContext)
+    {
+        return GetProperty(originalInstance, propertyId, value, info, requestContext);
+    }
+
+    bool JavascriptSIMDType::GetPropertyBuiltIns(PropertyId propertyId, Var* value, ScriptContext* requestContext)
+    {
+        return false;
+    }
+
+    //For all inheriting simd types.
+    template Var JavascriptSIMDType::EntryToString<JavascriptSIMDBool32x4>(RecyclableObject* function, CallInfo callInfo, ...);
+    template Var JavascriptSIMDType::EntryToString<JavascriptSIMDBool16x8>(RecyclableObject* function, CallInfo callInfo, ...);
+    template Var JavascriptSIMDType::EntryToString<JavascriptSIMDBool8x16>(RecyclableObject* function, CallInfo callInfo, ...);
+    template Var JavascriptSIMDType::EntryToString<JavascriptSIMDInt32x4>(RecyclableObject* function, CallInfo callInfo, ...);
+    template Var JavascriptSIMDType::EntryToString<JavascriptSIMDInt16x8>(RecyclableObject* function, CallInfo callInfo, ...);
+    template Var JavascriptSIMDType::EntryToString<JavascriptSIMDInt8x16>(RecyclableObject* function, CallInfo callInfo, ...);
+    template Var JavascriptSIMDType::EntryToString<JavascriptSIMDUint32x4>(RecyclableObject* function, CallInfo callInfo, ...);
+    template Var JavascriptSIMDType::EntryToString<JavascriptSIMDUint16x8>(RecyclableObject* function, CallInfo callInfo, ...);
+    template Var JavascriptSIMDType::EntryToString<JavascriptSIMDUint8x16>(RecyclableObject* function, CallInfo callInfo, ...);
+    template Var JavascriptSIMDType::EntryToString<JavascriptSIMDFloat32x4>(RecyclableObject* function, CallInfo callInfo, ...);
+
+    template Var JavascriptSIMDType::EntryToLocaleString<JavascriptSIMDBool32x4>(RecyclableObject* function, CallInfo callInfo, ...);
+    template Var JavascriptSIMDType::EntryToLocaleString<JavascriptSIMDBool16x8>(RecyclableObject* function, CallInfo callInfo, ...);
+    template Var JavascriptSIMDType::EntryToLocaleString<JavascriptSIMDBool8x16>(RecyclableObject* function, CallInfo callInfo, ...);
+    template Var JavascriptSIMDType::EntryToLocaleString<JavascriptSIMDInt32x4>(RecyclableObject* function, CallInfo callInfo, ...);
+    template Var JavascriptSIMDType::EntryToLocaleString<JavascriptSIMDInt16x8>(RecyclableObject* function, CallInfo callInfo, ...);
+    template Var JavascriptSIMDType::EntryToLocaleString<JavascriptSIMDInt8x16>(RecyclableObject* function, CallInfo callInfo, ...);
+    template Var JavascriptSIMDType::EntryToLocaleString<JavascriptSIMDUint32x4>(RecyclableObject* function, CallInfo callInfo, ...);
+    template Var JavascriptSIMDType::EntryToLocaleString<JavascriptSIMDUint16x8>(RecyclableObject* function, CallInfo callInfo, ...);
+    template Var JavascriptSIMDType::EntryToLocaleString<JavascriptSIMDUint8x16>(RecyclableObject* function, CallInfo callInfo, ...);
+    template Var JavascriptSIMDType::EntryToLocaleString<JavascriptSIMDFloat32x4>(RecyclableObject* function, CallInfo callInfo, ...);
+
+    template Var JavascriptSIMDType::EntrySymbolToPrimitive<JavascriptSIMDBool32x4>(RecyclableObject* function, CallInfo callInfo, ...);
+    template Var JavascriptSIMDType::EntrySymbolToPrimitive<JavascriptSIMDBool16x8>(RecyclableObject* function, CallInfo callInfo, ...);
+    template Var JavascriptSIMDType::EntrySymbolToPrimitive<JavascriptSIMDBool8x16>(RecyclableObject* function, CallInfo callInfo, ...);
+    template Var JavascriptSIMDType::EntrySymbolToPrimitive<JavascriptSIMDInt32x4>(RecyclableObject* function, CallInfo callInfo, ...);
+    template Var JavascriptSIMDType::EntrySymbolToPrimitive<JavascriptSIMDInt16x8>(RecyclableObject* function, CallInfo callInfo, ...);
+    template Var JavascriptSIMDType::EntrySymbolToPrimitive<JavascriptSIMDInt8x16>(RecyclableObject* function, CallInfo callInfo, ...);
+    template Var JavascriptSIMDType::EntrySymbolToPrimitive<JavascriptSIMDUint32x4>(RecyclableObject* function, CallInfo callInfo, ...);
+    template Var JavascriptSIMDType::EntrySymbolToPrimitive<JavascriptSIMDUint16x8>(RecyclableObject* function, CallInfo callInfo, ...);
+    template Var JavascriptSIMDType::EntrySymbolToPrimitive<JavascriptSIMDUint8x16>(RecyclableObject* function, CallInfo callInfo, ...);
+    template Var JavascriptSIMDType::EntrySymbolToPrimitive<JavascriptSIMDFloat32x4>(RecyclableObject* function, CallInfo callInfo, ...);
+
+    template Var JavascriptSIMDType::EntryValueOf<JavascriptSIMDBool32x4>(RecyclableObject* function, CallInfo callInfo, ...);
+    template Var JavascriptSIMDType::EntryValueOf<JavascriptSIMDBool16x8>(RecyclableObject* function, CallInfo callInfo, ...);
+    template Var JavascriptSIMDType::EntryValueOf<JavascriptSIMDBool8x16>(RecyclableObject* function, CallInfo callInfo, ...);
+    template Var JavascriptSIMDType::EntryValueOf<JavascriptSIMDInt32x4>(RecyclableObject* function, CallInfo callInfo, ...);
+    template Var JavascriptSIMDType::EntryValueOf<JavascriptSIMDInt16x8>(RecyclableObject* function, CallInfo callInfo, ...);
+    template Var JavascriptSIMDType::EntryValueOf<JavascriptSIMDInt8x16>(RecyclableObject* function, CallInfo callInfo, ...);
+    template Var JavascriptSIMDType::EntryValueOf<JavascriptSIMDUint32x4>(RecyclableObject* function, CallInfo callInfo, ...);
+    template Var JavascriptSIMDType::EntryValueOf<JavascriptSIMDUint16x8>(RecyclableObject* function, CallInfo callInfo, ...);
+    template Var JavascriptSIMDType::EntryValueOf<JavascriptSIMDUint8x16>(RecyclableObject* function, CallInfo callInfo, ...);
+    template Var JavascriptSIMDType::EntryValueOf<JavascriptSIMDFloat32x4>(RecyclableObject* function, CallInfo callInfo, ...);
+}

+ 42 - 0
lib/Runtime/Library/JavascriptSimdType.h

@@ -0,0 +1,42 @@
+//-------------------------------------------------------------------------------------------------------
+// Copyright (C) Microsoft. All rights reserved.
+// Licensed under the MIT license. See LICENSE.txt file in the project root for full license information.
+//-------------------------------------------------------------------------------------------------------
+#pragma once
+
+namespace Js
+{
+    class JavascriptSIMDType : public RecyclableObject
+    {
+    protected:
+        SIMDValue value;
+    public:
+        DEFINE_VTABLE_CTOR(JavascriptSIMDType, RecyclableObject);
+        JavascriptSIMDType(StaticType *type);
+        JavascriptSIMDType(SIMDValue *val, StaticType *type);
+
+        template<typename SIMDType>
+        Var Copy(ScriptContext* requestContext);
+
+        // Entry Points
+        //The code is entrant from value objects (e.g. a.toString())or on arithmetic operations.
+        //It will also be a property of SIMD.*.prototype for SIMD dynamic objects.
+        template<typename SIMDType>
+        static Var EntryToString(RecyclableObject* function, CallInfo callInfo, ...);
+        template<typename SIMDType>
+        static Var EntryToLocaleString(RecyclableObject* function, CallInfo callInfo, ...);
+        template<typename SIMDType>
+        static Var EntryValueOf(RecyclableObject* function, CallInfo callInfo, ...);
+        template<typename SIMDType>
+        static Var EntrySymbolToPrimitive(RecyclableObject* function, CallInfo callInfo, ...);
+        // End Entry Points
+
+        virtual BOOL GetPropertyReference(Var originalInstance, PropertyId propertyId, Var* value, PropertyValueInfo* info, ScriptContext* requestContext) override;
+        virtual BOOL GetProperty(Var originalInstance, PropertyId propertyId, Var* value, PropertyValueInfo* info, ScriptContext* requestContext) override;
+        virtual BOOL GetProperty(Var originalInstance, JavascriptString* propertyNameString, Var* value, PropertyValueInfo* info, ScriptContext* requestContext) override;
+
+    private:
+        virtual bool GetPropertyBuiltIns(PropertyId propertyId, Var* value, ScriptContext* requestContext);
+    };
+}
+

+ 12 - 56
lib/Runtime/Library/JavascriptSimdUint16x8.cpp

@@ -7,7 +7,7 @@
 
 namespace Js
 {
-    JavascriptSIMDUint16x8::JavascriptSIMDUint16x8(SIMDValue *val, StaticType *type) : RecyclableObject(type), value(*val)
+    JavascriptSIMDUint16x8::JavascriptSIMDUint16x8(SIMDValue *val, StaticType *type) : JavascriptSIMDType(val, type)
     {
         Assert(type->GetTypeId() == TypeIds_SIMDUint16x8);
     }
@@ -30,68 +30,24 @@ namespace Js
         return reinterpret_cast<JavascriptSIMDUint16x8 *>(aValue);
     }
 
-    RecyclableObject * JavascriptSIMDUint16x8::CloneToScriptContext(ScriptContext* requestContext)
-    {
-        return JavascriptSIMDUint16x8::New(&value, requestContext);
-    }
-
-    BOOL JavascriptSIMDUint16x8::GetProperty(Var originalInstance, PropertyId propertyId, Var* value, PropertyValueInfo* info, ScriptContext* requestContext)
+    Var JavascriptSIMDUint16x8::CallToLocaleString(RecyclableObject& obj, ScriptContext& requestContext, SIMDValue simdValue,
+        const Var* args, uint numArgs, CallInfo callInfo)
     {
-        return GetPropertyBuiltIns(propertyId, value, requestContext);
+        wchar_t *typeString = L"SIMD.Uint16x8(";
+        return JavascriptSIMDObject::FromVar(&obj)->ToLocaleString<uint16, 8>(args, numArgs, typeString,
+            simdValue.u16, &callInfo, &requestContext);
     }
 
-    BOOL JavascriptSIMDUint16x8::GetProperty(Var originalInstance, JavascriptString* propertyNameString, Var* value, PropertyValueInfo* info, ScriptContext* requestContext)
-    {
-        PropertyRecord const* propertyRecord;
-        this->GetScriptContext()->FindPropertyRecord(propertyNameString, &propertyRecord);
-
-        if (propertyRecord != nullptr && GetPropertyBuiltIns(propertyRecord->GetPropertyId(), value, requestContext))
-        {
-            return true;
-        }
-        return false;
-    }
-
-    BOOL JavascriptSIMDUint16x8::GetPropertyReference(Var originalInstance, PropertyId propertyId, Var* value, PropertyValueInfo* info, ScriptContext* requestContext)
-    {
-        return JavascriptSIMDUint16x8::GetProperty(originalInstance, propertyId, value, info, requestContext);
-    }
-
-    bool JavascriptSIMDUint16x8::GetPropertyBuiltIns(PropertyId propertyId, Var* value, ScriptContext* requestContext)
+    RecyclableObject * JavascriptSIMDUint16x8::CloneToScriptContext(ScriptContext* requestContext)
     {
-        if (propertyId == PropertyIds::toString)
-        {
-            *value = requestContext->GetLibrary()->GetSIMDUint16x8ToStringFunction();
-            return true;
-        }
-        return false;
+        return JavascriptSIMDUint16x8::New(&value, requestContext);
     }
 
-    Var JavascriptSIMDUint16x8::EntryToString(RecyclableObject* function, CallInfo callInfo, ...)
+    const wchar_t* JavascriptSIMDUint16x8::GetFullBuiltinName(wchar_t** aBuffer, const wchar_t* name)
     {
-        PROBE_STACK(function->GetScriptContext(), Js::Constants::MinStackDefault);
-
-        ARGUMENTS(args, callInfo);
-        ScriptContext* scriptContext = function->GetScriptContext();
-
-        AssertMsg(args.Info.Count > 0, "Should always have implicit 'this'");
-        Assert(!(callInfo.Flags & CallFlags_New));
-        if (args.Info.Count == 0 || JavascriptOperators::GetTypeId(args[0]) != TypeIds_SIMDUint16x8)
-        {
-            JavascriptError::ThrowTypeError(scriptContext, JSERR_This_NeedSimd, L"SIMDUint16x8.toString");
-        }
-
-        JavascriptSIMDUint16x8* instance = JavascriptSIMDUint16x8::FromVar(args[0]);
-        Assert(instance);
-
-        wchar_t stringBuffer[SIMD_STRING_BUFFER_MAX];
-        SIMDValue value = instance->GetValue();
-
-        JavascriptSIMDUint16x8::ToStringBuffer(value, stringBuffer, SIMD_STRING_BUFFER_MAX);
-
-        JavascriptString* string = JavascriptString::NewCopySzFromArena(stringBuffer, scriptContext, scriptContext->GeneralAllocator());
-
-        return string;
+        Assert(aBuffer && *aBuffer);
+        swprintf_s(*aBuffer, SIMD_STRING_BUFFER_MAX, L"SIMD.Uint16x8.%s", name);
+        return *aBuffer;
     }
 
     Var JavascriptSIMDUint16x8::Copy(ScriptContext* requestContext)

+ 10 - 21
lib/Runtime/Library/JavascriptSimdUint16x8.h

@@ -7,37 +7,26 @@
 
 namespace Js
 {
-    class JavascriptSIMDUint16x8 sealed : public RecyclableObject
+    class JavascriptSIMDUint16x8 sealed : public JavascriptSIMDType
     {
     private:
-        SIMDValue value;
-        DEFINE_VTABLE_CTOR(JavascriptSIMDUint16x8, RecyclableObject);
+        DEFINE_VTABLE_CTOR(JavascriptSIMDUint16x8, JavascriptSIMDType);
     public:
         class EntryInfo
         {
         public:
             static FunctionInfo ToString;
+            static FunctionInfo ToLocaleString;
+            static FunctionInfo ValueOf;
+            static FunctionInfo SymbolToPrimitive;
         };
 
         JavascriptSIMDUint16x8(SIMDValue *val, StaticType *type);
         static JavascriptSIMDUint16x8* New(SIMDValue *val, ScriptContext* requestContext);
         static bool Is(Var instance);
         static JavascriptSIMDUint16x8* FromVar(Var aValue);
-
-        __inline SIMDValue GetValue() { return value; }
-
-        virtual BOOL GetPropertyReference(Var originalInstance, PropertyId propertyId, Var* value, PropertyValueInfo* info, ScriptContext* requestContext) override;
-        virtual BOOL GetProperty(Var originalInstance, PropertyId propertyId, Var* value, PropertyValueInfo* info, ScriptContext* requestContext) override;
-        virtual BOOL GetProperty(Var originalInstance, JavascriptString* propertyNameString, Var* value, PropertyValueInfo* info, ScriptContext* requestContext) override;
-        virtual RecyclableObject * CloneToScriptContext(ScriptContext* requestContext) override;
-
-        // Entry Points
-        /*
-        There is one toString per SIMD type. The code is entrant from value objects explicitly (e.g. a.toString()) or on overloaded operations.
-        It will also be a property of SIMD.int32x4.prototype for SIMD dynamic objects.
-        */
-        static Var EntryToString(RecyclableObject* function, CallInfo callInfo, ...);
-        // End Entry Points
+        static const wchar_t* GetFullBuiltinName(wchar_t** aBuffer, const wchar_t* name);
+        static Var CallToLocaleString(RecyclableObject& obj, ScriptContext& requestContext, SIMDValue simdValue, const Var* args, uint numArgs, CallInfo callInfo);
 
         static void ToStringBuffer(SIMDValue& value, __out_ecount(countBuffer) wchar_t* stringBuffer, size_t countBuffer, ScriptContext* scriptContext = nullptr)
         {
@@ -45,9 +34,9 @@ namespace Js
                 value.u16[0], value.u16[1], value.u16[2], value.u16[3], value.u16[4], value.u16[5], value.u16[6], value.u16[7]);
         }
 
-        Var  Copy(ScriptContext* requestContext);
+        __inline SIMDValue GetValue() { return value; }
+        virtual RecyclableObject * CloneToScriptContext(ScriptContext* requestContext) override;
 
-    private:
-        bool GetPropertyBuiltIns(PropertyId propertyId, Var* value, ScriptContext* requestContext);
+        Var  Copy(ScriptContext* requestContext);
     };
 }

+ 13 - 60
lib/Runtime/Library/JavascriptSimdUint32x4.cpp

@@ -6,12 +6,12 @@
 
 namespace Js
 {
-    JavascriptSIMDUint32x4::JavascriptSIMDUint32x4(StaticType *type) : RecyclableObject(type)
+    JavascriptSIMDUint32x4::JavascriptSIMDUint32x4(StaticType *type) : JavascriptSIMDType(type)
     {
         Assert(type->GetTypeId() == TypeIds_SIMDUint32x4);
     }
 
-    JavascriptSIMDUint32x4::JavascriptSIMDUint32x4(SIMDValue *val, StaticType *type) : RecyclableObject(type), value(*val)
+    JavascriptSIMDUint32x4::JavascriptSIMDUint32x4(SIMDValue *val, StaticType *type) : JavascriptSIMDType(val, type)
     {
         Assert(type->GetTypeId() == TypeIds_SIMDUint32x4);
     }
@@ -39,71 +39,24 @@ namespace Js
         return reinterpret_cast<JavascriptSIMDUint32x4 *>(aValue);
     }
 
-    RecyclableObject * JavascriptSIMDUint32x4::CloneToScriptContext(ScriptContext* requestContext)
-    {
-        return JavascriptSIMDUint32x4::New(&value, requestContext);
-    }
-
-    BOOL JavascriptSIMDUint32x4::GetProperty(Var originalInstance, PropertyId propertyId, Var* value, PropertyValueInfo* info, ScriptContext* requestContext)
-    {
-        return GetPropertyBuiltIns(propertyId, value, requestContext);
-
-    }
-
-    BOOL JavascriptSIMDUint32x4::GetProperty(Var originalInstance, JavascriptString* propertyNameString, Var* value, PropertyValueInfo* info, ScriptContext* requestContext)
-    {
-        PropertyRecord const* propertyRecord;
-        this->GetScriptContext()->FindPropertyRecord(propertyNameString, &propertyRecord);
-
-        if (propertyRecord != nullptr && GetPropertyBuiltIns(propertyRecord->GetPropertyId(), value, requestContext))
-        {
-            return true;
-        }
-        return false;
-    }
-
-    BOOL JavascriptSIMDUint32x4::GetPropertyReference(Var originalInstance, PropertyId propertyId, Var* value, PropertyValueInfo* info, ScriptContext* requestContext)
+    Var JavascriptSIMDUint32x4::CallToLocaleString(RecyclableObject& obj, ScriptContext& requestContext, SIMDValue simdValue,
+        const Var* args, uint numArgs, CallInfo callInfo)
     {
-        return JavascriptSIMDUint32x4::GetProperty(originalInstance, propertyId, value, info, requestContext);
+        wchar_t *typeString = L"SIMD.Uint32x4(";
+        return JavascriptSIMDObject::FromVar(&obj)->ToLocaleString<int32, 4>(args, numArgs, typeString,
+            simdValue.i32, &callInfo, &requestContext);
     }
 
-    bool JavascriptSIMDUint32x4::GetPropertyBuiltIns(PropertyId propertyId, Var* value, ScriptContext* requestContext)
+    RecyclableObject * JavascriptSIMDUint32x4::CloneToScriptContext(ScriptContext* requestContext)
     {
-        if (propertyId == PropertyIds::toString)
-        {
-            *value = requestContext->GetLibrary()->GetSIMDUint32x4ToStringFunction();
-            return true;
-        }
-
-        return false;
+        return JavascriptSIMDUint32x4::New(&value, requestContext);
     }
 
-    Var JavascriptSIMDUint32x4::EntryToString(RecyclableObject* function, CallInfo callInfo, ...)
+    const wchar_t* JavascriptSIMDUint32x4::GetFullBuiltinName(wchar_t** aBuffer, const wchar_t* name)
     {
-        PROBE_STACK(function->GetScriptContext(), Js::Constants::MinStackDefault);
-
-        ARGUMENTS(args, callInfo);
-        ScriptContext* scriptContext = function->GetScriptContext();
-
-        AssertMsg(args.Info.Count > 0, "Should always have implicit 'this'");
-        Assert(!(callInfo.Flags & CallFlags_New));
-
-        if (args.Info.Count == 0 || JavascriptOperators::GetTypeId(args[0]) != TypeIds_SIMDUint32x4)
-        {
-            JavascriptError::ThrowTypeError(scriptContext, JSERR_This_NeedSimd, L"SIMDUInt32x4.toString");
-        }
-
-        JavascriptSIMDUint32x4* instance = JavascriptSIMDUint32x4::FromVar(args[0]);
-        Assert(instance);
-
-        wchar_t stringBuffer[SIMD_STRING_BUFFER_MAX];
-        SIMDValue value = instance->GetValue();
-
-        JavascriptSIMDUint32x4::ToStringBuffer(value, stringBuffer, SIMD_STRING_BUFFER_MAX);
-
-        JavascriptString* string = JavascriptString::NewCopySzFromArena(stringBuffer, scriptContext, scriptContext->GeneralAllocator());
-
-        return string;
+        Assert(aBuffer && *aBuffer);
+        swprintf_s(*aBuffer, SIMD_STRING_BUFFER_MAX, L"SIMD.Uint32x4.%s", name);
+        return *aBuffer;
     }
 
     Var JavascriptSIMDUint32x4::Copy(ScriptContext* requestContext)

+ 10 - 26
lib/Runtime/Library/JavascriptSimdUint32x4.h

@@ -8,19 +8,19 @@ class JavascriptSIMDFloat32x4;
 
 namespace Js
 {
-    class JavascriptSIMDUint32x4 sealed : public RecyclableObject
+    class JavascriptSIMDUint32x4 sealed : public JavascriptSIMDType
     {
     private:
-        SIMDValue value;
-
-        DEFINE_VTABLE_CTOR(JavascriptSIMDUint32x4, RecyclableObject);
-
+        DEFINE_VTABLE_CTOR(JavascriptSIMDUint32x4, JavascriptSIMDType);
 
     public:
         class EntryInfo
         {
         public:
             static FunctionInfo ToString;
+            static FunctionInfo ToLocaleString;
+            static FunctionInfo ValueOf;
+            static FunctionInfo SymbolToPrimitive;
             static FunctionInfo Bool;
         };
 
@@ -29,38 +29,22 @@ namespace Js
 
         static JavascriptSIMDUint32x4* AllocUninitialized(ScriptContext* requestContext);
         static JavascriptSIMDUint32x4* New(SIMDValue *val, ScriptContext* requestContext);
+        static const wchar_t* GetFullBuiltinName(wchar_t** aBuffer, const wchar_t* name);
         static bool Is(Var instance);
         static JavascriptSIMDUint32x4* FromVar(Var aValue);
-
         static JavascriptSIMDUint32x4* FromFloat32x4(JavascriptSIMDFloat32x4   *instance, ScriptContext* requestContext);
-
-
-        __inline SIMDValue GetValue() { return value; }
-
-        virtual BOOL GetPropertyReference(Var originalInstance, PropertyId propertyId, Var* value, PropertyValueInfo* info, ScriptContext* requestContext) override;
-        virtual BOOL GetProperty(Var originalInstance, PropertyId propertyId, Var* value, PropertyValueInfo* info, ScriptContext* requestContext) override;
-        virtual BOOL GetProperty(Var originalInstance, JavascriptString* propertyNameString, Var* value, PropertyValueInfo* info, ScriptContext* requestContext) override;
-        virtual RecyclableObject * CloneToScriptContext(ScriptContext* requestContext) override;
-
         static size_t GetOffsetOfValue() { return offsetof(JavascriptSIMDUint32x4, value); }
-
-        // Entry Points
-        /*
-        There is one toString per SIMD type. The code is entrant from value objects explicitly (e.g. a.toString()) or on overloaded operations.
-        It will also be a property of SIMD.UInt32x4.prototype for SIMD dynamic objects.
-        */
-        static Var EntryToString(RecyclableObject* function, CallInfo callInfo, ...);
-        // End Entry Points
+        static Var CallToLocaleString(RecyclableObject& obj, ScriptContext& requestContext, SIMDValue simdValue, const Var* args, uint numArgs, CallInfo callInfo);
 
         static void ToStringBuffer(SIMDValue& value, __out_ecount(countBuffer) wchar_t* stringBuffer, size_t countBuffer, ScriptContext* scriptContext = nullptr)
         {
             swprintf_s(stringBuffer, countBuffer, L"SIMD.Uint32x4(%u, %u, %u, %u)", value.u32[SIMD_X], value.u32[SIMD_Y], value.u32[SIMD_Z], value.u32[SIMD_W]);
         }
 
-        Var  Copy(ScriptContext* requestContext);
+        __inline SIMDValue GetValue() { return value; }
 
-    private:
-        bool GetPropertyBuiltIns(PropertyId propertyId, Var* value, ScriptContext* requestContext);
+        virtual RecyclableObject * CloneToScriptContext(ScriptContext* requestContext) override;
 
+        Var  Copy(ScriptContext* requestContext);
     };
 }

+ 12 - 56
lib/Runtime/Library/JavascriptSimdUint8x16.cpp

@@ -7,7 +7,7 @@
 
 namespace Js
 {
-    JavascriptSIMDUint8x16::JavascriptSIMDUint8x16(SIMDValue *val, StaticType *type) : RecyclableObject(type), value(*val)
+    JavascriptSIMDUint8x16::JavascriptSIMDUint8x16(SIMDValue *val, StaticType *type) : JavascriptSIMDType(val, type)
     {
         Assert(type->GetTypeId() == TypeIds_SIMDUint8x16);
     }
@@ -30,68 +30,24 @@ namespace Js
         return reinterpret_cast<JavascriptSIMDUint8x16 *>(aValue);
     }
 
-    RecyclableObject * JavascriptSIMDUint8x16::CloneToScriptContext(ScriptContext* requestContext)
-    {
-        return JavascriptSIMDUint8x16::New(&value, requestContext);
-    }
-
-    BOOL JavascriptSIMDUint8x16::GetProperty(Var originalInstance, PropertyId propertyId, Var* value, PropertyValueInfo* info, ScriptContext* requestContext)
+    Var JavascriptSIMDUint8x16::CallToLocaleString(RecyclableObject& obj, ScriptContext& requestContext, SIMDValue simdValue,
+        const Var* args, uint numArgs, CallInfo callInfo)
     {
-        return GetPropertyBuiltIns(propertyId, value, requestContext);
+        wchar_t *typeString = L"SIMD.Uint8x16(";
+        return JavascriptSIMDObject::FromVar(&obj)->ToLocaleString<uint8, 16>(args, numArgs, typeString,
+            simdValue.u8, &callInfo, &requestContext);
     }
 
-    BOOL JavascriptSIMDUint8x16::GetProperty(Var originalInstance, JavascriptString* propertyNameString, Var* value, PropertyValueInfo* info, ScriptContext* requestContext)
-    {
-        PropertyRecord const* propertyRecord;
-        this->GetScriptContext()->FindPropertyRecord(propertyNameString, &propertyRecord);
-
-        if (propertyRecord != nullptr && GetPropertyBuiltIns(propertyRecord->GetPropertyId(), value, requestContext))
-        {
-            return true;
-        }
-        return false;
-    }
-
-    BOOL JavascriptSIMDUint8x16::GetPropertyReference(Var originalInstance, PropertyId propertyId, Var* value, PropertyValueInfo* info, ScriptContext* requestContext)
-    {
-        return JavascriptSIMDUint8x16::GetProperty(originalInstance, propertyId, value, info, requestContext);
-    }
-
-    bool JavascriptSIMDUint8x16::GetPropertyBuiltIns(PropertyId propertyId, Var* value, ScriptContext* requestContext)
+    RecyclableObject * JavascriptSIMDUint8x16::CloneToScriptContext(ScriptContext* requestContext)
     {
-        if (propertyId == PropertyIds::toString)
-        {
-            *value = requestContext->GetLibrary()->GetSIMDUint8x16ToStringFunction();
-            return true;
-        }
-        return false;
+        return JavascriptSIMDUint8x16::New(&value, requestContext);
     }
 
-    Var JavascriptSIMDUint8x16::EntryToString(RecyclableObject* function, CallInfo callInfo, ...)
+    const wchar_t* JavascriptSIMDUint8x16::GetFullBuiltinName(wchar_t** aBuffer, const wchar_t* name)
     {
-        PROBE_STACK(function->GetScriptContext(), Js::Constants::MinStackDefault);
-
-        ARGUMENTS(args, callInfo);
-        ScriptContext* scriptContext = function->GetScriptContext();
-
-        AssertMsg(args.Info.Count > 0, "Should always have implicit 'this'");
-        Assert(!(callInfo.Flags & CallFlags_New));
-        if (args.Info.Count == 0 || JavascriptOperators::GetTypeId(args[0]) != TypeIds_SIMDUint8x16)
-        {
-            JavascriptError::ThrowTypeError(scriptContext, JSERR_This_NeedSimd, L"SIMDUint8x16.toString");
-        }
-
-        JavascriptSIMDUint8x16* instance = JavascriptSIMDUint8x16::FromVar(args[0]);
-        Assert(instance);
-
-        wchar_t stringBuffer[SIMD_STRING_BUFFER_MAX];
-        SIMDValue value = instance->GetValue();
-
-        JavascriptSIMDUint8x16::ToStringBuffer(value, stringBuffer, SIMD_STRING_BUFFER_MAX);
-
-        JavascriptString* string = JavascriptString::NewCopySzFromArena(stringBuffer, scriptContext, scriptContext->GeneralAllocator());
-
-        return string;
+        Assert(aBuffer && *aBuffer);
+        swprintf_s(*aBuffer, SIMD_STRING_BUFFER_MAX, L"SIMD.Uint8x16.%s", name);
+        return *aBuffer;
     }
 
     Var JavascriptSIMDUint8x16::Copy(ScriptContext* requestContext)

+ 10 - 21
lib/Runtime/Library/JavascriptSimdUint8x16.h

@@ -7,37 +7,26 @@
 
 namespace Js
 {
-    class JavascriptSIMDUint8x16 sealed : public RecyclableObject
+    class JavascriptSIMDUint8x16 sealed : public JavascriptSIMDType
     {
     private:
-        SIMDValue value;
-        DEFINE_VTABLE_CTOR(JavascriptSIMDUint8x16, RecyclableObject);
+        DEFINE_VTABLE_CTOR(JavascriptSIMDUint8x16, JavascriptSIMDType);
     public:
         class EntryInfo
         {
         public:
             static FunctionInfo ToString;
+            static FunctionInfo ToLocaleString;
+            static FunctionInfo ValueOf;
+            static FunctionInfo SymbolToPrimitive;
         };
 
         JavascriptSIMDUint8x16(SIMDValue *val, StaticType *type);
         static JavascriptSIMDUint8x16* New(SIMDValue *val, ScriptContext* requestContext);
         static bool Is(Var instance);
         static JavascriptSIMDUint8x16* FromVar(Var aValue);
-
-        __inline SIMDValue GetValue() { return value; }
-
-        virtual BOOL GetPropertyReference(Var originalInstance, PropertyId propertyId, Var* value, PropertyValueInfo* info, ScriptContext* requestContext) override;
-        virtual BOOL GetProperty(Var originalInstance, PropertyId propertyId, Var* value, PropertyValueInfo* info, ScriptContext* requestContext) override;
-        virtual BOOL GetProperty(Var originalInstance, JavascriptString* propertyNameString, Var* value, PropertyValueInfo* info, ScriptContext* requestContext) override;
-        virtual RecyclableObject * CloneToScriptContext(ScriptContext* requestContext) override;
-
-        // Entry Points
-        /*
-        There is one toString per SIMD type. The code is entrant from value objects explicitly (e.g. a.toString()) or on overloaded operations.
-        It will also be a property of SIMD.int32x4.prototype for SIMD dynamic objects.
-        */
-        static Var EntryToString(RecyclableObject* function, CallInfo callInfo, ...);
-        // End Entry Points
+        static const wchar_t* GetFullBuiltinName(wchar_t** aBuffer, const wchar_t* name);
+        static Var CallToLocaleString(RecyclableObject& obj, ScriptContext& requestContext, SIMDValue simdValue, const Var* args, uint numArgs, CallInfo callInfo);
 
         static void ToStringBuffer(SIMDValue& value, __out_ecount(countBuffer) wchar_t* stringBuffer, size_t countBuffer, ScriptContext* scriptContext = nullptr)
         {
@@ -46,9 +35,9 @@ namespace Js
                 value.u8[8], value.u8[9], value.u8[10], value.u8[11], value.u8[12], value.u8[13], value.u8[14], value.u8[15]);
         }
 
-        Var  Copy(ScriptContext* requestContext);
+        virtual RecyclableObject * CloneToScriptContext(ScriptContext* requestContext) override;
 
-    private:
-        bool GetPropertyBuiltIns(PropertyId propertyId, Var* value, ScriptContext* requestContext);
+        __inline SIMDValue GetValue() { return value; }
+        Var  Copy(ScriptContext* requestContext);
     };
 }

+ 1 - 11
lib/Runtime/Library/SimdInt16x8Lib.cpp

@@ -7,8 +7,6 @@
 
 namespace Js
 {
-
-    // Q: Are we allowed to call this as a constructor ?
     Var SIMDInt16x8Lib::EntryInt16x8(RecyclableObject* function, CallInfo callInfo, ...)
     {
         PROBE_STACK(function->GetScriptContext(), Js::Constants::MinStackDefault);
@@ -16,15 +14,7 @@ namespace Js
         ARGUMENTS(args, callInfo);
         ScriptContext* scriptContext = function->GetScriptContext();
         AssertMsg(args.Info.Count > 0, "Should always have implicit 'this'");
-        //Assert(!(callInfo.Flags & CallFlags_New));    //comment out due to -ls -stress run
-        if (args.Info.Count == 2)
-        {
-            if (JavascriptSIMDInt16x8::Is(args[1]))
-            {
-                return args[1];
-            }
-            JavascriptError::ThrowTypeError(scriptContext, JSERR_SimdInt16x8TypeMismatch, L"int16x8");
-        }
+        Assert(!(callInfo.Flags & CallFlags_New));
 
         Var undefinedVar = scriptContext->GetLibrary()->GetUndefined();
 

+ 2 - 0
lib/Runtime/Library/SimdLib.h

@@ -5,6 +5,8 @@
 
 #pragma once
 // SIMD types
+#include "Library/JavascriptSimdObject.h"
+#include "Library/JavascriptSimdType.h"
 #include "Library/JavascriptSimdFloat32x4.h"
 #include "Library/JavascriptSimdFloat64x2.h"
 #include "Library/JavascriptSimdInt32x4.h"

+ 6 - 12
lib/Runtime/Library/SimdUint32x4Lib.cpp

@@ -170,7 +170,6 @@ namespace Js
 
     Var SIMDUint32x4Lib::EntryFromUint16x8Bits(RecyclableObject* function, CallInfo callInfo, ...)
     {
-#if 0
         PROBE_STACK(function->GetScriptContext(), Js::Constants::MinStackDefault);
         ARGUMENTS(args, callInfo);
         ScriptContext* scriptContext = function->GetScriptContext();
@@ -178,21 +177,18 @@ namespace Js
         AssertMsg(args.Info.Count > 0, "Should always have implicit 'this'");
         Assert(!(callInfo.Flags & CallFlags_New));
 
-        if (args.Info.Count >= 2 && JavascriptSIMDUInt16x8::Is(args[1]))
+        if (args.Info.Count >= 2 && JavascriptSIMDUint16x8::Is(args[1]))
         {
-            JavascriptSIMDUInt16x8 *instance = JavascriptSIMDUInt16x8::FromVar(args[1]);
+            JavascriptSIMDUint16x8 *instance = JavascriptSIMDUint16x8::FromVar(args[1]);
             Assert(instance);
 
-            return SIMDConvertTypeFromBits<JavascriptSIMDInt16x8, JavascriptSIMDUint32x4>(instance, scriptContext);
+            return SIMDConvertTypeFromBits<JavascriptSIMDUint16x8, JavascriptSIMDUint32x4>(instance, scriptContext);
         }
         JavascriptError::ThrowTypeError(scriptContext, JSERR_SimdInt32x4TypeMismatch, L"fromUInt16x8Bits");
-#endif
-        return NULL;
     }
 
     Var SIMDUint32x4Lib::EntryFromUint8x16Bits(RecyclableObject* function, CallInfo callInfo, ...)
     {
-#if 0
         PROBE_STACK(function->GetScriptContext(), Js::Constants::MinStackDefault);
         ARGUMENTS(args, callInfo);
         ScriptContext* scriptContext = function->GetScriptContext();
@@ -200,16 +196,14 @@ namespace Js
         AssertMsg(args.Info.Count > 0, "Should always have implicit 'this'");
         Assert(!(callInfo.Flags & CallFlags_New));
 
-        if (args.Info.Count >= 2 && JavascriptSIMDUInt8x16::Is(args[1]))
+        if (args.Info.Count >= 2 && JavascriptSIMDUint8x16::Is(args[1]))
         {
-            JavascriptSIMDUInt8x16 *instance = JavascriptSIMDUInt8x16::FromVar(args[1]);
+            JavascriptSIMDUint8x16 *instance = JavascriptSIMDUint8x16::FromVar(args[1]);
             Assert(instance);
 
-            return SIMDConvertTypeFromBits<JavascriptSIMDInt8x16, JavascriptSIMDUint32x4>(instance, scriptContext);
+            return SIMDConvertTypeFromBits<JavascriptSIMDUint8x16, JavascriptSIMDUint32x4>(instance, scriptContext);
         }
         JavascriptError::ThrowTypeError(scriptContext, JSERR_SimdInt32x4TypeMismatch, L"fromUInt8x16Bits");
-#endif
-        return NULL;
     }
 
 

+ 11 - 0
lib/Runtime/LibraryFunction.h

@@ -152,3 +152,14 @@ LIBRARY_FUNCTION(SIMD_Int32x4,    Store,             3, BIF_IgnoreDst
 LIBRARY_FUNCTION(SIMD_Int32x4,    Store1,            3, BIF_IgnoreDst                                                 , SIMDInt32x4Lib::EntryInfo::Store1)
 LIBRARY_FUNCTION(SIMD_Int32x4,    Store2,            3, BIF_IgnoreDst                                                 , SIMDInt32x4Lib::EntryInfo::Store2)
 LIBRARY_FUNCTION(SIMD_Int32x4,    Store3,            3, BIF_IgnoreDst                                                 , SIMDInt32x4Lib::EntryInfo::Store3)
+
+LIBRARY_FUNCTION(SIMD_Int16x8,    Int16x8,           8, BIF_IgnoreDst                                                 , SIMDInt16x8Lib::EntryInfo::Int16x8)
+LIBRARY_FUNCTION(SIMD_Int8x16,    Int8x16,          16, BIF_IgnoreDst                                                 , SIMDInt8x16Lib::EntryInfo::Int8x16)
+
+LIBRARY_FUNCTION(SIMD_Uint32x4,    Uint32x4,         4, BIF_IgnoreDst                                                 , SIMDUint32x4Lib::EntryInfo::Uint32x4)
+LIBRARY_FUNCTION(SIMD_Uint16x8,    Uint16x8,         8, BIF_IgnoreDst                                                 , SIMDUint16x8Lib::EntryInfo::Uint16x8)
+LIBRARY_FUNCTION(SIMD_Uint8x16,    Uint8x16,        16, BIF_IgnoreDst                                                 , SIMDUint8x16Lib::EntryInfo::Uint8x16)
+
+LIBRARY_FUNCTION(SIMD_Bool32x4,    Bool32x4,         4, BIF_IgnoreDst                                                 , SIMDBool32x4Lib::EntryInfo::Bool32x4)
+LIBRARY_FUNCTION(SIMD_Bool16x8,    Bool16x8,         8, BIF_IgnoreDst                                                 , SIMDBool16x8Lib::EntryInfo::Bool16x8)
+LIBRARY_FUNCTION(SIMD_Bool8x16,    Bool8x16,        16, BIF_IgnoreDst                                                 , SIMDBool8x16Lib::EntryInfo::Bool8x16)

+ 1 - 0
lib/Runtime/Runtime.h

@@ -144,6 +144,7 @@ namespace Js
     class NullEnumerator;
 //SIMD_JS
     // SIMD
+    class JavascriptSIMDObject;
     class SIMDFloat32x4Lib;
     class JavascriptSIMDFloat32x4;
     class SIMDFloat64x2Lib;

+ 40 - 38
lib/Runtime/Types/EdgeJavascriptTypeId.h

@@ -28,7 +28,8 @@ enum TypeId
     TypeIds_Enumerator = 9,
     TypeIds_VariantDate = 10,
 
-    // SIMD types
+    // SIMD types 
+    //[Please maintain Float32x4 as the first SIMDType and Bool8x16 as the last]
     TypeIds_SIMDFloat32x4 = 11,
     TypeIds_SIMDFloat64x2 = 12,
     TypeIds_SIMDInt32x4 = 13,
@@ -73,51 +74,52 @@ enum TypeId
     TypeIds_BooleanObject = 35,
     TypeIds_NumberObject = 36,
     TypeIds_StringObject = 37,
-    TypeIds_Arguments = 38,
-    TypeIds_ES5Array = 39,
-    TypeIds_ArrayBuffer = 40,
-    TypeIds_Int8Array = 41,
+    TypeIds_SIMDObject = 38,
+    TypeIds_Arguments = 39,
+    TypeIds_ES5Array = 40,
+    TypeIds_ArrayBuffer = 41,
+    TypeIds_Int8Array = 42,
     TypeIds_TypedArrayMin = TypeIds_Int8Array,
     TypeIds_TypedArraySCAMin = TypeIds_Int8Array, // Min SCA supported TypedArray TypeId
-    TypeIds_Uint8Array = 42,
-    TypeIds_Uint8ClampedArray = 43,
-    TypeIds_Int16Array = 44,
-    TypeIds_Uint16Array = 45,
-    TypeIds_Int32Array = 46,
-    TypeIds_Uint32Array = 47,
-    TypeIds_Float32Array = 48,
-    TypeIds_Float64Array = 49,
+    TypeIds_Uint8Array = 43,
+    TypeIds_Uint8ClampedArray = 44,
+    TypeIds_Int16Array = 45,
+    TypeIds_Uint16Array = 46,
+    TypeIds_Int32Array = 47,
+    TypeIds_Uint32Array = 48,
+    TypeIds_Float32Array = 49,
+    TypeIds_Float64Array = 50,
     TypeIds_TypedArraySCAMax = TypeIds_Float64Array, // Max SCA supported TypedArray TypeId
-    TypeIds_Int64Array = 50,
-    TypeIds_Uint64Array = 51,
-    TypeIds_CharArray = 52,
-    TypeIds_BoolArray = 53,
+    TypeIds_Int64Array = 51,
+    TypeIds_Uint64Array = 52,
+    TypeIds_CharArray = 53,
+    TypeIds_BoolArray = 54,
     TypeIds_TypedArrayMax = TypeIds_BoolArray,
-    TypeIds_EngineInterfaceObject = 54,
-    TypeIds_DataView = 55,
-    TypeIds_WinRTDate = 56,
-    TypeIds_Map = 57,
-    TypeIds_Set = 58,
-    TypeIds_WeakMap = 59,
-    TypeIds_WeakSet = 60,
-    TypeIds_SymbolObject = 61,
-    TypeIds_ArrayIterator = 62,
-    TypeIds_MapIterator = 63,
-    TypeIds_SetIterator = 64,
-    TypeIds_StringIterator = 65,
-    TypeIds_JavascriptEnumeratorIterator = 66,
-    TypeIds_Generator = 67,
-    TypeIds_Promise = 68,
+    TypeIds_EngineInterfaceObject = 55,
+    TypeIds_DataView = 56,
+    TypeIds_WinRTDate = 57,
+    TypeIds_Map = 58,
+    TypeIds_Set = 59,
+    TypeIds_WeakMap = 60,
+    TypeIds_WeakSet = 61,
+    TypeIds_SymbolObject = 62,
+    TypeIds_ArrayIterator = 63,
+    TypeIds_MapIterator = 64,
+    TypeIds_SetIterator = 65,
+    TypeIds_StringIterator = 66,
+    TypeIds_JavascriptEnumeratorIterator = 67,
+    TypeIds_Generator = 68,
+    TypeIds_Promise = 69,
 
     TypeIds_LastBuiltinDynamicObject = TypeIds_Promise,
-    TypeIds_GlobalObject = 69,
-    TypeIds_ModuleRoot = 70,
+    TypeIds_GlobalObject = 70,
+    TypeIds_ModuleRoot = 71,
     TypeIds_LastTrueJavascriptObjectType = TypeIds_ModuleRoot,
 
-    TypeIds_HostObject = 71,
-    TypeIds_ActivationObject = 72,
-    TypeIds_SpreadArgument = 73,
-    TypeIds_ModuleNamespace = 74,
+    TypeIds_HostObject = 72,
+    TypeIds_ActivationObject = 73,
+    TypeIds_SpreadArgument = 74,
+    TypeIds_ModuleNamespace = 75,
 
     TypeIds_Limit //add a new TypeId before TypeIds_Limit or before TypeIds_LastTrueJavascriptObjectType
 };

+ 8 - 2
test/Array/memset_simd.js

@@ -18,14 +18,20 @@ const allSimdTypes = Object.getOwnPropertyNames(SIMD)
         for(let i = 0; i < nLanes; ++i) {
           args[i] = Math.random() * (1 << 62);
         }
-        return SIMD[simdType](...args);
+        if (simdType != 'Float64x2') //Type is not part of spec. Will be removed as part of cleanup.
+        {
+            return SIMD[simdType](...args);
+        }
       },
       makeStringValue() {
         const args = new Array(nLanes);
         for(let i = 0; i < nLanes; ++i) {
           args[i] = Math.random() * (1 << 62);
         }
-        return `SIMD.${simdType}(${args.join(",")})`;
+        if (simdType != 'Float64x2') //Type is not part of spec. Will be removed as part of cleanup.
+        {
+            return `SIMD.${simdType}(${args.join(",")})`;
+        }
       },
       nLanes,
       simdType

+ 2 - 0
test/SIMD.float32x4.asmjs/testSIMDLink-2.baseline

@@ -1,2 +1,4 @@
 Successfully compiled asm.js code
+Asm.js Runtime Error : Foreign var import g1 is not SIMD type
+asm.js linking failed.
 PASS

+ 24 - 18
test/SIMD.float32x4.asmjs/testSIMDLink-2.js

@@ -230,18 +230,24 @@ function asmModule(stdlib, imports) {
     
     return {func1:func1, func2:func2, func3:func3, func4:func4, func5:func5, func6:func6};
 }
-SIMD.Float32x4 = function (a, b, c, d) { return a + b + c + d;}
-SIMD.Int32x4 = function (a, b, c, d) { return a + b + c + d;}
-var m = asmModule(this, {g1:SIMD.Float32x4(90934.2,123.9,419.39,449.0), g2:SIMD.Int32x4(-1065353216, -1073741824,-1077936128, -1082130432), g3:SIMD.Float64x2(110.20, 58967.0, 14511.670, 191766.23431)});
-
-var ret1 = m.func1();
-var ret2 = m.func2();
-var ret3 = m.func3();
-
+try{
+    SIMD.Float32x4 = function (a, b, c, d) { return a + b + c + d;}
+    SIMD.Int32x4 = function (a, b, c, d) { return a + b + c + d;}
+    var m = asmModule(this, {g1:SIMD.Float32x4(90934.2,123.9,419.39,449.0), g2:SIMD.Int32x4(-1065353216, -1073741824,-1077936128, -1082130432), g3:SIMD.Float64x2(110.20, 58967.0, 14511.670, 191766.23431)});
+}
+catch(e)
+{
+    print('PASS');
+}
 
-var ret4 = m.func4();
-var ret5 = m.func5();
-var ret6 = m.func6();
+// var ret1 = m.func1();
+// var ret2 = m.func2();
+// var ret3 = m.func3();
+// 
+// 
+// var ret4 = m.func4();
+// var ret5 = m.func5();
+// var ret6 = m.func6();
 
 /*
 var ret7 = m.func7();
@@ -254,15 +260,15 @@ var ret11 = m.func11();
 var ret12 = m.func12();
 
 */
+// 
+// equalSimd([-5033.2001953125, 3401, -665.3400268554687, 32234.099609375], ret1, SIMD.Float32x4, "Test SIMDLink2");
+// equalSimd([-90934.203125, -123.9000015258789, -419.3900146484375, -449], ret2, SIMD.Float32x4, "Test SIMDLink2");
+// equalSimd([5033.2001953125, 3401, -665.3400268554687, -32234.099609375], ret3, SIMD.Float32x4, "Test SIMDLink2");
+// equalSimd([5033.2001953125, 3401, 665.3400268554687, 32234.099609375], ret4, SIMD.Float32x4, "Test SIMDLink2");
+// equalSimd([90934.203125, 123.9000015258789, 419.3900146484375, 449], ret5, SIMD.Float32x4, "Test SIMDLink2");
+// equalSimd([5033.2001953125, 3401, 665.3400268554687, 32234.099609375], ret6, SIMD.Float32x4, "Test SIMDLink2");
 
-equalSimd([-5033.2001953125, 3401, -665.3400268554687, 32234.099609375], ret1, SIMD.Float32x4, "Test SIMDLink2");
-equalSimd([-90934.203125, -123.9000015258789, -419.3900146484375, -449], ret2, SIMD.Float32x4, "Test SIMDLink2");
-equalSimd([5033.2001953125, 3401, -665.3400268554687, -32234.099609375], ret3, SIMD.Float32x4, "Test SIMDLink2");
-equalSimd([5033.2001953125, 3401, 665.3400268554687, 32234.099609375], ret4, SIMD.Float32x4, "Test SIMDLink2");
-equalSimd([90934.203125, 123.9000015258789, 419.3900146484375, 449], ret5, SIMD.Float32x4, "Test SIMDLink2");
-equalSimd([5033.2001953125, 3401, 665.3400268554687, 32234.099609375], ret6, SIMD.Float32x4, "Test SIMDLink2");
 
-print("PASS");
 
 
 /*

+ 63 - 0
test/SIMD.wrappers/rlexe.xml

@@ -0,0 +1,63 @@
+<?xml version="1.0" encoding="utf-8"?>
+<regress-exe>
+  <test>
+    <default>
+      <files>testInt32x4.js</files>
+      <compile-flags>-ES6All -Simdjs</compile-flags>
+    </default>
+  </test>
+  <test>
+    <default>
+      <files>testInt32x4.js</files>
+      <compile-flags>-ES6All -Simdjs</compile-flags>
+    </default>
+  </test>
+    <test>
+    <default>
+      <files>testInt16x8.js</files>
+      <compile-flags>-ES6All -Simdjs</compile-flags>
+    </default>
+  </test>
+  <test>
+    <default>
+      <files>testInt8x16.js</files>
+      <compile-flags>-ES6All -Simdjs</compile-flags>
+    </default>
+  </test>
+  <test>
+    <default>
+      <files>testUint32x4.js</files>
+      <compile-flags>-ES6All -Simdjs</compile-flags>
+    </default>
+  </test>
+  <test>
+    <default>
+      <files>testUint16x8.js</files>
+      <compile-flags>-ES6All -Simdjs</compile-flags>
+    </default>
+  </test>
+    <test>
+    <default>
+      <files>testUint8x16.js</files>
+      <compile-flags>-ES6All -Simdjs</compile-flags>
+    </default>
+  </test>
+    <test>
+    <default>
+      <files>testBool32x4.js</files>
+      <compile-flags>-ES6All -Simdjs</compile-flags>
+    </default>
+  </test>
+    <test>
+    <default>
+      <files>testBool16x8.js</files>
+      <compile-flags>-ES6All -Simdjs</compile-flags>
+    </default>
+  </test>
+    <test>
+    <default>
+      <files>testBool8x16.js</files>
+      <compile-flags>-ES6All -Simdjs</compile-flags>
+    </default>
+  </test>
+</regress-exe>

+ 305 - 0
test/SIMD.wrappers/testBool16x8.js

@@ -0,0 +1,305 @@
+//-------------------------------------------------------------------------------------------------------
+// Copyright (C) Microsoft. All rights reserved.
+// Licensed under the MIT license. See LICENSE.txt file in the project root for full license information.
+//-------------------------------------------------------------------------------------------------------
+this.WScript.LoadScriptFile("..\\UnitTestFramework\\SimdJsHelpers.js");
+
+var sf0 = SIMD.Bool16x8(1.35, -2.0, 3.4, 0.0, 1.35, -2.0, 3.4, 0.0);
+var sf1 = SIMD.Bool16x8(1.35, -2.0, 3.4, 0.0, 1.35, -2.0, 3.4, 0.0);
+var sf2 = SIMD.Bool16x8(1.35, -2.0, 3.14, 0.0, 1.35, -2.0, 3.14, 0.0);
+var sf3 = SIMD.Bool16x8(0, Infinity, NaN, -0, 0, Infinity, NaN, -0);
+
+function testConstructor()
+{
+    ////////////////////
+    //Constructor
+    ///////////////////
+    equal("object", typeof SIMD.Bool16x8.prototype);
+    equal("function", typeof SIMD.Bool16x8.prototype.constructor);
+    equal("function", typeof SIMD.Bool16x8.prototype.toString);
+    equal("function", typeof SIMD.Bool16x8.prototype.toLocaleString);
+    equal("function", typeof SIMD.Bool16x8.prototype.valueOf);
+    equal(SIMD.Bool16x8, SIMD.Bool16x8.prototype.constructor);
+
+    descriptor = Object.getOwnPropertyDescriptor(SIMD.Bool16x8, 'prototype');
+    equal(false, descriptor.writable);
+    equal(false, descriptor.enumerable);
+    equal(false, descriptor.configurable); 
+}
+
+function testToStringTag()
+{
+    ///////////////////
+    //SIMDConstructor.prototype [ @@toStringTag ]
+    ///////////////////
+    var sym = Symbol('sym');
+    var symbol_object = Object(sym);
+    equal("SIMD.Bool16x8", SIMD.Bool16x8.prototype[Symbol.toStringTag]);
+
+    descriptor = Object.getOwnPropertyDescriptor(SIMD.Bool16x8.prototype, Symbol.toStringTag);
+    equal(false, descriptor.writable);
+    equal(false, descriptor.enumerable);
+    equal(true, descriptor.configurable);
+}
+
+function testToPrimitive()
+{
+    ///////////////////
+    //SIMDConstructor.prototype [ @@toPrimitive ] 
+    ///////////////////
+    equal("function",typeof SIMD.Bool16x8.prototype[Symbol.toPrimitive]);
+    equal(1, SIMD.Bool16x8.prototype[Symbol.toPrimitive].length);
+
+    descriptor = Object.getOwnPropertyDescriptor(SIMD.Bool16x8.prototype, Symbol.toPrimitive);
+    equal(false, descriptor.writable);
+    equal(false, descriptor.enumerable);
+    equal(true, descriptor.configurable);
+
+    var functionToString = SIMD.Bool16x8.prototype[Symbol.toPrimitive].toString();
+    var actualName = functionToString.substring(9, functionToString.indexOf('('));
+    equal("[Symbol.toPrimitive]",actualName);
+
+    ///////////////////////////
+    //Overriding @@ToPrimitive
+    ///////////////////////////
+    SIMD.Bool16x8.prototype[Symbol.toPrimitive] = undefined;
+    var G;
+    var functionBackup = SIMD.Bool16x8.prototype.toLocaleString;
+    SIMD.Bool16x8.prototype.toLocaleString = function(){
+        G = this;
+    }
+    sf0.toLocaleString();
+    try{var x =  G + G;}
+    catch(e)
+    {equal("Error: Number expected", e);}  //@@toPrimitive is not writable
+
+    //@@toPrimitive is configurable. 
+    memberBackup = Object.getOwnPropertyDescriptor(SIMD.Bool16x8.prototype, Symbol.toPrimitive);
+    delete SIMD.Bool16x8.prototype[Symbol.toPrimitive];
+    SIMD.Bool16x8.prototype[Symbol.toPrimitive] = function() { return 1;}
+    equal(2, G + G);
+    equal(0, G - G);
+    equal(1, G * G);
+    equal(1, G / G);
+    equal(true, G == G);
+    equal(true, G === G);
+    equal(false, G > G);
+    equal(true, G >= G);
+    equal(false, G < G);
+    equal(true, G >= G);
+
+    delete SIMD.Bool16x8.prototype[Symbol.toPrimitive];
+    SIMD.Bool16x8.prototype[Symbol.toPrimitive] = function() { return undefined;}
+    equal(NaN, G + G);
+    equal(NaN, G - G);
+    equal(NaN, G * G);
+    equal(NaN, G / G);
+    equal(true, G == G);
+    equal(true, G === G);
+    equal(false, G > G);
+    equal(false, G >= G);
+    equal(false, G < G);
+    equal(false, G >= G);
+
+    delete SIMD.Bool16x8.prototype[Symbol.toPrimitive];
+    SIMD.Bool16x8.prototype[Symbol.toPrimitive] = function() { return "test";}
+    equal("testtest", G + G);
+    equal(NaN, G - G);
+    equal(NaN, G * G);
+    equal(NaN, G / G);
+    equal(true, G == G);
+    equal(true, G === G);
+    equal(false, G > G);
+    equal(true, G >= G);
+    equal(false, G < G);
+    equal(true, G >= G);
+
+    delete SIMD.Bool16x8.prototype[Symbol.toPrimitive];
+    SIMD.Bool16x8.prototype[Symbol.toPrimitive] = 5;
+    try{var x =  G + G;}
+    catch(e)
+    {equal("TypeError: 'Symbol.toPrimitive' is not a function", e);}
+
+    SIMD.Bool16x8.prototype[Symbol.toPrimitive] = memberBackup;
+    SIMD.Bool16x8.prototype.toLocaleString = functionBackup
+}
+
+function testValueOf()
+{
+    ///////////////////
+    //ValueOf
+    ///////////////////
+    descriptor = Object.getOwnPropertyDescriptor(SIMD.Bool16x8.prototype, 'valueOf');
+    equal(true, descriptor.writable);
+    equal(false, descriptor.enumerable);
+    equal(true, descriptor.configurable);
+    equal("bool16x8", typeof sf0.valueOf());
+    equal("SIMD.Bool16x8(true, true, true, false, true, true, true, false)", sf0.toString());
+}
+
+function testToString_LocaleString()
+{
+    ///////////////////
+    //ToString / ToLocaleString
+    ///////////////////
+    descriptor = Object.getOwnPropertyDescriptor(SIMD.Bool16x8.prototype, 'toString');
+    equal(true, descriptor.writable);
+    equal(false, descriptor.enumerable);
+    equal(true, descriptor.configurable);
+
+    descriptor = Object.getOwnPropertyDescriptor(SIMD.Bool16x8.prototype, 'toLocaleString');
+    equal(true, descriptor.writable);
+    equal(false, descriptor.enumerable);
+    equal(true, descriptor.configurable);
+    
+    equal("SIMD.Bool16x8(true, true, true, false, true, true, true, false)", sf0.toString()); //If float use ToString on lanes, the right values will be available.
+    equal("SIMD.Bool16x8(true, true, true, false, true, true, true, false)", sf0.toLocaleString());
+
+    equal("SIMD.Bool16x8(false, true, false, false, false, true, false, false)", sf3.toString()); 
+    // equal("SIMD.Bool16x8(0, ?, NaN, 0)", sf3.toLocaleString());   //How should this work?
+    var origFn = SIMD.Bool16x8.prototype.toLocaleString;
+    var G5;
+    SIMD.Bool16x8.prototype.toLocaleString = function() {
+        G5 = this;
+        return "NEWTOSTRING";
+    }
+
+    equal("undefined", typeof(G5));
+    equal("NEWTOSTRING", sf0.toLocaleString());
+    equal("object", typeof(G5));
+    equal("NEWTOSTRING", G5.toLocaleString());
+    equal("NEWTOSTRING", sf0.toLocaleString());
+     SIMD.Bool16x8.prototype.toLocaleString = origFn;
+
+    ///////////////////
+    //PrototypeLinking toString
+    ///////////////////
+    var origFn = SIMD.Bool16x8.prototype.toString;
+    SIMD.Bool16x8.prototype.toString = function() {
+        G = this;
+        return "NEWTOSTRING";
+    }
+
+    equal("undefined", typeof(G));
+    equal("NEWTOSTRING", sf0.toString());
+    equal("object", typeof(G));
+    equal("NEWTOSTRING", G.toString());
+    equal("NEWTOSTRING", sf0.toString());
+    SIMD.Bool16x8.prototype.toString = origFn;
+
+}
+
+function testProtoLinking()
+{
+    ///////////////////
+    //Inheritance 
+    ///////////////////
+    SIMD.Bool16x8.prototype.myToString = function() {
+        return "MYTOSTRING";
+    }
+    equal("MYTOSTRING", sf0.myToString());
+    equal("MYTOSTRING", G.myToString());
+
+    ///////////////////
+    //PrototypeLinking valueOf
+    ///////////////////
+    SIMD.Bool16x8.prototype.valueOf = function() {
+        G1 = this;
+        return  "NEWVALUEOF";
+    }
+
+    var G1;
+    equal("undefined", typeof(G1));
+    equal("NEWVALUEOF", sf0.valueOf());
+    equal("object", typeof(G1));
+    equal("NEWVALUEOF", G1.valueOf());
+    equal("NEWVALUEOF", sf0.valueOf());
+}
+
+function testValueSemantics() 
+{
+    ///////////////////
+    //Value semantics
+    ///////////////////
+    equal(true, (sf0 == sf0));
+    equal(true, (sf0 === sf0));
+    equal(true, (sf0 == sf1));
+    equal(true, (sf0 === sf1));
+    equal(true, (sf0 == sf2));
+    equal(true, (sf0 === sf2));
+
+    ///////////////////
+    //Comparision
+    //////////////////
+    try{var x = sf0 > sf1;}
+    catch(e)
+    {equal("TypeError: SIMD type: cannot be converted to a number", e);}
+
+    try{var x = sf0 < sf1;}
+    catch(e)
+    {equal("TypeError: SIMD type: cannot be converted to a number", e);}
+
+    try{var x = sf0 >= sf1;}
+    catch(e)
+    {equal("TypeError: SIMD type: cannot be converted to a number", e);}
+
+    try{var x = sf0 <= sf1;}
+    catch(e)
+    {equal("TypeError: SIMD type: cannot be converted to a number", e);}
+
+    ///////////////////////
+    //Arithmetic operators
+    ///////////////////////
+
+    equal("SIMD.Bool16x8(false, true, false, false, false, true, false, false)test", sf3 + "test");
+    equal("testSIMD.Bool16x8(false, true, false, false, false, true, false, false)", "test" + sf3);
+
+    try{var x =  sf3 + sf3;}
+    catch(e)
+    {equal("Error: Number expected", e);} //Check
+
+    try{var x =  sf3 - sf3;}
+    catch(e)
+    {equal("Error: Number expected", e);} 
+
+    try{var x =  sf3 / sf3;}
+    catch(e)
+    {equal("Error: Number expected", e);} 
+
+    try{var x =  sf3 * sf3;}
+    catch(e)
+    {equal("Error: Number expected", e);}
+}
+
+//The following test can be enabled when extract lane builtin for bools are merged. 
+// function testHorizontalOR()
+// {
+//     var b1 = SIMD.Bool16x8(true, false, false, true);
+//
+//     SIMD.Bool16x8.prototype.horizontalOR = function()
+//     {
+//         var b4 = this.valueOf();
+//         return (SIMD.Bool16x8.extractLane(b4, 0) ||
+//                 SIMD.Bool16x8.extractLane(b4, 1) ||
+//                 SIMD.Bool16x8.extractLane(b4, 2) ||
+//                 SIMD.Bool16x8.extractLane(b4, 3) );
+//      }
+//
+//      equal(true, b1.horizontalOR());
+// }
+
+function testWrapperObject() 
+{
+
+    testConstructor();
+    testToStringTag();
+    testToPrimitive();
+    testValueOf();
+    testToString_LocaleString();
+    testProtoLinking();
+    testValueSemantics();
+    // testHorizontalOR()
+}
+
+testWrapperObject();
+print("PASS");

+ 304 - 0
test/SIMD.wrappers/testBool32x4.js

@@ -0,0 +1,304 @@
+//-------------------------------------------------------------------------------------------------------
+// Copyright (C) Microsoft. All rights reserved.
+// Licensed under the MIT license. See LICENSE.txt file in the project root for full license information.
+//-------------------------------------------------------------------------------------------------------
+this.WScript.LoadScriptFile("..\\UnitTestFramework\\SimdJsHelpers.js");
+
+var sf0 = SIMD.Bool32x4(1.35, -2.0, 3.4, 0.0);
+var sf1 = SIMD.Bool32x4(1.35, -2.0, 3.4, 0.0);
+var sf2 = SIMD.Bool32x4(1.35, -2.0, 3.14, 0.0);
+var sf3 = SIMD.Bool32x4(0, Infinity, NaN, -0);
+
+function testConstructor()
+{
+    ////////////////////
+    //Constructor
+    ///////////////////
+    equal("object", typeof SIMD.Bool32x4.prototype);
+    equal("function", typeof SIMD.Bool32x4.prototype.constructor);
+    equal("function", typeof SIMD.Bool32x4.prototype.toString);
+    equal("function", typeof SIMD.Bool32x4.prototype.toLocaleString);
+    equal("function", typeof SIMD.Bool32x4.prototype.valueOf);
+    equal(SIMD.Bool32x4, SIMD.Bool32x4.prototype.constructor);
+
+    descriptor = Object.getOwnPropertyDescriptor(SIMD.Bool32x4, 'prototype');
+    equal(false, descriptor.writable);
+    equal(false, descriptor.enumerable);
+    equal(false, descriptor.configurable); 
+}
+
+function testToStringTag()
+{
+    ///////////////////
+    //SIMDConstructor.prototype [ @@toStringTag ]
+    ///////////////////
+    var sym = Symbol('sym');
+    var symbol_object = Object(sym);
+    equal("SIMD.Bool32x4", SIMD.Bool32x4.prototype[Symbol.toStringTag]);
+
+    descriptor = Object.getOwnPropertyDescriptor(SIMD.Bool32x4.prototype, Symbol.toStringTag);
+    equal(false, descriptor.writable);
+    equal(false, descriptor.enumerable);
+    equal(true, descriptor.configurable);
+}
+
+function testToPrimitive()
+{
+    ///////////////////
+    //SIMDConstructor.prototype [ @@toPrimitive ] 
+    ///////////////////
+    equal("function",typeof SIMD.Bool32x4.prototype[Symbol.toPrimitive]);
+    equal(1, SIMD.Bool32x4.prototype[Symbol.toPrimitive].length);
+
+    descriptor = Object.getOwnPropertyDescriptor(SIMD.Bool32x4.prototype, Symbol.toPrimitive);
+    equal(false, descriptor.writable);
+    equal(false, descriptor.enumerable);
+    equal(true, descriptor.configurable);
+
+    var functionToString = SIMD.Bool32x4.prototype[Symbol.toPrimitive].toString();
+    var actualName = functionToString.substring(9, functionToString.indexOf('('));
+    equal("[Symbol.toPrimitive]",actualName);
+
+    ///////////////////////////
+    //Overriding @@ToPrimitive
+    ///////////////////////////
+    SIMD.Bool32x4.prototype[Symbol.toPrimitive] = undefined;
+    var G;
+    var functionBackup = SIMD.Bool32x4.prototype.toLocaleString;
+    SIMD.Bool32x4.prototype.toLocaleString = function(){
+        G = this;
+    }
+    sf0.toLocaleString();
+    try{var x =  G + G;}
+    catch(e)
+    {equal("Error: Number expected", e);}  //@@toPrimitive is not writable
+
+    //@@toPrimitive is configurable. 
+    memberBackup = Object.getOwnPropertyDescriptor(SIMD.Bool32x4.prototype, Symbol.toPrimitive);
+    delete SIMD.Bool32x4.prototype[Symbol.toPrimitive];
+    SIMD.Bool32x4.prototype[Symbol.toPrimitive] = function() { return 1;}
+    equal(2, G + G);
+    equal(0, G - G);
+    equal(1, G * G);
+    equal(1, G / G);
+    equal(true, G == G);
+    equal(true, G === G);
+    equal(false, G > G);
+    equal(true, G >= G);
+    equal(false, G < G);
+    equal(true, G >= G);
+
+    delete SIMD.Bool32x4.prototype[Symbol.toPrimitive];
+    SIMD.Bool32x4.prototype[Symbol.toPrimitive] = function() { return undefined;}
+    equal(NaN, G + G);
+    equal(NaN, G - G);
+    equal(NaN, G * G);
+    equal(NaN, G / G);
+    equal(true, G == G);
+    equal(true, G === G);
+    equal(false, G > G);
+    equal(false, G >= G);
+    equal(false, G < G);
+    equal(false, G >= G);
+
+    delete SIMD.Bool32x4.prototype[Symbol.toPrimitive];
+    SIMD.Bool32x4.prototype[Symbol.toPrimitive] = function() { return "test";}
+    equal("testtest", G + G);
+    equal(NaN, G - G);
+    equal(NaN, G * G);
+    equal(NaN, G / G);
+    equal(true, G == G);
+    equal(true, G === G);
+    equal(false, G > G);
+    equal(true, G >= G);
+    equal(false, G < G);
+    equal(true, G >= G);
+
+    delete SIMD.Bool32x4.prototype[Symbol.toPrimitive];
+    SIMD.Bool32x4.prototype[Symbol.toPrimitive] = 5;
+    try{var x =  G + G;}
+    catch(e)
+    {equal("TypeError: 'Symbol.toPrimitive' is not a function", e);}
+
+    SIMD.Bool32x4.prototype[Symbol.toPrimitive] = memberBackup;
+    SIMD.Bool32x4.prototype.toLocaleString = functionBackup
+}
+
+function testValueOf()
+{
+    ///////////////////
+    //ValueOf
+    ///////////////////
+    descriptor = Object.getOwnPropertyDescriptor(SIMD.Bool32x4.prototype, 'valueOf');
+    equal(true, descriptor.writable);
+    equal(false, descriptor.enumerable);
+    equal(true, descriptor.configurable);
+    equal("bool32x4", typeof sf0.valueOf());
+    equal("SIMD.Bool32x4(true, true, true, false)", sf0.toString());
+}
+
+function testToString_LocaleString()
+{
+    ///////////////////
+    //ToString / ToLocaleString
+    ///////////////////
+    descriptor = Object.getOwnPropertyDescriptor(SIMD.Bool32x4.prototype, 'toString');
+    equal(true, descriptor.writable);
+    equal(false, descriptor.enumerable);
+    equal(true, descriptor.configurable);
+
+    descriptor = Object.getOwnPropertyDescriptor(SIMD.Bool32x4.prototype, 'toLocaleString');
+    equal(true, descriptor.writable);
+    equal(false, descriptor.enumerable);
+    equal(true, descriptor.configurable);
+
+    equal("SIMD.Bool32x4(true, true, true, false)", sf0.toString()); //If float use ToString on lanes, the right values will be available.
+    equal("SIMD.Bool32x4(true, true, true, false)", sf0.toLocaleString());
+    
+    equal("SIMD.Bool32x4(false, true, false, false)", sf3.toString()); 
+    // equal("SIMD.Bool32x4(0, ?, NaN, 0)", sf3.toLocaleString());   //How should this work?
+    var origFn = SIMD.Bool32x4.prototype.toLocaleString;
+    var G5;
+    SIMD.Bool32x4.prototype.toLocaleString = function() {
+        G5 = this;
+        return "NEWTOSTRING";
+    }
+
+    equal("undefined", typeof(G5));
+    equal("NEWTOSTRING", sf0.toLocaleString());
+    equal("object", typeof(G5));
+    equal("NEWTOSTRING", G5.toLocaleString());
+    equal("NEWTOSTRING", sf0.toLocaleString());
+     SIMD.Bool32x4.prototype.toLocaleString = origFn;
+
+    ///////////////////
+    //PrototypeLinking toString
+    ///////////////////
+    var origFn = SIMD.Bool32x4.prototype.toString;
+    SIMD.Bool32x4.prototype.toString = function() {
+        G = this;
+        return "NEWTOSTRING";
+    }
+
+    equal("undefined", typeof(G));
+    equal("NEWTOSTRING", sf0.toString());
+    equal("object", typeof(G));
+    equal("NEWTOSTRING", G.toString());
+    equal("NEWTOSTRING", sf0.toString());
+    SIMD.Bool32x4.prototype.toString = origFn;
+}
+
+function testProtoLinking()
+{
+    ///////////////////
+    //Inheritance 
+    ///////////////////
+    SIMD.Bool32x4.prototype.myToString = function() {
+        return "MYTOSTRING";
+    }
+    equal("MYTOSTRING", sf0.myToString());
+    equal("MYTOSTRING", G.myToString());
+
+    ///////////////////
+    //PrototypeLinking valueOf
+    ///////////////////
+    SIMD.Bool32x4.prototype.valueOf = function() {
+        G1 = this;
+        return  "NEWVALUEOF";
+    }
+
+    var G1;
+    equal("undefined", typeof(G1));
+    equal("NEWVALUEOF", sf0.valueOf());
+    equal("object", typeof(G1));
+    equal("NEWVALUEOF", G1.valueOf());
+    equal("NEWVALUEOF", sf0.valueOf());
+}
+
+function testValueSemantics() 
+{
+    ///////////////////
+    //Value semantics
+    ///////////////////
+    equal(true, (sf0 == sf0));
+    equal(true, (sf0 === sf0));
+    equal(true, (sf0 == sf1));
+    equal(true, (sf0 === sf1));
+    equal(true, (sf0 == sf2));
+    equal(true, (sf0 === sf2));
+
+    ///////////////////
+    //Comparision
+    //////////////////
+    try{var x = sf0 > sf1;}
+    catch(e)
+    {equal("TypeError: SIMD type: cannot be converted to a number", e);}
+    
+    try{var x = sf0 < sf1;}
+    catch(e)
+    {equal("TypeError: SIMD type: cannot be converted to a number", e);}
+
+    try{var x = sf0 >= sf1;}
+    catch(e)
+    {equal("TypeError: SIMD type: cannot be converted to a number", e);}
+
+    try{var x = sf0 <= sf1;}
+    catch(e)
+    {equal("TypeError: SIMD type: cannot be converted to a number", e);}
+
+    ///////////////////////
+    //Arithmetic operators
+    ///////////////////////
+
+    equal("SIMD.Bool32x4(false, true, false, false)test", sf3 + "test");
+    equal("testSIMD.Bool32x4(false, true, false, false)", "test" + sf3);
+
+    try{var x =  sf3 + sf3;}
+    catch(e)
+    {equal("Error: Number expected", e);} //Check
+    
+    try{var x =  sf3 - sf3;}
+    catch(e)
+    {equal("Error: Number expected", e);} 
+    
+    try{var x =  sf3 / sf3;}
+    catch(e)
+    {equal("Error: Number expected", e);} 
+    
+    try{var x =  sf3 * sf3;}
+    catch(e)
+    {equal("Error: Number expected", e);}
+}
+
+//The following test can be enabled when extract lane builtin for bools are merged. 
+// function testHorizontalOR()
+// {
+//     var b1 = SIMD.Bool32x4(true, false, false, true);
+//
+//     SIMD.Bool32x4.prototype.horizontalOR = function()
+//     {
+//         var b4 = this.valueOf();
+//         return (SIMD.Bool32x4.extractLane(b4, 0) ||
+//                 SIMD.Bool32x4.extractLane(b4, 1) ||
+//                 SIMD.Bool32x4.extractLane(b4, 2) ||
+//                 SIMD.Bool32x4.extractLane(b4, 3) );
+//      }
+//
+//      equal(true, b1.horizontalOR());
+// }
+
+function testWrapperObject() 
+{
+
+    testConstructor();
+    testToStringTag();
+    testToPrimitive();
+    testValueOf();
+    testToString_LocaleString();
+    testProtoLinking();
+    testValueSemantics();
+    // testHorizontalOR()
+}
+
+testWrapperObject();
+print("PASS");

+ 303 - 0
test/SIMD.wrappers/testBool8x16.js

@@ -0,0 +1,303 @@
+//-------------------------------------------------------------------------------------------------------
+// Copyright (C) Microsoft. All rights reserved.
+// Licensed under the MIT license. See LICENSE.txt file in the project root for full license information.
+//-------------------------------------------------------------------------------------------------------
+this.WScript.LoadScriptFile("..\\UnitTestFramework\\SimdJsHelpers.js");
+
+var sf0 = SIMD.Bool8x16(1.35, -2.0, 3.4, 0.0, 1.35, -2.0, 3.4, 0.0, 1.35, -2.0, 3.4, 0.0, 1.35, -2.0, 3.4, 0.0);
+var sf1 = SIMD.Bool8x16(1.35, -2.0, 3.4, 0.0, 1.35, -2.0, 3.4, 0.0, 1.35, -2.0, 3.4, 0.0, 1.35, -2.0, 3.4, 0.0);
+var sf2 = SIMD.Bool8x16(1.35, -2.0, 3.14, 0.0, 1.35, -2.0, 3.14, 0.0, 1.35, -2.0, 3.14, 0.0, 1.35, -2.0, 3.14, 0.0);
+var sf3 = SIMD.Bool8x16(0, Infinity, NaN, -0, 0, Infinity, NaN, -0, 0, Infinity, NaN, -0, 0, Infinity, NaN, -0);
+
+function testConstructor()
+{
+    ////////////////////
+    //Constructor
+    ///////////////////
+    equal("object", typeof SIMD.Bool8x16.prototype);
+    equal("function", typeof SIMD.Bool8x16.prototype.constructor);
+    equal("function", typeof SIMD.Bool8x16.prototype.toString);
+    equal("function", typeof SIMD.Bool8x16.prototype.toLocaleString);
+    equal("function", typeof SIMD.Bool8x16.prototype.valueOf);
+    equal(SIMD.Bool8x16, SIMD.Bool8x16.prototype.constructor);
+
+    descriptor = Object.getOwnPropertyDescriptor(SIMD.Bool8x16, 'prototype');
+    equal(false, descriptor.writable);
+    equal(false, descriptor.enumerable);
+    equal(false, descriptor.configurable); 
+}
+
+function testToStringTag()
+{
+    ///////////////////
+    //SIMDConstructor.prototype [ @@toStringTag ]
+    ///////////////////
+    var sym = Symbol('sym');
+    var symbol_object = Object(sym);
+    equal("SIMD.Bool8x16", SIMD.Bool8x16.prototype[Symbol.toStringTag]);
+
+    descriptor = Object.getOwnPropertyDescriptor(SIMD.Bool8x16.prototype, Symbol.toStringTag);
+    equal(false, descriptor.writable);
+    equal(false, descriptor.enumerable);
+    equal(true, descriptor.configurable);
+}
+
+function testToPrimitive()
+{
+    ///////////////////
+    //SIMDConstructor.prototype [ @@toPrimitive ] 
+    ///////////////////
+    equal("function",typeof SIMD.Bool8x16.prototype[Symbol.toPrimitive]);
+    equal(1, SIMD.Bool8x16.prototype[Symbol.toPrimitive].length);
+
+    descriptor = Object.getOwnPropertyDescriptor(SIMD.Bool8x16.prototype, Symbol.toPrimitive);
+    equal(false, descriptor.writable);
+    equal(false, descriptor.enumerable);
+    equal(true, descriptor.configurable);
+
+    var functionToString = SIMD.Bool8x16.prototype[Symbol.toPrimitive].toString();
+    var actualName = functionToString.substring(9, functionToString.indexOf('('));
+    equal("[Symbol.toPrimitive]",actualName);
+
+    ///////////////////////////
+    //Overriding @@ToPrimitive
+    ///////////////////////////
+    SIMD.Bool8x16.prototype[Symbol.toPrimitive] = undefined;
+    var G;
+    var functionBackup = SIMD.Bool8x16.prototype.toLocaleString;
+    SIMD.Bool8x16.prototype.toLocaleString = function(){
+        G = this;
+    }
+    sf0.toLocaleString();
+    try{var x =  G + G;}
+    catch(e)
+    {equal("Error: Number expected", e);}  //@@toPrimitive is not writable
+
+    //@@toPrimitive is configurable. 
+    memberBackup = Object.getOwnPropertyDescriptor(SIMD.Bool8x16.prototype, Symbol.toPrimitive);
+    delete SIMD.Bool8x16.prototype[Symbol.toPrimitive];
+    SIMD.Bool8x16.prototype[Symbol.toPrimitive] = function() { return 1;}
+    equal(2, G + G);
+    equal(0, G - G);
+    equal(1, G * G);
+    equal(1, G / G);
+    equal(true, G == G);
+    equal(true, G === G);
+    equal(false, G > G);
+    equal(true, G >= G);
+    equal(false, G < G);
+    equal(true, G >= G);
+
+    delete SIMD.Bool8x16.prototype[Symbol.toPrimitive];
+    SIMD.Bool8x16.prototype[Symbol.toPrimitive] = function() { return undefined;}
+    equal(NaN, G + G);
+    equal(NaN, G - G);
+    equal(NaN, G * G);
+    equal(NaN, G / G);
+    equal(true, G == G);
+    equal(true, G === G);
+    equal(false, G > G);
+    equal(false, G >= G);
+    equal(false, G < G);
+    equal(false, G >= G);
+
+    delete SIMD.Bool8x16.prototype[Symbol.toPrimitive];
+    SIMD.Bool8x16.prototype[Symbol.toPrimitive] = function() { return "test";}
+    equal("testtest", G + G);
+    equal(NaN, G - G);
+    equal(NaN, G * G);
+    equal(NaN, G / G);
+    equal(true, G == G);
+    equal(true, G === G);
+    equal(false, G > G);
+    equal(true, G >= G);
+    equal(false, G < G);
+    equal(true, G >= G);
+
+    delete SIMD.Bool8x16.prototype[Symbol.toPrimitive];
+    SIMD.Bool8x16.prototype[Symbol.toPrimitive] = 5;
+    try{var x =  G + G;}
+    catch(e)
+    {equal("TypeError: 'Symbol.toPrimitive' is not a function", e);}
+
+    SIMD.Bool8x16.prototype[Symbol.toPrimitive] = memberBackup;
+    SIMD.Bool8x16.prototype.toLocaleString = functionBackup
+}
+
+function testValueOf()
+{
+    ///////////////////
+    //ValueOf
+    ///////////////////
+    descriptor = Object.getOwnPropertyDescriptor(SIMD.Bool8x16.prototype, 'valueOf');
+    equal(true, descriptor.writable);
+    equal(false, descriptor.enumerable);
+    equal(true, descriptor.configurable);
+    equal("bool8x16", typeof sf0.valueOf());
+    equal("SIMD.Bool8x16(true, true, true, false, true, true, true, false, true, true, true, false, true, true, true, false)", sf0.toString());
+}
+
+function testToString_LocaleString()
+{
+    ///////////////////
+    //ToString / ToLocaleString
+    ///////////////////
+    descriptor = Object.getOwnPropertyDescriptor(SIMD.Bool8x16.prototype, 'toString');
+    equal(true, descriptor.writable);
+    equal(false, descriptor.enumerable);
+    equal(true, descriptor.configurable);
+
+    descriptor = Object.getOwnPropertyDescriptor(SIMD.Bool8x16.prototype, 'toLocaleString');
+    equal(true, descriptor.writable);
+    equal(false, descriptor.enumerable);
+    equal(true, descriptor.configurable);
+
+    equal("SIMD.Bool8x16(true, true, true, false, true, true, true, false, true, true, true, false, true, true, true, false)", sf0.toString()); //If float use ToString on lanes, the right values will be available.
+    equal("SIMD.Bool8x16(true, true, true, false, true, true, true, false, true, true, true, false, true, true, true, false)", sf0.toLocaleString());
+    equal("SIMD.Bool8x16(false, true, false, false, false, true, false, false, false, true, false, false, false, true, false, false)", sf3.toString()); 
+    // equal("SIMD.Bool8x16(0, ?, NaN, 0)", sf3.toLocaleString());   //How should this work?
+    var origFn = SIMD.Bool8x16.prototype.toLocaleString;
+    var G5;
+    SIMD.Bool8x16.prototype.toLocaleString = function() {
+        G5 = this;
+        return "NEWTOSTRING";
+    }
+
+    equal("undefined", typeof(G5));
+    equal("NEWTOSTRING", sf0.toLocaleString());
+    equal("object", typeof(G5));
+    equal("NEWTOSTRING", G5.toLocaleString());
+    equal("NEWTOSTRING", sf0.toLocaleString());
+    SIMD.Bool8x16.prototype.toLocaleString = origFn;
+
+    ///////////////////
+    //PrototypeLinking toString
+    ///////////////////
+    var origFn = SIMD.Bool8x16.prototype.toString;
+    SIMD.Bool8x16.prototype.toString = function() {
+        G = this;
+        return "NEWTOSTRING";
+    }
+
+    equal("undefined", typeof(G));
+    equal("NEWTOSTRING", sf0.toString());
+    equal("object", typeof(G));
+    equal("NEWTOSTRING", G.toString());
+    equal("NEWTOSTRING", sf0.toString());
+    SIMD.Bool8x16.prototype.toString = origFn;
+}
+
+function testProtoLinking()
+{
+    ///////////////////
+    //Inheritance 
+    ///////////////////
+    SIMD.Bool8x16.prototype.myToString = function() {
+        return "MYTOSTRING";
+    }
+    equal("MYTOSTRING", sf0.myToString());
+    equal("MYTOSTRING", G.myToString());
+
+    ///////////////////
+    //PrototypeLinking valueOf
+    ///////////////////
+    SIMD.Bool8x16.prototype.valueOf = function() {
+        G1 = this;
+        return  "NEWVALUEOF";
+    }
+
+    var G1;
+    equal("undefined", typeof(G1));
+    equal("NEWVALUEOF", sf0.valueOf());
+    equal("object", typeof(G1));
+    equal("NEWVALUEOF", G1.valueOf());
+    equal("NEWVALUEOF", sf0.valueOf());
+}
+
+function testValueSemantics() 
+{
+    ///////////////////
+    //Value semantics
+    ///////////////////
+    equal(true, (sf0 == sf0));
+    equal(true, (sf0 === sf0));
+    equal(true, (sf0 == sf1));
+    equal(true, (sf0 === sf1));
+    equal(true, (sf0 == sf2));
+    equal(true, (sf0 === sf2));
+
+    ///////////////////
+    //Comparision
+    //////////////////
+    try{var x = sf0 > sf1;}
+    catch(e)
+    {equal("TypeError: SIMD type: cannot be converted to a number", e);}
+
+    try{var x = sf0 < sf1;}
+    catch(e)
+    {equal("TypeError: SIMD type: cannot be converted to a number", e);}
+
+    try{var x = sf0 >= sf1;}
+    catch(e)
+    {equal("TypeError: SIMD type: cannot be converted to a number", e);}
+
+    try{var x = sf0 <= sf1;}
+    catch(e)
+    {equal("TypeError: SIMD type: cannot be converted to a number", e);}
+
+    ///////////////////////
+    //Arithmetic operators
+    ///////////////////////
+
+    equal("SIMD.Bool8x16(false, true, false, false, false, true, false, false, false, true, false, false, false, true, false, false)test", sf3 + "test");
+    equal("testSIMD.Bool8x16(false, true, false, false, false, true, false, false, false, true, false, false, false, true, false, false)", "test" + sf3);
+
+    try{var x =  sf3 + sf3;}
+    catch(e)
+    {equal("Error: Number expected", e);} //Check
+    
+    try{var x =  sf3 - sf3;}
+    catch(e)
+    {equal("Error: Number expected", e);} 
+    
+    try{var x =  sf3 / sf3;}
+    catch(e)
+    {equal("Error: Number expected", e);} 
+    
+    try{var x =  sf3 * sf3;}
+    catch(e)
+    {equal("Error: Number expected", e);}
+}
+
+//The following test can be enabled when extract lane builtin for bools are merged. 
+// function testHorizontalOR()
+// {
+//     var b1 = SIMD.Bool8x16(true, false, false, true);
+//
+//     SIMD.Bool8x16.prototype.horizontalOR = function()
+//     {
+//         var b4 = this.valueOf();
+//         return (SIMD.Bool8x16.extractLane(b4, 0) ||
+//                 SIMD.Bool8x16.extractLane(b4, 1) ||
+//                 SIMD.Bool8x16.extractLane(b4, 2) ||
+//                 SIMD.Bool8x16.extractLane(b4, 3) );
+//      }
+//
+//      equal(true, b1.horizontalOR());
+// }
+
+function testWrapperObject() 
+{
+
+    testConstructor();
+    testToStringTag();
+    testToPrimitive();
+    testValueOf();
+    testToString_LocaleString();
+    testProtoLinking();
+    testValueSemantics();
+    // testHorizontalOR()
+}
+
+testWrapperObject();
+print("PASS");

+ 305 - 0
test/SIMD.wrappers/testFloat32x4.js

@@ -0,0 +1,305 @@
+//-------------------------------------------------------------------------------------------------------
+// Copyright (C) Microsoft. All rights reserved.
+// Licensed under the MIT license. See LICENSE.txt file in the project root for full license information.
+//-------------------------------------------------------------------------------------------------------
+this.WScript.LoadScriptFile("..\\UnitTestFramework\\SimdJsHelpers.js");
+
+var sf0 = SIMD.Float32x4(1.35, -2.0, 3.4, 0.0);
+var sf1 = SIMD.Float32x4(1.35, -2.0, 3.4, 0.0);
+var sf2 = SIMD.Float32x4(1.35, -2.0, 3.14, 0.0);
+var sf3 = SIMD.Float32x4(0, Infinity, NaN, -0);
+
+function testConstructor()
+{
+    ////////////////////
+    //Constructor
+    ///////////////////
+    equal("object", typeof SIMD.Float32x4.prototype);
+    equal("function", typeof SIMD.Float32x4.prototype.constructor);
+    equal("function", typeof SIMD.Float32x4.prototype.toString);
+    equal("function", typeof SIMD.Float32x4.prototype.toLocaleString);
+    equal("function", typeof SIMD.Float32x4.prototype.valueOf);
+    equal(SIMD.Float32x4, SIMD.Float32x4.prototype.constructor);
+
+    descriptor = Object.getOwnPropertyDescriptor(SIMD.Float32x4, 'prototype');
+    equal(false, descriptor.writable);
+    equal(false, descriptor.enumerable);
+    equal(false, descriptor.configurable); 
+}
+
+function testToStringTag()
+{
+    ///////////////////
+    //SIMDConstructor.prototype [ @@toStringTag ]
+    ///////////////////
+    var sym = Symbol('sym');
+    var symbol_object = Object(sym);
+    equal("SIMD.Float32x4", SIMD.Float32x4.prototype[Symbol.toStringTag]);
+
+    descriptor = Object.getOwnPropertyDescriptor(SIMD.Float32x4.prototype, Symbol.toStringTag);
+    equal(false, descriptor.writable);
+    equal(false, descriptor.enumerable);
+    equal(true, descriptor.configurable);
+}
+
+function testToPrimitive()
+{
+    ///////////////////
+    //SIMDConstructor.prototype [ @@toPrimitive ] 
+    ///////////////////
+    equal("function",typeof SIMD.Float32x4.prototype[Symbol.toPrimitive]);
+    equal(1, SIMD.Float32x4.prototype[Symbol.toPrimitive].length);
+
+    descriptor = Object.getOwnPropertyDescriptor(SIMD.Float32x4.prototype, Symbol.toPrimitive);
+    equal(false, descriptor.writable);
+    equal(false, descriptor.enumerable);
+    equal(true, descriptor.configurable);
+
+    var functionToString = SIMD.Float32x4.prototype[Symbol.toPrimitive].toString();
+    var actualName = functionToString.substring(9, functionToString.indexOf('('));
+    equal("[Symbol.toPrimitive]",actualName);
+
+    ///////////////////////////
+    //Overriding @@ToPrimitive
+    ///////////////////////////
+    SIMD.Float32x4.prototype[Symbol.toPrimitive] = undefined;
+    var G;
+    var functionBackup = SIMD.Float32x4.prototype.toLocaleString;
+    SIMD.Float32x4.prototype.toLocaleString = function(){
+        G = this;
+    }
+    sf0.toLocaleString();
+    try{var x =  G + G;}
+    catch(e)
+    {equal("Error: Number expected", e);}  //@@toPrimitive is not writable
+
+    //@@toPrimitive is configurable. 
+    memberBackup = Object.getOwnPropertyDescriptor(SIMD.Float32x4.prototype, Symbol.toPrimitive);
+    delete SIMD.Float32x4.prototype[Symbol.toPrimitive];
+    SIMD.Float32x4.prototype[Symbol.toPrimitive] = function() { return 1;}
+    equal(2, G + G);
+    equal(0, G - G);
+    equal(1, G * G);
+    equal(1, G / G);
+    equal(true, G == G);
+    equal(true, G === G);
+    equal(false, G > G);
+    equal(true, G >= G);
+    equal(false, G < G);
+    equal(true, G >= G);
+
+    delete SIMD.Float32x4.prototype[Symbol.toPrimitive];
+    SIMD.Float32x4.prototype[Symbol.toPrimitive] = function() { return undefined;}
+    equal(NaN, G + G);
+    equal(NaN, G - G);
+    equal(NaN, G * G);
+    equal(NaN, G / G);
+    equal(true, G == G);
+    equal(true, G === G);
+    equal(false, G > G);
+    equal(false, G >= G);
+    equal(false, G < G);
+    equal(false, G >= G);
+
+    delete SIMD.Float32x4.prototype[Symbol.toPrimitive];
+    SIMD.Float32x4.prototype[Symbol.toPrimitive] = function() { return "test";}
+    equal("testtest", G + G);
+    equal(NaN, G - G);
+    equal(NaN, G * G);
+    equal(NaN, G / G);
+    equal(true, G == G);
+    equal(true, G === G);
+    equal(false, G > G);
+    equal(true, G >= G);
+    equal(false, G < G);
+    equal(true, G >= G);
+
+    delete SIMD.Float32x4.prototype[Symbol.toPrimitive];
+    SIMD.Float32x4.prototype[Symbol.toPrimitive] = 5;
+    try{var x =  G + G;}
+    catch(e)
+    {equal("TypeError: 'Symbol.toPrimitive' is not a function", e);}
+
+    SIMD.Float32x4.prototype[Symbol.toPrimitive] = memberBackup;
+    SIMD.Float32x4.prototype.toLocaleString = functionBackup
+}
+
+function testValueOf()
+{
+    ///////////////////
+    //ValueOf
+    ///////////////////
+    descriptor = Object.getOwnPropertyDescriptor(SIMD.Float32x4.prototype, 'valueOf');
+    equal(true, descriptor.writable);
+    equal(false, descriptor.enumerable);
+    equal(true, descriptor.configurable);
+    equal("float32x4", typeof sf0.valueOf());
+    equal("SIMD.Float32x4(1.350000023841858, -2, 3.4000000953674316, 0)", (sf0.valueOf()).toString());
+}
+
+function testToString_LocaleString()
+{
+    ///////////////////
+    //ToString / ToLocaleString
+    ///////////////////
+    descriptor = Object.getOwnPropertyDescriptor(SIMD.Float32x4.prototype, 'toString');
+    equal(true, descriptor.writable);
+    equal(false, descriptor.enumerable);
+    equal(true, descriptor.configurable);
+
+    descriptor = Object.getOwnPropertyDescriptor(SIMD.Float32x4.prototype, 'toLocaleString');
+    equal(true, descriptor.writable);
+    equal(false, descriptor.enumerable);
+    equal(true, descriptor.configurable);
+
+    equal("SIMD.Float32x4(1.350000023841858, -2, 3.4000000953674316, 0)", sf0.toString()); //If float use ToString on lanes, the right values will be available.
+    equal("SIMD.Float32x4(1.35, -2, 3.4, 0)", sf0.toLocaleString());
+    
+    equal("SIMD.Float32x4(0, Infinity, NaN, 0)", sf3.toString()); 
+    // equal("SIMD.Float32x4(0, ?, NaN, 0)", sf3.toLocaleString());   //The results match but comparison fails due to '?'
+    var actual =  SIMD.Float32x4.prototype.toLocaleString ;
+    var G5;
+    SIMD.Float32x4.prototype.toLocaleString = function() {
+        G5 = this;
+        return "NEWTOSTRING";
+    }
+
+    equal("undefined", typeof(G5));
+    equal("NEWTOSTRING", sf0.toLocaleString());
+    equal("object", typeof(G5));
+    equal("NEWTOSTRING", G5.toLocaleString());
+    equal("NEWTOSTRING", sf0.toLocaleString());
+    SIMD.Float32x4.prototype.toLocaleString = actual;
+
+    ///////////////////
+    //PrototypeLinking toString
+    ///////////////////
+    actual = SIMD.Float32x4.prototype.toString;
+    SIMD.Float32x4.prototype.toString = function() {
+        G = this;
+        return "NEWTOSTRING";
+    }
+
+    equal("undefined", typeof(G));
+    equal("NEWTOSTRING", sf0.toString());
+    equal("object", typeof(G));
+    equal("NEWTOSTRING", G.toString());
+    equal("NEWTOSTRING", sf0.toString());
+    SIMD.Float32x4.prototype.toString = actual;
+}
+
+function testProtoLinking()
+{
+    ///////////////////
+    //Inheritance 
+    ///////////////////
+    SIMD.Float32x4.prototype.myToString = function() {
+        return "MYTOSTRING";
+    }
+    equal("MYTOSTRING", sf0.myToString());
+    equal("MYTOSTRING", G.myToString());
+
+    ///////////////////
+    //PrototypeLinking valueOf
+    ///////////////////
+    var actual = SIMD.Float32x4.prototype.valueOf;
+    SIMD.Float32x4.prototype.valueOf = function() {
+        G1 = this;
+        return  "NEWVALUEOF";
+    }
+
+    var G1;
+    equal("undefined", typeof(G1));
+    equal("NEWVALUEOF", sf0.valueOf());
+    equal("object", typeof(G1));
+    equal("NEWVALUEOF", G1.valueOf());
+    equal("NEWVALUEOF", sf0.valueOf());
+    SIMD.Float32x4.prototype.valueOf = actual;
+}
+
+function testValueSemantics() 
+{
+    ///////////////////
+    //Value semantics
+    ///////////////////
+    equal(true, (sf0 == sf0));
+    equal(true, (sf0 === sf0));
+    equal(true, (sf0 == sf1));
+    equal(true, (sf0 === sf1));
+    equal(false, (sf0 == sf2));
+    equal(false, (sf0 === sf2));
+
+    ///////////////////
+    //Comparision
+    //////////////////
+    try{var x = sf0 > sf1;}
+    catch(e)
+    {equal("TypeError: SIMD type: cannot be converted to a number", e);}
+
+    try{var x = sf0 < sf1;}
+    catch(e)
+    {equal("TypeError: SIMD type: cannot be converted to a number", e);}
+
+    try{var x = sf0 >= sf1;}
+    catch(e)
+    {equal("TypeError: SIMD type: cannot be converted to a number", e);}
+
+    try{var x = sf0 <= sf1;}
+    catch(e)
+    {equal("TypeError: SIMD type: cannot be converted to a number", e);}
+
+    ///////////////////////
+    //Arithmetic operators
+    ///////////////////////
+
+    equal("SIMD.Float32x4(0, Infinity, NaN, 0)test", sf3 + "test");
+    equal("testSIMD.Float32x4(0, Infinity, NaN, 0)", "test" + sf3);
+
+    try{var x =  sf3 + sf3;}
+    catch(e)
+    {equal("Error: Number expected", e);} //Check
+
+    try{var x =  sf3 - sf3;}
+    catch(e)
+    {equal("Error: Number expected", e);} 
+
+    try{var x =  sf3 / sf3;}
+    catch(e)
+    {equal("Error: Number expected", e);} 
+
+    try{var x =  sf3 * sf3;}
+    catch(e)
+    {equal("Error: Number expected", e);}
+}
+
+function testUseCase1()
+{
+    var f4val = SIMD.Float32x4(0.0, 1.0, 2.0, 3.0);
+    SIMD.Float32x4.prototype.horizontalSum = function()
+    {
+        var value = this.valueOf();
+        var sum = SIMD.Float32x4.extractLane(value, 0) +
+                  SIMD.Float32x4.extractLane(value, 1) +
+                  SIMD.Float32x4.extractLane(value, 2) +
+                  SIMD.Float32x4.extractLane(value, 3);
+        return sum;
+    }
+
+    equal(6, f4val.horizontalSum());
+}
+
+function testWrapperObject() 
+{
+
+    testConstructor();
+    testToStringTag();
+    testToPrimitive();
+    testValueOf();
+    testToString_LocaleString();
+    testProtoLinking();
+    testValueSemantics();
+    testUseCase1();
+}
+
+testWrapperObject();
+print("PASS");

+ 308 - 0
test/SIMD.wrappers/testInt16x8.js

@@ -0,0 +1,308 @@
+//-------------------------------------------------------------------------------------------------------
+// Copyright (C) Microsoft. All rights reserved.
+// Licensed under the MIT license. See LICENSE.txt file in the project root for full license information.
+//-------------------------------------------------------------------------------------------------------
+this.WScript.LoadScriptFile("..\\UnitTestFramework\\SimdJsHelpers.js");
+
+var sf0 = SIMD.Int16x8(1, -2, 3, 0, 1, -2, 3, 0);
+var sf1 = SIMD.Int16x8(1, -2, 3, 0, 1, -2, 3, 0);
+var sf2 = SIMD.Int16x8(1, -2, 13, 0, 1, -2, 13, 0);
+var sf3 = SIMD.Int16x8(0, Infinity, NaN, -0, 0, Infinity, NaN, -0);
+
+function testConstructor()
+{
+    ////////////////////
+    //Constructor
+    ///////////////////
+    equal("object", typeof SIMD.Int16x8.prototype);
+    equal("function", typeof SIMD.Int16x8.prototype.constructor);
+    equal("function", typeof SIMD.Int16x8.prototype.toString);
+    equal("function", typeof SIMD.Int16x8.prototype.toLocaleString);
+    equal("function", typeof SIMD.Int16x8.prototype.valueOf);
+    equal(SIMD.Int16x8, SIMD.Int16x8.prototype.constructor);
+
+    descriptor = Object.getOwnPropertyDescriptor(SIMD.Int16x8, 'prototype');
+    equal(false, descriptor.writable);
+    equal(false, descriptor.enumerable);
+    equal(false, descriptor.configurable); 
+}
+
+function testToStringTag()
+{
+    ///////////////////
+    //SIMDConstructor.prototype [ @@toStringTag ]
+    ///////////////////
+    var sym = Symbol('sym');
+    var symbol_object = Object(sym);
+    equal("SIMD.Int16x8", SIMD.Int16x8.prototype[Symbol.toStringTag]);
+
+    descriptor = Object.getOwnPropertyDescriptor(SIMD.Int16x8.prototype, Symbol.toStringTag);
+    equal(false, descriptor.writable);
+    equal(false, descriptor.enumerable);
+    equal(true, descriptor.configurable);
+}
+
+function testToPrimitive()
+{
+    ///////////////////
+    //SIMDConstructor.prototype [ @@toPrimitive ] 
+    ///////////////////
+    equal("function",typeof SIMD.Int16x8.prototype[Symbol.toPrimitive]);
+    equal(1, SIMD.Int16x8.prototype[Symbol.toPrimitive].length);
+
+    descriptor = Object.getOwnPropertyDescriptor(SIMD.Int16x8.prototype, Symbol.toPrimitive);
+    equal(false, descriptor.writable);
+    equal(false, descriptor.enumerable);
+    equal(true, descriptor.configurable);
+
+    var functionToString = SIMD.Int16x8.prototype[Symbol.toPrimitive].toString();
+    var actualName = functionToString.substring(9, functionToString.indexOf('('));
+    equal("[Symbol.toPrimitive]",actualName);
+
+    ///////////////////////////
+    //Overriding @@ToPrimitive
+    ///////////////////////////
+    SIMD.Int16x8.prototype[Symbol.toPrimitive] = undefined;
+    var G;
+    var functionBackup = SIMD.Int16x8.prototype.toLocaleString;
+    SIMD.Int16x8.prototype.toLocaleString = function(){
+        G = this;
+    }
+    sf0.toLocaleString();
+    try{var x =  G + G;}
+    catch(e)
+    {equal("Error: Number expected", e);}  //@@toPrimitive is not writable
+
+    //@@toPrimitive is configurable. 
+    memberBackup = Object.getOwnPropertyDescriptor(SIMD.Int16x8.prototype, Symbol.toPrimitive);
+    delete SIMD.Int16x8.prototype[Symbol.toPrimitive];
+    SIMD.Int16x8.prototype[Symbol.toPrimitive] = function() { return 1;}
+    equal(2, G + G);
+    equal(0, G - G);
+    equal(1, G * G);
+    equal(1, G / G);
+    equal(true, G == G);
+    equal(true, G === G);
+    equal(false, G > G);
+    equal(true, G >= G);
+    equal(false, G < G);
+    equal(true, G >= G);
+
+    delete SIMD.Int16x8.prototype[Symbol.toPrimitive];
+    SIMD.Int16x8.prototype[Symbol.toPrimitive] = function() { return undefined;}
+    equal(NaN, G + G);
+    equal(NaN, G - G);
+    equal(NaN, G * G);
+    equal(NaN, G / G);
+    equal(true, G == G);
+    equal(true, G === G);
+    equal(false, G > G);
+    equal(false, G >= G);
+    equal(false, G < G);
+    equal(false, G >= G);
+
+    delete SIMD.Int16x8.prototype[Symbol.toPrimitive];
+    SIMD.Int16x8.prototype[Symbol.toPrimitive] = function() { return "test";}
+    equal("testtest", G + G);
+    equal(NaN, G - G);
+    equal(NaN, G * G);
+    equal(NaN, G / G);
+    equal(true, G == G);
+    equal(true, G === G);
+    equal(false, G > G);
+    equal(true, G >= G);
+    equal(false, G < G);
+    equal(true, G >= G);
+
+    delete SIMD.Int16x8.prototype[Symbol.toPrimitive];
+    SIMD.Int16x8.prototype[Symbol.toPrimitive] = 5;
+    try{var x =  G + G;}
+    catch(e)
+    {equal("TypeError: 'Symbol.toPrimitive' is not a function", e);}
+
+    SIMD.Int16x8.prototype[Symbol.toPrimitive] = memberBackup;
+    SIMD.Int16x8.prototype.toLocaleString = functionBackup
+}
+
+function testValueOf()
+{
+    ///////////////////
+    //ValueOf
+    ///////////////////
+    descriptor = Object.getOwnPropertyDescriptor(SIMD.Int16x8.prototype, 'valueOf');
+    equal(true, descriptor.writable);
+    equal(false, descriptor.enumerable);
+    equal(true, descriptor.configurable);
+    equal("int16x8", typeof sf0.valueOf());
+    equal("SIMD.Int16x8(1, -2, 3, 0, 1, -2, 3, 0)",sf0.valueOf().toString());
+}
+
+function testToString_LocaleString()
+{
+    ///////////////////
+    //ToString / ToLocaleString
+    ///////////////////
+    descriptor = Object.getOwnPropertyDescriptor(SIMD.Int16x8.prototype, 'toString');
+    equal(true, descriptor.writable);
+    equal(false, descriptor.enumerable);
+    equal(true, descriptor.configurable);
+
+    descriptor = Object.getOwnPropertyDescriptor(SIMD.Int16x8.prototype, 'toLocaleString');
+    equal(true, descriptor.writable);
+    equal(false, descriptor.enumerable);
+    equal(true, descriptor.configurable);
+    
+    equal("SIMD.Int16x8(1, -2, 3, 0, 1, -2, 3, 0)", sf0.toString()); //If float use ToString on lanes, the right values will be available.
+    equal("SIMD.Int16x8(1, -2, 3, 0, 1, -2, 3, 0)", sf0.toLocaleString());
+    equal("SIMD.Int16x8(0, 0, 0, 0, 0, 0, 0, 0)", sf3.toString()); 
+    // equal("SIMD.Int16x8(0, ?, NaN, 0)", sf3.toLocaleString());   //How should this work?
+    var functionBackup = SIMD.Int16x8.prototype.toLocaleString;
+    var G5;
+    SIMD.Int16x8.prototype.toLocaleString = function() {
+        G5 = this;
+        return "NEWTOSTRING";
+    }
+
+    equal("undefined", typeof(G5));
+    equal("NEWTOSTRING", sf0.toLocaleString());
+    equal("object", typeof(G5));
+    equal("NEWTOSTRING", G5.toLocaleString());
+    equal("NEWTOSTRING", sf0.toLocaleString());
+    SIMD.Int16x8.prototype.toLocaleString  = functionBackup;
+
+    ///////////////////
+    //PrototypeLinking toString
+    ///////////////////
+    functionBackup = SIMD.Int16x8.prototype.toString;
+    SIMD.Int16x8.prototype.toString = function() {
+        G = this;
+        return "NEWTOSTRING";
+    }
+
+    equal("undefined", typeof(G));
+    equal("NEWTOSTRING", sf0.toString());
+    equal("object", typeof(G));
+    equal("NEWTOSTRING", G.toString());
+    equal("NEWTOSTRING", sf0.toString());
+    SIMD.Int16x8.prototype.toString = functionBackup;
+}
+
+function testProtoLinking()
+{
+    ///////////////////
+    //Inheritance 
+    ///////////////////
+    SIMD.Int16x8.prototype.myToString = function() {
+        return "MYTOSTRING";
+    }
+    equal("MYTOSTRING", sf0.myToString());
+    equal("MYTOSTRING", G.myToString());
+
+    ///////////////////
+    //PrototypeLinking valueOf
+    ///////////////////
+    var functionBackup = SIMD.Int16x8.prototype.valueOf;
+    SIMD.Int16x8.prototype.valueOf = function() {
+        G1 = this;
+        return  "NEWVALUEOF";
+    }
+
+    var G1;
+    equal("undefined", typeof(G1));
+    equal("NEWVALUEOF", sf0.valueOf());
+    equal("object", typeof(G1));
+    equal("NEWVALUEOF", G1.valueOf());
+    equal("NEWVALUEOF", sf0.valueOf());
+    SIMD.Int16x8.prototype.valueOf = functionBackup;
+}
+
+function testValueSemantics() 
+{
+    ///////////////////
+    //Value semantics
+    ///////////////////
+    equal(true, (sf0 == sf0));
+    equal(true, (sf0 === sf0));
+    equal(true, (sf0 == sf1));
+    equal(true, (sf0 === sf1));
+    equal(false, (sf0 == sf2));
+    equal(false, (sf0 === sf2));
+
+    ///////////////////
+    //Comparision
+    //////////////////
+    try{var x = sf0 > sf1;}
+    catch(e)
+    {equal("TypeError: SIMD type: cannot be converted to a number", e);}
+
+    try{var x = sf0 < sf1;}
+    catch(e)
+    {equal("TypeError: SIMD type: cannot be converted to a number", e);}
+
+    try{var x = sf0 >= sf1;}
+    catch(e)
+    {equal("TypeError: SIMD type: cannot be converted to a number", e);}
+
+    try{var x = sf0 <= sf1;}
+    catch(e)
+    {equal("TypeError: SIMD type: cannot be converted to a number", e);}
+
+    ///////////////////////
+    //Arithmetic operators
+    ///////////////////////
+
+    equal("SIMD.Int16x8(0, 0, 0, 0, 0, 0, 0, 0)test", sf3 + "test");
+    equal("testSIMD.Int16x8(0, 0, 0, 0, 0, 0, 0, 0)", "test" + sf3);
+
+    try{var x =  sf3 + sf3;}
+    catch(e)
+    {equal("Error: Number expected", e);} //Check
+
+    try{var x =  sf3 - sf3;}
+    catch(e)
+    {equal("Error: Number expected", e);} 
+
+    try{var x =  sf3 / sf3;}
+    catch(e)
+    {equal("Error: Number expected", e);} 
+
+    try{var x =  sf3 * sf3;}
+    catch(e)
+    {equal("Error: Number expected", e);}
+}
+
+function testUseCase1()
+{
+    var f4val = SIMD.Int16x8(0, 1, 2, -3, 0, 1, 2, -3);
+    SIMD.Int16x8.prototype.horizontalSum = function()
+    {
+        var value = this.valueOf();
+        var sum = SIMD.Int16x8.extractLane(value, 0) +
+                  SIMD.Int16x8.extractLane(value, 1) +
+                  SIMD.Int16x8.extractLane(value, 2) +
+                  SIMD.Int16x8.extractLane(value, 3) +
+                  SIMD.Int16x8.extractLane(value, 4) +
+                  SIMD.Int16x8.extractLane(value, 5) +
+                  SIMD.Int16x8.extractLane(value, 6) +
+                  SIMD.Int16x8.extractLane(value, 7);
+        return sum;
+    }
+
+    equal(0, f4val.horizontalSum());
+}
+
+function testWrapperObject() 
+{
+
+    testConstructor();
+    testToStringTag();
+    testToPrimitive();
+    testValueOf();
+    testToString_LocaleString();
+    testProtoLinking();
+    testValueSemantics();
+    testUseCase1()
+}
+
+testWrapperObject();
+print("PASS");

+ 305 - 0
test/SIMD.wrappers/testInt32x4.js

@@ -0,0 +1,305 @@
+//-------------------------------------------------------------------------------------------------------
+// Copyright (C) Microsoft. All rights reserved.
+// Licensed under the MIT license. See LICENSE.txt file in the project root for full license information.
+//-------------------------------------------------------------------------------------------------------
+this.WScript.LoadScriptFile("..\\UnitTestFramework\\SimdJsHelpers.js");
+
+var sf0 = SIMD.Int32x4(1, -2, 3, 0);
+var sf1 = SIMD.Int32x4(1, -2, 3, 0);
+var sf2 = SIMD.Int32x4(1, -2, 13, 0);
+var sf3 = SIMD.Int32x4(0, Infinity, NaN, -0);
+
+function testConstructor()
+{
+    ////////////////////
+    //Constructor
+    ///////////////////
+    equal("object", typeof SIMD.Int32x4.prototype);
+    equal("function", typeof SIMD.Int32x4.prototype.constructor);
+    equal("function", typeof SIMD.Int32x4.prototype.toString);
+    equal("function", typeof SIMD.Int32x4.prototype.toLocaleString);
+    equal("function", typeof SIMD.Int32x4.prototype.valueOf);
+    equal(SIMD.Int32x4, SIMD.Int32x4.prototype.constructor);
+
+    descriptor = Object.getOwnPropertyDescriptor(SIMD.Int32x4, 'prototype');
+    equal(false, descriptor.writable);
+    equal(false, descriptor.enumerable);
+    equal(false, descriptor.configurable); 
+}
+
+function testToStringTag()
+{
+    ///////////////////
+    //SIMDConstructor.prototype [ @@toStringTag ]
+    ///////////////////
+    var sym = Symbol('sym');
+    var symbol_object = Object(sym);
+    equal("SIMD.Int32x4", SIMD.Int32x4.prototype[Symbol.toStringTag]);
+
+    descriptor = Object.getOwnPropertyDescriptor(SIMD.Int32x4.prototype, Symbol.toStringTag);
+    equal(false, descriptor.writable);
+    equal(false, descriptor.enumerable);
+    equal(true, descriptor.configurable);
+}
+
+function testToPrimitive()
+{
+    ///////////////////
+    //SIMDConstructor.prototype [ @@toPrimitive ] 
+    ///////////////////
+    equal("function",typeof SIMD.Int32x4.prototype[Symbol.toPrimitive]);
+    equal(1, SIMD.Int32x4.prototype[Symbol.toPrimitive].length);
+
+    descriptor = Object.getOwnPropertyDescriptor(SIMD.Int32x4.prototype, Symbol.toPrimitive);
+    equal(false, descriptor.writable);
+    equal(false, descriptor.enumerable);
+    equal(true, descriptor.configurable);
+
+    var functionToString = SIMD.Int32x4.prototype[Symbol.toPrimitive].toString();
+    var actualName = functionToString.substring(9, functionToString.indexOf('('));
+    equal("[Symbol.toPrimitive]",actualName);
+
+    ///////////////////////////
+    //Overriding @@ToPrimitive
+    ///////////////////////////
+    SIMD.Int32x4.prototype[Symbol.toPrimitive] = undefined;
+    var G;
+    var functionBackup = SIMD.Int32x4.prototype.toLocaleString;
+    SIMD.Int32x4.prototype.toLocaleString = function(){
+        G = this;
+    }
+    sf0.toLocaleString();
+    try{var x =  G + G;}
+    catch(e)
+    {equal("Error: Number expected", e);}  //@@toPrimitive is not writable
+
+    //@@toPrimitive is configurable. 
+    memberBackup = Object.getOwnPropertyDescriptor(SIMD.Int32x4.prototype, Symbol.toPrimitive);
+    delete SIMD.Int32x4.prototype[Symbol.toPrimitive];
+    SIMD.Int32x4.prototype[Symbol.toPrimitive] = function() { return 1;}
+    equal(2, G + G);
+    equal(0, G - G);
+    equal(1, G * G);
+    equal(1, G / G);
+    equal(true, G == G);
+    equal(true, G === G);
+    equal(false, G > G);
+    equal(true, G >= G);
+    equal(false, G < G);
+    equal(true, G >= G);
+
+    delete SIMD.Int32x4.prototype[Symbol.toPrimitive];
+    SIMD.Int32x4.prototype[Symbol.toPrimitive] = function() { return undefined;}
+    equal(NaN, G + G);
+    equal(NaN, G - G);
+    equal(NaN, G * G);
+    equal(NaN, G / G);
+    equal(true, G == G);
+    equal(true, G === G);
+    equal(false, G > G);
+    equal(false, G >= G);
+    equal(false, G < G);
+    equal(false, G >= G);
+
+    delete SIMD.Int32x4.prototype[Symbol.toPrimitive];
+    SIMD.Int32x4.prototype[Symbol.toPrimitive] = function() { return "test";}
+    equal("testtest", G + G);
+    equal(NaN, G - G);
+    equal(NaN, G * G);
+    equal(NaN, G / G);
+    equal(true, G == G);
+    equal(true, G === G);
+    equal(false, G > G);
+    equal(true, G >= G);
+    equal(false, G < G);
+    equal(true, G >= G);
+
+    delete SIMD.Int32x4.prototype[Symbol.toPrimitive];
+    SIMD.Int32x4.prototype[Symbol.toPrimitive] = 5;
+    try{var x =  G + G;}
+    catch(e)
+    {equal("TypeError: 'Symbol.toPrimitive' is not a function", e);}
+
+    SIMD.Int32x4.prototype[Symbol.toPrimitive] = memberBackup;
+    SIMD.Int32x4.prototype.toLocaleString = functionBackup
+}
+
+function testValueOf()
+{
+    ///////////////////
+    //ValueOf
+    ///////////////////
+    descriptor = Object.getOwnPropertyDescriptor(SIMD.Int32x4.prototype, 'valueOf');
+    equal(true, descriptor.writable);
+    equal(false, descriptor.enumerable);
+    equal(true, descriptor.configurable);
+    equal("int32x4", typeof sf0.valueOf());
+    equal("SIMD.Int32x4(1, -2, 3, 0)",sf0.valueOf().toString());
+}
+
+function testToString_LocaleString()
+{
+    ///////////////////
+    //ToString / ToLocaleString
+    ///////////////////
+    descriptor = Object.getOwnPropertyDescriptor(SIMD.Int32x4.prototype, 'toString');
+    equal(true, descriptor.writable);
+    equal(false, descriptor.enumerable);
+    equal(true, descriptor.configurable);
+
+    descriptor = Object.getOwnPropertyDescriptor(SIMD.Int32x4.prototype, 'toLocaleString');
+    equal(true, descriptor.writable);
+    equal(false, descriptor.enumerable);
+    equal(true, descriptor.configurable);
+
+    equal("SIMD.Int32x4(1, -2, 3, 0)", sf0.toString()); //If float use ToString on lanes, the right values will be available.
+    equal("SIMD.Int32x4(1, -2, 3, 0)", sf0.toLocaleString());
+
+    equal("SIMD.Int32x4(0, 0, 0, 0)", sf3.toString()); 
+    // equal("SIMD.Int32x4(0, ?, NaN, 0)", sf3.toLocaleString());   //How should this work?
+    var functionBackup = SIMD.Int32x4.prototype.toLocaleString;
+    var G5;
+    SIMD.Int32x4.prototype.toLocaleString = function() {
+        G5 = this;
+        return "NEWTOSTRING";
+    }
+
+    equal("undefined", typeof(G5));
+    equal("NEWTOSTRING", sf0.toLocaleString());
+    equal("object", typeof(G5));
+    equal("NEWTOSTRING", G5.toLocaleString());
+    equal("NEWTOSTRING", sf0.toLocaleString());
+    SIMD.Int32x4.prototype.toLocaleString  = functionBackup;
+
+    ///////////////////
+    //PrototypeLinking toString
+    ///////////////////
+    functionBackup = SIMD.Int32x4.prototype.toString;
+    SIMD.Int32x4.prototype.toString = function() {
+        G = this;
+        return "NEWTOSTRING";
+    }
+
+    equal("undefined", typeof(G));
+    equal("NEWTOSTRING", sf0.toString());
+    equal("object", typeof(G));
+    equal("NEWTOSTRING", G.toString());
+    equal("NEWTOSTRING", sf0.toString());
+    SIMD.Int32x4.prototype.toString = functionBackup;
+}
+
+function testProtoLinking()
+{
+    ///////////////////
+    //Inheritance 
+    ///////////////////
+    SIMD.Int32x4.prototype.myToString = function() {
+        return "MYTOSTRING";
+    }
+    equal("MYTOSTRING", sf0.myToString());
+    equal("MYTOSTRING", G.myToString());
+
+    ///////////////////
+    //PrototypeLinking valueOf
+    ///////////////////
+    var functionBackup = SIMD.Int32x4.prototype.valueOf;
+    SIMD.Int32x4.prototype.valueOf = function() {
+        G1 = this;
+        return  "NEWVALUEOF";
+    }
+
+    var G1;
+    equal("undefined", typeof(G1));
+    equal("NEWVALUEOF", sf0.valueOf());
+    equal("object", typeof(G1));
+    equal("NEWVALUEOF", G1.valueOf());
+    equal("NEWVALUEOF", sf0.valueOf());
+    SIMD.Int32x4.prototype.valueOf = functionBackup;
+}
+
+function testValueSemantics() 
+{
+    ///////////////////
+    //Value semantics
+    ///////////////////
+    equal(true, (sf0 == sf0));
+    equal(true, (sf0 === sf0));
+    equal(true, (sf0 == sf1));
+    equal(true, (sf0 === sf1));
+    equal(false, (sf0 == sf2));
+    equal(false, (sf0 === sf2));
+
+    ///////////////////
+    //Comparision
+    //////////////////
+    try{var x = sf0 > sf1;}
+    catch(e)
+    {equal("TypeError: SIMD type: cannot be converted to a number", e);}
+
+    try{var x = sf0 < sf1;}
+    catch(e)
+    {equal("TypeError: SIMD type: cannot be converted to a number", e);}
+
+    try{var x = sf0 >= sf1;}
+    catch(e)
+    {equal("TypeError: SIMD type: cannot be converted to a number", e);}
+
+    try{var x = sf0 <= sf1;}
+    catch(e)
+    {equal("TypeError: SIMD type: cannot be converted to a number", e);}
+
+    ///////////////////////
+    //Arithmetic operators
+    ///////////////////////
+
+    equal("SIMD.Int32x4(0, 0, 0, 0)test", sf3 + "test");
+    equal("testSIMD.Int32x4(0, 0, 0, 0)", "test" + sf3);
+
+    try{var x =  sf3 + sf3;}
+    catch(e)
+    {equal("Error: Number expected", e);} //Check
+
+    try{var x =  sf3 - sf3;}
+    catch(e)
+    {equal("Error: Number expected", e);} 
+
+    try{var x =  sf3 / sf3;}
+    catch(e)
+    {equal("Error: Number expected", e);} 
+
+    try{var x =  sf3 * sf3;}
+    catch(e)
+    {equal("Error: Number expected", e);}
+}
+
+function testUseCase1()
+{
+    var f4val = SIMD.Int32x4(0, 1, 2, -3);
+    SIMD.Int32x4.prototype.horizontalSum = function()
+    {
+        var value = this.valueOf();
+        var sum = SIMD.Int32x4.extractLane(value, 0) +
+                  SIMD.Int32x4.extractLane(value, 1) +
+                  SIMD.Int32x4.extractLane(value, 2) +
+                  SIMD.Int32x4.extractLane(value, 3);
+        return sum;
+    }
+
+    equal(0, f4val.horizontalSum());
+}
+
+function testWrapperObject() 
+{
+
+    testConstructor();
+    testToStringTag();
+    testToPrimitive();
+    testValueOf();
+    testToString_LocaleString();
+    testProtoLinking();
+    testValueSemantics();
+    testUseCase1()
+}
+
+testWrapperObject();
+print("PASS");

+ 317 - 0
test/SIMD.wrappers/testInt8x16.js

@@ -0,0 +1,317 @@
+//-------------------------------------------------------------------------------------------------------
+// Copyright (C) Microsoft. All rights reserved.
+// Licensed under the MIT license. See LICENSE.txt file in the project root for full license information.
+//-------------------------------------------------------------------------------------------------------
+this.WScript.LoadScriptFile("..\\UnitTestFramework\\SimdJsHelpers.js");
+
+var sf0 = SIMD.Int8x16(1, -2, 3, 0, 1, -2, 3, 0, 1, -2, 3, 0, 1, -2, 3, 0);
+var sf1 = SIMD.Int8x16(1, -2, 3, 0, 1, -2, 3, 0, 1, -2, 3, 0, 1, -2, 3, 0);
+var sf2 = SIMD.Int8x16(1, -2, 13, 0, 1, -2, 13, 0, 1, -2, 13, 0, 1, -2, 13, 0);
+var sf3 = SIMD.Int8x16(0, Infinity, NaN, -0, 0, Infinity, NaN, -0, 0, Infinity, NaN, -0, 0, Infinity, NaN, -0);
+
+function testConstructor()
+{
+    ////////////////////
+    //Constructor
+    ///////////////////
+    equal("object", typeof SIMD.Int8x16.prototype);
+    equal("function", typeof SIMD.Int8x16.prototype.constructor);
+    equal("function", typeof SIMD.Int8x16.prototype.toString);
+    equal("function", typeof SIMD.Int8x16.prototype.toLocaleString);
+    equal("function", typeof SIMD.Int8x16.prototype.valueOf);
+    equal(SIMD.Int8x16, SIMD.Int8x16.prototype.constructor);
+
+    descriptor = Object.getOwnPropertyDescriptor(SIMD.Int8x16, 'prototype');
+    equal(false, descriptor.writable);
+    equal(false, descriptor.enumerable);
+    equal(false, descriptor.configurable); 
+}
+
+function testToStringTag()
+{
+    ///////////////////
+    //SIMDConstructor.prototype [ @@toStringTag ]
+    ///////////////////
+    var sym = Symbol('sym');
+    var symbol_object = Object(sym);
+    equal("SIMD.Int8x16", SIMD.Int8x16.prototype[Symbol.toStringTag]);
+
+    descriptor = Object.getOwnPropertyDescriptor(SIMD.Int8x16.prototype, Symbol.toStringTag);
+    equal(false, descriptor.writable);
+    equal(false, descriptor.enumerable);
+    equal(true, descriptor.configurable);
+}
+
+function testToPrimitive()
+{
+    ///////////////////
+    //SIMDConstructor.prototype [ @@toPrimitive ] 
+    ///////////////////
+    equal("function",typeof SIMD.Int8x16.prototype[Symbol.toPrimitive]);
+    equal(1, SIMD.Int8x16.prototype[Symbol.toPrimitive].length);
+
+    descriptor = Object.getOwnPropertyDescriptor(SIMD.Int8x16.prototype, Symbol.toPrimitive);
+    equal(false, descriptor.writable);
+    equal(false, descriptor.enumerable);
+    equal(true, descriptor.configurable);
+
+    var functionToString = SIMD.Int8x16.prototype[Symbol.toPrimitive].toString();
+    var actualName = functionToString.substring(9, functionToString.indexOf('('));
+    equal("[Symbol.toPrimitive]",actualName);
+
+    ///////////////////////////
+    //Overriding @@ToPrimitive
+    ///////////////////////////
+    SIMD.Int8x16.prototype[Symbol.toPrimitive] = undefined;
+    var G;
+    var functionBackup = SIMD.Int8x16.prototype.toLocaleString;
+    SIMD.Int8x16.prototype.toLocaleString = function(){
+        G = this;
+    }
+    sf0.toLocaleString();
+    try{var x =  G + G;}
+    catch(e)
+    {equal("Error: Number expected", e);}  //@@toPrimitive is not writable
+
+    //@@toPrimitive is configurable. 
+    memberBackup = Object.getOwnPropertyDescriptor(SIMD.Int8x16.prototype, Symbol.toPrimitive);
+    delete SIMD.Int8x16.prototype[Symbol.toPrimitive];
+    SIMD.Int8x16.prototype[Symbol.toPrimitive] = function() { return 1;}
+    equal(2, G + G);
+    equal(0, G - G);
+    equal(1, G * G);
+    equal(1, G / G);
+    equal(true, G == G);
+    equal(true, G === G);
+    equal(false, G > G);
+    equal(true, G >= G);
+    equal(false, G < G);
+    equal(true, G >= G);
+
+    delete SIMD.Int8x16.prototype[Symbol.toPrimitive];
+    SIMD.Int8x16.prototype[Symbol.toPrimitive] = function() { return undefined;}
+    equal(NaN, G + G);
+    equal(NaN, G - G);
+    equal(NaN, G * G);
+    equal(NaN, G / G);
+    equal(true, G == G);
+    equal(true, G === G);
+    equal(false, G > G);
+    equal(false, G >= G);
+    equal(false, G < G);
+    equal(false, G >= G);
+
+    delete SIMD.Int8x16.prototype[Symbol.toPrimitive];
+    SIMD.Int8x16.prototype[Symbol.toPrimitive] = function() { return "test";}
+    equal("testtest", G + G);
+    equal(NaN, G - G);
+    equal(NaN, G * G);
+    equal(NaN, G / G);
+    equal(true, G == G);
+    equal(true, G === G);
+    equal(false, G > G);
+    equal(true, G >= G);
+    equal(false, G < G);
+    equal(true, G >= G);
+
+    delete SIMD.Int8x16.prototype[Symbol.toPrimitive];
+    SIMD.Int8x16.prototype[Symbol.toPrimitive] = 5;
+    try{var x =  G + G;}
+    catch(e)
+    {equal("TypeError: 'Symbol.toPrimitive' is not a function", e);}
+
+    SIMD.Int8x16.prototype[Symbol.toPrimitive] = memberBackup;
+    SIMD.Int8x16.prototype.toLocaleString = functionBackup
+}
+
+function testValueOf()
+{
+    ///////////////////
+    //ValueOf
+    ///////////////////
+    descriptor = Object.getOwnPropertyDescriptor(SIMD.Int8x16.prototype, 'valueOf');
+    equal(true, descriptor.writable);
+    equal(false, descriptor.enumerable);
+    equal(true, descriptor.configurable);
+    equal("int8x16", typeof sf0.valueOf());
+    equal("SIMD.Int8x16(1, -2, 3, 0, 1, -2, 3, 0, 1, -2, 3, 0, 1, -2, 3, 0)",sf0.valueOf().toString());
+}
+
+function testToString_LocaleString()
+{
+    ///////////////////
+    //ToString / ToLocaleString
+    ///////////////////
+    descriptor = Object.getOwnPropertyDescriptor(SIMD.Int8x16.prototype, 'toString');
+    equal(true, descriptor.writable);
+    equal(false, descriptor.enumerable);
+    equal(true, descriptor.configurable);
+
+    descriptor = Object.getOwnPropertyDescriptor(SIMD.Int8x16.prototype, 'toLocaleString');
+    equal(true, descriptor.writable);
+    equal(false, descriptor.enumerable);
+    equal(true, descriptor.configurable);
+
+    equal("SIMD.Int8x16(1, -2, 3, 0, 1, -2, 3, 0, 1, -2, 3, 0, 1, -2, 3, 0)", sf0.toString()); 
+    equal("SIMD.Int8x16(1, -2, 3, 0, 1, -2, 3, 0, 1, -2, 3, 0, 1, -2, 3, 0)", sf0.toLocaleString());
+    
+    equal("SIMD.Int8x16(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)", sf3.toString()); 
+    equal("SIMD.Int8x16(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)", sf3.toLocaleString());
+
+    var functionBackup = SIMD.Int8x16.prototype.toLocaleString;
+    var G5;
+    SIMD.Int8x16.prototype.toLocaleString = function() {
+        G5 = this;
+        return "NEWTOSTRING";
+    }
+
+    equal("undefined", typeof(G5));
+    equal("NEWTOSTRING", sf0.toLocaleString());
+    equal("object", typeof(G5));
+    equal("NEWTOSTRING", G5.toLocaleString());
+    equal("NEWTOSTRING", sf0.toLocaleString());
+    SIMD.Int8x16.prototype.toLocaleString  = functionBackup;
+
+    ///////////////////
+    //PrototypeLinking toString
+    ///////////////////
+    functionBackup = SIMD.Int8x16.prototype.toString;
+    SIMD.Int8x16.prototype.toString = function() {
+        G = this;
+        return "NEWTOSTRING";
+    }
+
+    equal("undefined", typeof(G));
+    equal("NEWTOSTRING", sf0.toString());
+    equal("object", typeof(G));
+    equal("NEWTOSTRING", G.toString());
+    equal("NEWTOSTRING", sf0.toString());
+    SIMD.Int8x16.prototype.toString = functionBackup;
+}
+
+function testProtoLinking()
+{
+    ///////////////////
+    //Inheritance 
+    ///////////////////
+    SIMD.Int8x16.prototype.myToString = function() {
+        return "MYTOSTRING";
+    }
+    equal("MYTOSTRING", sf0.myToString());
+    equal("MYTOSTRING", G.myToString());
+
+    ///////////////////
+    //PrototypeLinking valueOf
+    ///////////////////
+    var functionBackup = SIMD.Int8x16.prototype.valueOf;
+    SIMD.Int8x16.prototype.valueOf = function() {
+        G1 = this;
+        return  "NEWVALUEOF";
+    }
+
+    var G1;
+    equal("undefined", typeof(G1));
+    equal("NEWVALUEOF", sf0.valueOf());
+    equal("object", typeof(G1));
+    equal("NEWVALUEOF", G1.valueOf());
+    equal("NEWVALUEOF", sf0.valueOf());
+    SIMD.Int8x16.prototype.valueOf = functionBackup;
+}
+
+function testValueSemantics() 
+{
+    ///////////////////
+    //Value semantics
+    ///////////////////
+    equal(true, (sf0 == sf0));
+    equal(true, (sf0 === sf0));
+    equal(true, (sf0 == sf1));
+    equal(true, (sf0 === sf1));
+    equal(false, (sf0 == sf2));
+    equal(false, (sf0 === sf2));
+
+    ///////////////////
+    //Comparision
+    //////////////////
+    try{var x = sf0 > sf1;}
+    catch(e)
+    {equal("TypeError: SIMD type: cannot be converted to a number", e);}
+
+    try{var x = sf0 < sf1;}
+    catch(e)
+    {equal("TypeError: SIMD type: cannot be converted to a number", e);}
+
+    try{var x = sf0 >= sf1;}
+    catch(e)
+    {equal("TypeError: SIMD type: cannot be converted to a number", e);}
+
+    try{var x = sf0 <= sf1;}
+    catch(e)
+    {equal("TypeError: SIMD type: cannot be converted to a number", e);}
+
+    ///////////////////////
+    //Arithmetic operators
+    ///////////////////////
+
+    equal("SIMD.Int8x16(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)test", sf3 + "test");
+    equal("testSIMD.Int8x16(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)", "test" + sf3);
+
+    try{var x =  sf3 + sf3;}
+    catch(e)
+    {equal("Error: Number expected", e);} //Check
+
+    try{var x =  sf3 - sf3;}
+    catch(e)
+    {equal("Error: Number expected", e);} 
+
+    try{var x =  sf3 / sf3;}
+    catch(e)
+    {equal("Error: Number expected", e);} 
+
+    try{var x =  sf3 * sf3;}
+    catch(e)
+    {equal("Error: Number expected", e);}
+}
+
+function testUseCase1()
+{
+    var f4val = SIMD.Int8x16(0, 1, 2, -3, 0, 1, 2, -3, 0, 1, 2, -3, 0, 1, 2, -3);
+    SIMD.Int8x16.prototype.horizontalSum = function()
+    {
+        var value = this.valueOf();
+        var sum = SIMD.Int8x16.extractLane(value, 0) +
+                  SIMD.Int8x16.extractLane(value, 1) +
+                  SIMD.Int8x16.extractLane(value, 2) +
+                  SIMD.Int8x16.extractLane(value, 3) +
+                  SIMD.Int8x16.extractLane(value, 4) +
+                  SIMD.Int8x16.extractLane(value, 5) +
+                  SIMD.Int8x16.extractLane(value, 6) +
+                  SIMD.Int8x16.extractLane(value, 7) +
+                  SIMD.Int8x16.extractLane(value, 8) +
+                  SIMD.Int8x16.extractLane(value, 9) +
+                  SIMD.Int8x16.extractLane(value, 10) +
+                  SIMD.Int8x16.extractLane(value, 11) +
+                  SIMD.Int8x16.extractLane(value, 12) +
+                  SIMD.Int8x16.extractLane(value, 13) +
+                  SIMD.Int8x16.extractLane(value, 14) +
+                  SIMD.Int8x16.extractLane(value,15);
+        return sum;
+    }
+    equal(0, f4val.horizontalSum());
+}
+
+function testWrapperObject() 
+{
+
+    testConstructor();
+    testToStringTag();
+    testToPrimitive();
+    testValueOf();
+    testToString_LocaleString();
+    testProtoLinking();
+    testValueSemantics();
+    testUseCase1()
+}
+
+testWrapperObject();
+print("PASS");

+ 309 - 0
test/SIMD.wrappers/testUint16x8.js

@@ -0,0 +1,309 @@
+//-------------------------------------------------------------------------------------------------------
+// Copyright (C) Microsoft. All rights reserved.
+// Licensed under the MIT license. See LICENSE.txt file in the project root for full license information.
+//-------------------------------------------------------------------------------------------------------
+this.WScript.LoadScriptFile("..\\UnitTestFramework\\SimdJsHelpers.js");
+
+var sf0 = SIMD.Uint16x8(1, -2, 3, 0, 1, -2, 3, 0);
+var sf1 = SIMD.Uint16x8(1, -2, 3, 0, 1, -2, 3, 0);
+var sf2 = SIMD.Uint16x8(1, -2, 13, 0, 1, -2, 13, 0);
+var sf3 = SIMD.Uint16x8(0, Infinity, NaN, -0, 0, Infinity, NaN, -0);
+
+function testConstructor()
+{
+    ////////////////////
+    //Constructor
+    ///////////////////
+    equal("object", typeof SIMD.Uint16x8.prototype);
+    equal("function", typeof SIMD.Uint16x8.prototype.constructor);
+    equal("function", typeof SIMD.Uint16x8.prototype.toString);
+    equal("function", typeof SIMD.Uint16x8.prototype.toLocaleString);
+    equal("function", typeof SIMD.Uint16x8.prototype.valueOf);
+    equal(SIMD.Uint16x8, SIMD.Uint16x8.prototype.constructor);
+
+    descriptor = Object.getOwnPropertyDescriptor(SIMD.Uint16x8, 'prototype');
+    equal(false, descriptor.writable);
+    equal(false, descriptor.enumerable);
+    equal(false, descriptor.configurable); 
+}
+
+function testToStringTag()
+{
+    ///////////////////
+    //SIMDConstructor.prototype [ @@toStringTag ]
+    ///////////////////
+    var sym = Symbol('sym');
+    var symbol_object = Object(sym);
+    equal("SIMD.Uint16x8", SIMD.Uint16x8.prototype[Symbol.toStringTag]);
+
+    descriptor = Object.getOwnPropertyDescriptor(SIMD.Uint16x8.prototype, Symbol.toStringTag);
+    equal(false, descriptor.writable);
+    equal(false, descriptor.enumerable);
+    equal(true, descriptor.configurable);
+}
+
+function testToPrimitive()
+{
+    ///////////////////
+    //SIMDConstructor.prototype [ @@toPrimitive ] 
+    ///////////////////
+    equal("function",typeof SIMD.Uint16x8.prototype[Symbol.toPrimitive]);
+    equal(1, SIMD.Uint16x8.prototype[Symbol.toPrimitive].length);
+
+    descriptor = Object.getOwnPropertyDescriptor(SIMD.Uint16x8.prototype, Symbol.toPrimitive);
+    equal(false, descriptor.writable);
+    equal(false, descriptor.enumerable);
+    equal(true, descriptor.configurable);
+
+    var functionToString = SIMD.Uint16x8.prototype[Symbol.toPrimitive].toString();
+    var actualName = functionToString.substring(9, functionToString.indexOf('('));
+    equal("[Symbol.toPrimitive]",actualName);
+
+    ///////////////////////////
+    //Overriding @@ToPrimitive
+    ///////////////////////////
+    SIMD.Uint16x8.prototype[Symbol.toPrimitive] = undefined;
+    var G;
+    var functionBackup = SIMD.Uint16x8.prototype.toLocaleString;
+    SIMD.Uint16x8.prototype.toLocaleString = function(){
+        G = this;
+    }
+    sf0.toLocaleString();
+    try{var x =  G + G;}
+    catch(e)
+    {equal("Error: Number expected", e);}  //@@toPrimitive is not writable
+
+    //@@toPrimitive is configurable. 
+    memberBackup = Object.getOwnPropertyDescriptor(SIMD.Uint16x8.prototype, Symbol.toPrimitive);
+    delete SIMD.Uint16x8.prototype[Symbol.toPrimitive];
+    SIMD.Uint16x8.prototype[Symbol.toPrimitive] = function() { return 1;}
+    equal(2, G + G);
+    equal(0, G - G);
+    equal(1, G * G);
+    equal(1, G / G);
+    equal(true, G == G);
+    equal(true, G === G);
+    equal(false, G > G);
+    equal(true, G >= G);
+    equal(false, G < G);
+    equal(true, G >= G);
+
+    delete SIMD.Uint16x8.prototype[Symbol.toPrimitive];
+    SIMD.Uint16x8.prototype[Symbol.toPrimitive] = function() { return undefined;}
+    equal(NaN, G + G);
+    equal(NaN, G - G);
+    equal(NaN, G * G);
+    equal(NaN, G / G);
+    equal(true, G == G);
+    equal(true, G === G);
+    equal(false, G > G);
+    equal(false, G >= G);
+    equal(false, G < G);
+    equal(false, G >= G);
+
+    delete SIMD.Uint16x8.prototype[Symbol.toPrimitive];
+    SIMD.Uint16x8.prototype[Symbol.toPrimitive] = function() { return "test";}
+    equal("testtest", G + G);
+    equal(NaN, G - G);
+    equal(NaN, G * G);
+    equal(NaN, G / G);
+    equal(true, G == G);
+    equal(true, G === G);
+    equal(false, G > G);
+    equal(true, G >= G);
+    equal(false, G < G);
+    equal(true, G >= G);
+
+    delete SIMD.Uint16x8.prototype[Symbol.toPrimitive];
+    SIMD.Uint16x8.prototype[Symbol.toPrimitive] = 5;
+    try{var x =  G + G;}
+    catch(e)
+    {equal("TypeError: 'Symbol.toPrimitive' is not a function", e);}
+
+    SIMD.Uint16x8.prototype[Symbol.toPrimitive] = memberBackup;
+    SIMD.Uint16x8.prototype.toLocaleString = functionBackup
+}
+
+function testValueOf()
+{
+    ///////////////////
+    //ValueOf
+    ///////////////////
+    descriptor = Object.getOwnPropertyDescriptor(SIMD.Uint16x8.prototype, 'valueOf');
+    equal(true, descriptor.writable);
+    equal(false, descriptor.enumerable);
+    equal(true, descriptor.configurable);
+    equal("uint16x8", typeof sf0.valueOf());
+    equal("SIMD.Uint16x8(1, 65534, 3, 0, 1, 65534, 3, 0)",sf0.valueOf().toString());
+}
+
+function testToString_LocaleString()
+{
+    ///////////////////
+    //ToString / ToLocaleString
+    ///////////////////
+    descriptor = Object.getOwnPropertyDescriptor(SIMD.Uint16x8.prototype, 'toString');
+    equal(true, descriptor.writable);
+    equal(false, descriptor.enumerable);
+    equal(true, descriptor.configurable);
+
+    descriptor = Object.getOwnPropertyDescriptor(SIMD.Uint16x8.prototype, 'toLocaleString');
+    equal(true, descriptor.writable);
+    equal(false, descriptor.enumerable);
+    equal(true, descriptor.configurable);
+
+    equal("SIMD.Uint16x8(1, 65534, 3, 0, 1, 65534, 3, 0)", sf0.toString()); //If float use ToString on lanes, the right values will be available.
+    equal("SIMD.Uint16x8(1, 65,534, 3, 0, 1, 65,534, 3, 0)", sf0.toLocaleString());
+
+    equal("SIMD.Uint16x8(0, 0, 0, 0, 0, 0, 0, 0)", sf3.toString()); 
+    // equal("SIMD.Uint16x8(0, ?, NaN, 0)", sf3.toLocaleString());   //How should this work?
+    var functionBackup = SIMD.Uint16x8.prototype.toLocaleString;
+    var G5;
+    SIMD.Uint16x8.prototype.toLocaleString = function() {
+        G5 = this;
+        return "NEWTOSTRING";
+    }
+
+    equal("undefined", typeof(G5));
+    equal("NEWTOSTRING", sf0.toLocaleString());
+    equal("object", typeof(G5));
+    equal("NEWTOSTRING", G5.toLocaleString());
+    equal("NEWTOSTRING", sf0.toLocaleString());
+    SIMD.Uint16x8.prototype.toLocaleString  = functionBackup;
+
+    ///////////////////
+    //PrototypeLinking toString
+    ///////////////////
+    functionBackup = SIMD.Uint16x8.prototype.toString;
+    SIMD.Uint16x8.prototype.toString = function() {
+        G = this;
+        return "NEWTOSTRING";
+    }
+
+    equal("undefined", typeof(G));
+    equal("NEWTOSTRING", sf0.toString());
+    equal("object", typeof(G));
+    equal("NEWTOSTRING", G.toString());
+    equal("NEWTOSTRING", sf0.toString());
+    SIMD.Uint16x8.prototype.toString = functionBackup;
+}
+
+function testProtoLinking()
+{
+    ///////////////////
+    //Inheritance 
+    ///////////////////
+    SIMD.Uint16x8.prototype.myToString = function() {
+        return "MYTOSTRING";
+    }
+    equal("MYTOSTRING", sf0.myToString());
+    equal("MYTOSTRING", G.myToString());
+
+    ///////////////////
+    //PrototypeLinking valueOf
+    ///////////////////
+    var functionBackup = SIMD.Uint16x8.prototype.valueOf;
+    SIMD.Uint16x8.prototype.valueOf = function() {
+        G1 = this;
+        return  "NEWVALUEOF";
+    }
+
+    var G1;
+    equal("undefined", typeof(G1));
+    equal("NEWVALUEOF", sf0.valueOf());
+    equal("object", typeof(G1));
+    equal("NEWVALUEOF", G1.valueOf());
+    equal("NEWVALUEOF", sf0.valueOf());
+    SIMD.Uint16x8.prototype.valueOf = functionBackup;
+}
+
+function testValueSemantics() 
+{
+    ///////////////////
+    //Value semantics
+    ///////////////////
+    equal(true, (sf0 == sf0));
+    equal(true, (sf0 === sf0));
+    equal(true, (sf0 == sf1));
+    equal(true, (sf0 === sf1));
+    equal(false, (sf0 == sf2));
+    equal(false, (sf0 === sf2));
+
+    ///////////////////
+    //Comparision
+    //////////////////
+    try{var x = sf0 > sf1;}
+    catch(e)
+    {equal("TypeError: SIMD type: cannot be converted to a number", e);}
+
+    try{var x = sf0 < sf1;}
+    catch(e)
+    {equal("TypeError: SIMD type: cannot be converted to a number", e);}
+
+    try{var x = sf0 >= sf1;}
+    catch(e)
+    {equal("TypeError: SIMD type: cannot be converted to a number", e);}
+
+    try{var x = sf0 <= sf1;}
+    catch(e)
+    {equal("TypeError: SIMD type: cannot be converted to a number", e);}
+
+    ///////////////////////
+    //Arithmetic operators
+    ///////////////////////
+
+    equal("SIMD.Uint16x8(0, 0, 0, 0, 0, 0, 0, 0)test", sf3 + "test");
+    equal("testSIMD.Uint16x8(0, 0, 0, 0, 0, 0, 0, 0)", "test" + sf3);
+
+    try{var x =  sf3 + sf3;}
+    catch(e)
+    {equal("Error: Number expected", e);} //Check
+
+    try{var x =  sf3 - sf3;}
+    catch(e)
+    {equal("Error: Number expected", e);} 
+
+    try{var x =  sf3 / sf3;}
+    catch(e)
+    {equal("Error: Number expected", e);} 
+
+    try{var x =  sf3 * sf3;}
+    catch(e)
+    {equal("Error: Number expected", e);}
+}
+
+function testUseCase1()
+{
+    var f4val = SIMD.Uint16x8(0, 1, 2, -3, 0, 1, 2, -3);
+    SIMD.Uint16x8.prototype.horizontalSum = function()
+    {
+        var value = this.valueOf();
+        var sum = SIMD.Uint16x8.extractLane(value, 0) +
+                  SIMD.Uint16x8.extractLane(value, 1) +
+                  SIMD.Uint16x8.extractLane(value, 2) +
+                  SIMD.Uint16x8.extractLane(value, 3) +
+                  SIMD.Uint16x8.extractLane(value, 4) +
+                  SIMD.Uint16x8.extractLane(value, 5) +
+                  SIMD.Uint16x8.extractLane(value, 6) +
+                  SIMD.Uint16x8.extractLane(value, 7);
+        return sum;
+    }
+
+    equal(131072, f4val.horizontalSum());
+}
+
+function testWrapperObject() 
+{
+
+    testConstructor();
+    testToStringTag();
+    testToPrimitive();
+    testValueOf();
+    testToString_LocaleString();
+    testProtoLinking();
+    testValueSemantics();
+    testUseCase1()
+}
+
+testWrapperObject();
+print("PASS");

+ 304 - 0
test/SIMD.wrappers/testUint32x4.js

@@ -0,0 +1,304 @@
+//-------------------------------------------------------------------------------------------------------
+// Copyright (C) Microsoft. All rights reserved.
+// Licensed under the MIT license. See LICENSE.txt file in the project root for full license information.
+//-------------------------------------------------------------------------------------------------------
+this.WScript.LoadScriptFile("..\\UnitTestFramework\\SimdJsHelpers.js");
+
+var sf0 = SIMD.Uint32x4(1, -2, 3, 0);
+var sf1 = SIMD.Uint32x4(1, -2, 3, 0);
+var sf2 = SIMD.Uint32x4(1, -2, 13, 0);
+var sf3 = SIMD.Uint32x4(0, Infinity, NaN, -0);
+
+function testConstructor()
+{
+    ////////////////////
+    //Constructor
+    ///////////////////
+    equal("object", typeof SIMD.Uint32x4.prototype);
+    equal("function", typeof SIMD.Uint32x4.prototype.constructor);
+    equal("function", typeof SIMD.Uint32x4.prototype.toString);
+    equal("function", typeof SIMD.Uint32x4.prototype.toLocaleString);
+    equal("function", typeof SIMD.Uint32x4.prototype.valueOf);
+    equal(SIMD.Uint32x4, SIMD.Uint32x4.prototype.constructor);
+
+    descriptor = Object.getOwnPropertyDescriptor(SIMD.Uint32x4, 'prototype');
+    equal(false, descriptor.writable);
+    equal(false, descriptor.enumerable);
+    equal(false, descriptor.configurable); 
+}
+
+function testToStringTag()
+{
+    ///////////////////
+    //SIMDConstructor.prototype [ @@toStringTag ]
+    ///////////////////
+    var sym = Symbol('sym');
+    var symbol_object = Object(sym);
+    equal("SIMD.Uint32x4", SIMD.Uint32x4.prototype[Symbol.toStringTag]);
+
+    descriptor = Object.getOwnPropertyDescriptor(SIMD.Uint32x4.prototype, Symbol.toStringTag);
+    equal(false, descriptor.writable);
+    equal(false, descriptor.enumerable);
+    equal(true, descriptor.configurable);
+}
+
+function testToPrimitive()
+{
+    ///////////////////
+    //SIMDConstructor.prototype [ @@toPrimitive ] 
+    ///////////////////
+    equal("function",typeof SIMD.Uint32x4.prototype[Symbol.toPrimitive]);
+    equal(1, SIMD.Uint32x4.prototype[Symbol.toPrimitive].length);
+
+    descriptor = Object.getOwnPropertyDescriptor(SIMD.Uint32x4.prototype, Symbol.toPrimitive);
+    equal(false, descriptor.writable);
+    equal(false, descriptor.enumerable);
+    equal(true, descriptor.configurable);
+
+    var functionToString = SIMD.Uint32x4.prototype[Symbol.toPrimitive].toString();
+    var actualName = functionToString.substring(9, functionToString.indexOf('('));
+    equal("[Symbol.toPrimitive]",actualName);
+
+    ///////////////////////////
+    //Overriding @@ToPrimitive
+    ///////////////////////////
+    SIMD.Uint32x4.prototype[Symbol.toPrimitive] = undefined;
+    var G;
+    var functionBackup = SIMD.Uint32x4.prototype.toLocaleString;
+    SIMD.Uint32x4.prototype.toLocaleString = function(){
+        G = this;
+    }
+    sf0.toLocaleString();
+    try{var x =  G + G;}
+    catch(e)
+    {equal("Error: Number expected", e);}  //@@toPrimitive is not writable
+
+    //@@toPrimitive is configurable. 
+    memberBackup = Object.getOwnPropertyDescriptor(SIMD.Uint32x4.prototype, Symbol.toPrimitive);
+    delete SIMD.Uint32x4.prototype[Symbol.toPrimitive];
+    SIMD.Uint32x4.prototype[Symbol.toPrimitive] = function() { return 1;}
+    equal(2, G + G);
+    equal(0, G - G);
+    equal(1, G * G);
+    equal(1, G / G);
+    equal(true, G == G);
+    equal(true, G === G);
+    equal(false, G > G);
+    equal(true, G >= G);
+    equal(false, G < G);
+    equal(true, G >= G);
+
+    delete SIMD.Uint32x4.prototype[Symbol.toPrimitive];
+    SIMD.Uint32x4.prototype[Symbol.toPrimitive] = function() { return undefined;}
+    equal(NaN, G + G);
+    equal(NaN, G - G);
+    equal(NaN, G * G);
+    equal(NaN, G / G);
+    equal(true, G == G);
+    equal(true, G === G);
+    equal(false, G > G);
+    equal(false, G >= G);
+    equal(false, G < G);
+    equal(false, G >= G);
+
+    delete SIMD.Uint32x4.prototype[Symbol.toPrimitive];
+    SIMD.Uint32x4.prototype[Symbol.toPrimitive] = function() { return "test";}
+    equal("testtest", G + G);
+    equal(NaN, G - G);
+    equal(NaN, G * G);
+    equal(NaN, G / G);
+    equal(true, G == G);
+    equal(true, G === G);
+    equal(false, G > G);
+    equal(true, G >= G);
+    equal(false, G < G);
+    equal(true, G >= G);
+
+    delete SIMD.Uint32x4.prototype[Symbol.toPrimitive];
+    SIMD.Uint32x4.prototype[Symbol.toPrimitive] = 5;
+    try{var x =  G + G;}
+    catch(e)
+    {equal("TypeError: 'Symbol.toPrimitive' is not a function", e);}
+
+    SIMD.Uint32x4.prototype[Symbol.toPrimitive] = memberBackup;
+    SIMD.Uint32x4.prototype.toLocaleString = functionBackup
+}
+
+function testValueOf()
+{
+    ///////////////////
+    //ValueOf
+    ///////////////////
+    descriptor = Object.getOwnPropertyDescriptor(SIMD.Uint32x4.prototype, 'valueOf');
+    equal(true, descriptor.writable);
+    equal(false, descriptor.enumerable);
+    equal(true, descriptor.configurable);
+    equal("uint32x4", typeof sf0.valueOf());
+    equal("SIMD.Uint32x4(1, 4294967294, 3, 0)",sf0.valueOf().toString());
+}
+
+function testToString_LocaleString()
+{
+    ///////////////////
+    //ToString / ToLocaleString
+    ///////////////////
+    descriptor = Object.getOwnPropertyDescriptor(SIMD.Uint32x4.prototype, 'toString');
+    equal(true, descriptor.writable);
+    equal(false, descriptor.enumerable);
+    equal(true, descriptor.configurable);
+
+    descriptor = Object.getOwnPropertyDescriptor(SIMD.Uint32x4.prototype, 'toLocaleString');
+    equal(true, descriptor.writable);
+    equal(false, descriptor.enumerable);
+    equal(true, descriptor.configurable);
+
+    equal("SIMD.Uint32x4(1, 4294967294, 3, 0)", sf0.toString()); //If float use ToString on lanes, the right values will be available.
+    equal("SIMD.Uint32x4(1, 4,294,967,294, 3, 0)", sf0.toLocaleString());
+    equal("SIMD.Uint32x4(0, 0, 0, 0)", sf3.toString()); 
+    // equal("SIMD.Uint32x4(0, ?, NaN, 0)", sf3.toLocaleString());   //How should this work?
+    var functionBackup = SIMD.Uint32x4.prototype.toLocaleString;
+    var G5;
+    SIMD.Uint32x4.prototype.toLocaleString = function() {
+        G5 = this;
+        return "NEWTOSTRING";
+    }
+
+    equal("undefined", typeof(G5));
+    equal("NEWTOSTRING", sf0.toLocaleString());
+    equal("object", typeof(G5));
+    equal("NEWTOSTRING", G5.toLocaleString());
+    equal("NEWTOSTRING", sf0.toLocaleString());
+    SIMD.Uint32x4.prototype.toLocaleString  = functionBackup;
+
+    ///////////////////
+    //PrototypeLinking toString
+    ///////////////////
+    functionBackup = SIMD.Uint32x4.prototype.toString;
+    SIMD.Uint32x4.prototype.toString = function() {
+        G = this;
+        return "NEWTOSTRING";
+    }
+
+    equal("undefined", typeof(G));
+    equal("NEWTOSTRING", sf0.toString());
+    equal("object", typeof(G));
+    equal("NEWTOSTRING", G.toString());
+    equal("NEWTOSTRING", sf0.toString());
+    SIMD.Uint32x4.prototype.toString = functionBackup;
+}
+
+function testProtoLinking()
+{
+    ///////////////////
+    //Inheritance 
+    ///////////////////
+    SIMD.Uint32x4.prototype.myToString = function() {
+        return "MYTOSTRING";
+    }
+    equal("MYTOSTRING", sf0.myToString());
+    equal("MYTOSTRING", G.myToString());
+
+    ///////////////////
+    //PrototypeLinking valueOf
+    ///////////////////
+    var functionBackup = SIMD.Uint32x4.prototype.valueOf;
+    SIMD.Uint32x4.prototype.valueOf = function() {
+        G1 = this;
+        return  "NEWVALUEOF";
+    }
+
+    var G1;
+    equal("undefined", typeof(G1));
+    equal("NEWVALUEOF", sf0.valueOf());
+    equal("object", typeof(G1));
+    equal("NEWVALUEOF", G1.valueOf());
+    equal("NEWVALUEOF", sf0.valueOf());
+    SIMD.Uint32x4.prototype.valueOf = functionBackup;
+}
+
+function testValueSemantics() 
+{
+    ///////////////////
+    //Value semantics
+    ///////////////////
+    equal(true, (sf0 == sf0));
+    equal(true, (sf0 === sf0));
+    equal(true, (sf0 == sf1));
+    equal(true, (sf0 === sf1));
+    equal(false, (sf0 == sf2));
+    equal(false, (sf0 === sf2));
+
+    ///////////////////
+    //Comparision
+    //////////////////
+    try{var x = sf0 > sf1;}
+    catch(e)
+    {equal("TypeError: SIMD type: cannot be converted to a number", e);}
+
+    try{var x = sf0 < sf1;}
+    catch(e)
+    {equal("TypeError: SIMD type: cannot be converted to a number", e);}
+
+    try{var x = sf0 >= sf1;}
+    catch(e)
+    {equal("TypeError: SIMD type: cannot be converted to a number", e);}
+
+    try{var x = sf0 <= sf1;}
+    catch(e)
+    {equal("TypeError: SIMD type: cannot be converted to a number", e);}
+
+    ///////////////////////
+    //Arithmetic operators
+    ///////////////////////
+
+    equal("SIMD.Uint32x4(0, 0, 0, 0)test", sf3 + "test");
+    equal("testSIMD.Uint32x4(0, 0, 0, 0)", "test" + sf3);
+
+    try{var x =  sf3 + sf3;}
+    catch(e)
+    {equal("Error: Number expected", e);} //Check
+
+    try{var x =  sf3 - sf3;}
+    catch(e)
+    {equal("Error: Number expected", e);} 
+
+    try{var x =  sf3 / sf3;}
+    catch(e)
+    {equal("Error: Number expected", e);} 
+
+    try{var x =  sf3 * sf3;}
+    catch(e)
+    {equal("Error: Number expected", e);}
+}
+
+function testUseCase1()
+{
+    var f4val = SIMD.Uint32x4(0, 1, 2, -3);
+    SIMD.Uint32x4.prototype.horizontalSum = function()
+    {
+        var value = this.valueOf();
+        var sum = SIMD.Uint32x4.extractLane(value, 0) +
+                  SIMD.Uint32x4.extractLane(value, 1) +
+                  SIMD.Uint32x4.extractLane(value, 2) +
+                  SIMD.Uint32x4.extractLane(value, 3);
+        return sum;
+    }
+
+    equal(4294967296, f4val.horizontalSum());
+}
+
+function testWrapperObject() 
+{
+
+    testConstructor();
+    testToStringTag();
+    testToPrimitive();
+    testValueOf();
+    testToString_LocaleString();
+    testProtoLinking();
+    testValueSemantics();
+    testUseCase1()
+}
+
+testWrapperObject();
+print("PASS");

+ 317 - 0
test/SIMD.wrappers/testUint8x16.js

@@ -0,0 +1,317 @@
+//-------------------------------------------------------------------------------------------------------
+// Copyright (C) Microsoft. All rights reserved.
+// Licensed under the MIT license. See LICENSE.txt file in the project root for full license information.
+//-------------------------------------------------------------------------------------------------------
+this.WScript.LoadScriptFile("..\\UnitTestFramework\\SimdJsHelpers.js");
+
+var sf0 = SIMD.Uint8x16(1, -2, 3, 0, 1, -2, 3, 0, 1, -2, 3, 0, 1, -2, 3, 0);
+var sf1 = SIMD.Uint8x16(1, -2, 3, 0, 1, -2, 3, 0, 1, -2, 3, 0, 1, -2, 3, 0);
+var sf2 = SIMD.Uint8x16(1, -2, 13, 0, 1, -2, 13, 0, 1, -2, 13, 0, 1, -2, 13, 0);
+var sf3 = SIMD.Uint8x16(0, Infinity, NaN, -0, 0, Infinity, NaN, -0, 0, Infinity, NaN, -0, 0, Infinity, NaN, -0);
+
+function testConstructor()
+{
+    ////////////////////
+    //Constructor
+    ///////////////////
+    equal("object", typeof SIMD.Uint8x16.prototype);
+    equal("function", typeof SIMD.Uint8x16.prototype.constructor);
+    equal("function", typeof SIMD.Uint8x16.prototype.toString);
+    equal("function", typeof SIMD.Uint8x16.prototype.toLocaleString);
+    equal("function", typeof SIMD.Uint8x16.prototype.valueOf);
+    equal(SIMD.Uint8x16, SIMD.Uint8x16.prototype.constructor);
+
+    descriptor = Object.getOwnPropertyDescriptor(SIMD.Uint8x16, 'prototype');
+    equal(false, descriptor.writable);
+    equal(false, descriptor.enumerable);
+    equal(false, descriptor.configurable); 
+}
+
+function testToStringTag()
+{
+    ///////////////////
+    //SIMDConstructor.prototype [ @@toStringTag ]
+    ///////////////////
+    var sym = Symbol('sym');
+    var symbol_object = Object(sym);
+    equal("SIMD.Uint8x16", SIMD.Uint8x16.prototype[Symbol.toStringTag]);
+
+    descriptor = Object.getOwnPropertyDescriptor(SIMD.Uint8x16.prototype, Symbol.toStringTag);
+    equal(false, descriptor.writable);
+    equal(false, descriptor.enumerable);
+    equal(true, descriptor.configurable);
+}
+
+function testToPrimitive()
+{
+    ///////////////////
+    //SIMDConstructor.prototype [ @@toPrimitive ] 
+    ///////////////////
+    equal("function",typeof SIMD.Uint8x16.prototype[Symbol.toPrimitive]);
+    equal(1, SIMD.Uint8x16.prototype[Symbol.toPrimitive].length);
+
+    descriptor = Object.getOwnPropertyDescriptor(SIMD.Uint8x16.prototype, Symbol.toPrimitive);
+    equal(false, descriptor.writable);
+    equal(false, descriptor.enumerable);
+    equal(true, descriptor.configurable);
+
+    var functionToString = SIMD.Uint8x16.prototype[Symbol.toPrimitive].toString();
+    var actualName = functionToString.substring(9, functionToString.indexOf('('));
+    equal("[Symbol.toPrimitive]",actualName);
+
+    ///////////////////////////
+    //Overriding @@ToPrimitive
+    ///////////////////////////
+    SIMD.Uint8x16.prototype[Symbol.toPrimitive] = undefined;
+    var G;
+    var functionBackup = SIMD.Uint8x16.prototype.toLocaleString;
+    SIMD.Uint8x16.prototype.toLocaleString = function(){
+        G = this;
+    }
+    sf0.toLocaleString();
+    try{var x =  G + G;}
+    catch(e)
+    {equal("Error: Number expected", e);}  //@@toPrimitive is not writable
+
+    //@@toPrimitive is configurable. 
+    memberBackup = Object.getOwnPropertyDescriptor(SIMD.Uint8x16.prototype, Symbol.toPrimitive);
+    delete SIMD.Uint8x16.prototype[Symbol.toPrimitive];
+    SIMD.Uint8x16.prototype[Symbol.toPrimitive] = function() { return 1;}
+    equal(2, G + G);
+    equal(0, G - G);
+    equal(1, G * G);
+    equal(1, G / G);
+    equal(true, G == G);
+    equal(true, G === G);
+    equal(false, G > G);
+    equal(true, G >= G);
+    equal(false, G < G);
+    equal(true, G >= G);
+
+    delete SIMD.Uint8x16.prototype[Symbol.toPrimitive];
+    SIMD.Uint8x16.prototype[Symbol.toPrimitive] = function() { return undefined;}
+    equal(NaN, G + G);
+    equal(NaN, G - G);
+    equal(NaN, G * G);
+    equal(NaN, G / G);
+    equal(true, G == G);
+    equal(true, G === G);
+    equal(false, G > G);
+    equal(false, G >= G);
+    equal(false, G < G);
+    equal(false, G >= G);
+
+    delete SIMD.Uint8x16.prototype[Symbol.toPrimitive];
+    SIMD.Uint8x16.prototype[Symbol.toPrimitive] = function() { return "test";}
+    equal("testtest", G + G);
+    equal(NaN, G - G);
+    equal(NaN, G * G);
+    equal(NaN, G / G);
+    equal(true, G == G);
+    equal(true, G === G);
+    equal(false, G > G);
+    equal(true, G >= G);
+    equal(false, G < G);
+    equal(true, G >= G);
+
+    delete SIMD.Uint8x16.prototype[Symbol.toPrimitive];
+    SIMD.Uint8x16.prototype[Symbol.toPrimitive] = 5;
+    try{var x =  G + G;}
+    catch(e)
+    {equal("TypeError: 'Symbol.toPrimitive' is not a function", e);}
+
+    SIMD.Uint8x16.prototype[Symbol.toPrimitive] = memberBackup;
+    SIMD.Uint8x16.prototype.toLocaleString = functionBackup
+}
+
+function testValueOf()
+{
+    ///////////////////
+    //ValueOf
+    ///////////////////
+    descriptor = Object.getOwnPropertyDescriptor(SIMD.Uint8x16.prototype, 'valueOf');
+    equal(true, descriptor.writable);
+    equal(false, descriptor.enumerable);
+    equal(true, descriptor.configurable);
+    equal("uint8x16", typeof sf0.valueOf());
+    equal("SIMD.Uint8x16(1, 254, 3, 0, 1, 254, 3, 0, 1, 254, 3, 0, 1, 254, 3, 0)",sf0.valueOf().toString());
+}
+
+function testToString_LocaleString()
+{
+    ///////////////////
+    //ToString / ToLocaleString
+    ///////////////////
+    descriptor = Object.getOwnPropertyDescriptor(SIMD.Uint8x16.prototype, 'toString');
+    equal(true, descriptor.writable);
+    equal(false, descriptor.enumerable);
+    equal(true, descriptor.configurable);
+
+    descriptor = Object.getOwnPropertyDescriptor(SIMD.Uint8x16.prototype, 'toLocaleString');
+    equal(true, descriptor.writable);
+    equal(false, descriptor.enumerable);
+    equal(true, descriptor.configurable);
+
+    equal("SIMD.Uint8x16(1, 254, 3, 0, 1, 254, 3, 0, 1, 254, 3, 0, 1, 254, 3, 0)", sf0.toString());
+    equal("SIMD.Uint8x16(1, 254, 3, 0, 1, 254, 3, 0, 1, 254, 3, 0, 1, 254, 3, 0)", sf0.toLocaleString());
+
+    equal("SIMD.Uint8x16(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)", sf3.toString()); 
+    equal("SIMD.Uint8x16(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)", sf3.toLocaleString());   
+    var functionBackup = SIMD.Uint8x16.prototype.toLocaleString;
+    var G5;
+    SIMD.Uint8x16.prototype.toLocaleString = function() {
+        G5 = this;
+        return "NEWTOSTRING";
+    }
+
+    equal("undefined", typeof(G5));
+    equal("NEWTOSTRING", sf0.toLocaleString());
+    equal("object", typeof(G5));
+    equal("NEWTOSTRING", G5.toLocaleString());
+    equal("NEWTOSTRING", sf0.toLocaleString());
+    SIMD.Uint8x16.prototype.toLocaleString  = functionBackup;
+
+    ///////////////////
+    //PrototypeLinking toString
+    ///////////////////
+    functionBackup = SIMD.Uint8x16.prototype.toString;
+    SIMD.Uint8x16.prototype.toString = function() {
+        G = this;
+        return "NEWTOSTRING";
+    }
+
+    equal("undefined", typeof(G));
+    equal("NEWTOSTRING", sf0.toString());
+    equal("object", typeof(G));
+    equal("NEWTOSTRING", G.toString());
+    equal("NEWTOSTRING", sf0.toString());
+    SIMD.Uint8x16.prototype.toString = functionBackup;
+}
+
+function testProtoLinking()
+{
+    ///////////////////
+    //Inheritance 
+    ///////////////////
+    SIMD.Uint8x16.prototype.myToString = function() {
+        return "MYTOSTRING";
+    }
+    equal("MYTOSTRING", sf0.myToString());
+    equal("MYTOSTRING", G.myToString());
+
+    ///////////////////
+    //PrototypeLinking valueOf
+    ///////////////////
+    var functionBackup = SIMD.Uint8x16.prototype.valueOf;
+    SIMD.Uint8x16.prototype.valueOf = function() {
+        G1 = this;
+        return  "NEWVALUEOF";
+    }
+
+    var G1;
+    equal("undefined", typeof(G1));
+    equal("NEWVALUEOF", sf0.valueOf());
+    equal("object", typeof(G1));
+    equal("NEWVALUEOF", G1.valueOf());
+    equal("NEWVALUEOF", sf0.valueOf());
+    SIMD.Uint8x16.prototype.valueOf = functionBackup;
+}
+
+function testValueSemantics() 
+{
+    ///////////////////
+    //Value semantics
+    ///////////////////
+    equal(true, (sf0 == sf0));
+    equal(true, (sf0 === sf0));
+    equal(true, (sf0 == sf1));
+    equal(true, (sf0 === sf1));
+    equal(false, (sf0 == sf2));
+    equal(false, (sf0 === sf2));
+
+    ///////////////////
+    //Comparision
+    //////////////////
+    try{var x = sf0 > sf1;}
+    catch(e)
+    {equal("TypeError: SIMD type: cannot be converted to a number", e);}
+
+    try{var x = sf0 < sf1;}
+    catch(e)
+    {equal("TypeError: SIMD type: cannot be converted to a number", e);}
+
+    try{var x = sf0 >= sf1;}
+    catch(e)
+    {equal("TypeError: SIMD type: cannot be converted to a number", e);}
+
+    try{var x = sf0 <= sf1;}
+    catch(e)
+    {equal("TypeError: SIMD type: cannot be converted to a number", e);}
+
+    ///////////////////////
+    //Arithmetic operators
+    ///////////////////////
+
+    equal("SIMD.Uint8x16(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)test", sf3 + "test");
+    equal("testSIMD.Uint8x16(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)", "test" + sf3);
+
+    try{var x =  sf3 + sf3;}
+    catch(e)
+    {equal("Error: Number expected", e);} //Check
+
+    try{var x =  sf3 - sf3;}
+    catch(e)
+    {equal("Error: Number expected", e);} 
+
+    try{var x =  sf3 / sf3;}
+    catch(e)
+    {equal("Error: Number expected", e);} 
+
+    try{var x =  sf3 * sf3;}
+    catch(e)
+    {equal("Error: Number expected", e);}
+}
+
+function testUseCase1()
+{
+    var f4val = SIMD.Uint8x16(0, 1, 2, -3, 0, 1, 2, -3, 0, 1, 2, -3, 0, 1, 2, -3);
+    SIMD.Uint8x16.prototype.horizontalSum = function()
+    {
+        var value = this.valueOf();
+        var sum = SIMD.Uint8x16.extractLane(value, 0) +
+                  SIMD.Uint8x16.extractLane(value, 1) +
+                  SIMD.Uint8x16.extractLane(value, 2) +
+                  SIMD.Uint8x16.extractLane(value, 3) +
+                  SIMD.Uint8x16.extractLane(value, 4) +
+                  SIMD.Uint8x16.extractLane(value, 5) +
+                  SIMD.Uint8x16.extractLane(value, 6) +
+                  SIMD.Uint8x16.extractLane(value, 7) +
+                  SIMD.Uint8x16.extractLane(value, 8) +
+                  SIMD.Uint8x16.extractLane(value, 9) +
+                  SIMD.Uint8x16.extractLane(value, 10) +
+                  SIMD.Uint8x16.extractLane(value, 11) +
+                  SIMD.Uint8x16.extractLane(value, 12) +
+                  SIMD.Uint8x16.extractLane(value, 13) +
+                  SIMD.Uint8x16.extractLane(value, 14) +
+                  SIMD.Uint8x16.extractLane(value,15);
+        return sum;
+    }
+
+    equal(1024, f4val.horizontalSum());
+}
+
+function testWrapperObject() 
+{
+
+    testConstructor();
+    testToStringTag();
+    testToPrimitive();
+    testValueOf();
+    testToString_LocaleString();
+    testProtoLinking();
+    testValueSemantics();
+    testUseCase1()
+}
+
+testWrapperObject();
+print("PASS");

+ 6 - 0
test/rlexedirs.xml

@@ -311,6 +311,12 @@
     <tags>exclude_serialized,exclude_arm,exclude_arm64,require_backend</tags>
   </default>
 </dir>
+<dir>
+  <default>
+    <files>SIMD.wrappers</files>
+    <tags>exclude_serialized,exclude_arm,exclude_arm64,require_backend</tags>
+  </default>
+</dir>
 <dir>
   <default>
     <files>SIMD.TypeSpec</files>

Неке датотеке нису приказане због велике количине промена