Var JavascriptSIMDFloat64x2::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_SIMDFloat64x2) { JavascriptError::ThrowTypeError(scriptContext, JSERR_This_NeedSimd, L"SIMDFloat64x2.toString"); } JavascriptSIMDFloat64x2 *instance = JavascriptSIMDFloat64x2::FromVar(args[0]); Assert(instance); wchar_t stringBuffer[SIMD_STRING_BUFFER_MAX]; SIMDValue value = instance->GetValue(); JavascriptSIMDFloat64x2::ToStringBuffer(value, stringBuffer, SIMD_STRING_BUFFER_MAX); JavascriptString* string = JavascriptString::NewCopySzFromArena(stringBuffer, scriptContext, scriptContext->GeneralAllocator()); return string; }
Var SIMDFloat64x2Lib::EntryGreaterThanOrEqual(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 any of the args are missing, then it is Undefined type which causes TypeError exception. // strict type on both operands if (args.Info.Count >= 3 && JavascriptSIMDFloat64x2::Is(args[1]) && JavascriptSIMDFloat64x2::Is(args[2])) { JavascriptSIMDFloat64x2 *a = JavascriptSIMDFloat64x2::FromVar(args[1]); JavascriptSIMDFloat64x2 *b = JavascriptSIMDFloat64x2::FromVar(args[2]); Assert(a && b); SIMDValue result, aValue, bValue; aValue = a->GetValue(); bValue = b->GetValue(); result = SIMDFloat64x2Operation::OpGreaterThanOrEqual(aValue, bValue); return JavascriptSIMDInt32x4::New(&result, scriptContext); } JavascriptError::ThrowTypeError(scriptContext, JSERR_SimdFloat64x2TypeMismatch, L"greaterThanOrEqual"); }
Var SIMDFloat64x2Lib::EntryScale(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 any of the args are missing, then it is Undefined type which causes TypeError exception. if (args.Info.Count >= 3 && JavascriptSIMDFloat64x2::Is(args[1])) { JavascriptSIMDFloat64x2 *a = JavascriptSIMDFloat64x2::FromVar(args[1]); Assert(a); SIMDValue result, aValue; aValue = a->GetValue(); double scaleValue = JavascriptConversion::ToNumber(args[2], scriptContext); result = SIMDFloat64x2Operation::OpScale(aValue, scaleValue); return JavascriptSIMDFloat64x2::New(&result, scriptContext); } JavascriptError::ThrowTypeError(scriptContext, JSERR_SimdFloat64x2TypeMismatch, L"scale"); }
Var SIMDFloat64x2Lib::EntryClamp(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)); // we expect at least 3 explicit args with Float64x2 type if (args.Info.Count >= 4 && JavascriptSIMDFloat64x2::Is(args[1]) && JavascriptSIMDFloat64x2::Is(args[2]) && JavascriptSIMDFloat64x2::Is(args[3])) { JavascriptSIMDFloat64x2 *t = JavascriptSIMDFloat64x2::FromVar(args[1]); JavascriptSIMDFloat64x2 *lower = JavascriptSIMDFloat64x2::FromVar(args[2]); JavascriptSIMDFloat64x2 *upper = JavascriptSIMDFloat64x2::FromVar(args[3]); Assert(t && lower && upper); SIMDValue tValue, lowerValue, upperValue, resultValue; tValue = t->GetValue(); lowerValue = lower->GetValue(); upperValue = upper->GetValue(); resultValue = SIMDFloat64x2Operation::OpClamp(tValue, lowerValue, upperValue); return JavascriptSIMDFloat64x2::New(&resultValue, scriptContext); } JavascriptError::ThrowTypeError(scriptContext, JSERR_SimdFloat64x2TypeMismatch, L"clamp"); }
Var SIMDFloat64x2Lib::EntryReciprocalSqrt(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 >= 2 && JavascriptSIMDFloat64x2::Is(args[1])) { JavascriptSIMDFloat64x2 *a = JavascriptSIMDFloat64x2::FromVar(args[1]); Assert(a); SIMDValue result, value; value = a->GetValue(); result = SIMDFloat64x2Operation::OpReciprocalSqrt(value); return JavascriptSIMDFloat64x2::New(&result, scriptContext); } JavascriptError::ThrowTypeError(scriptContext, JSERR_SimdFloat64x2TypeMismatch, L"reciprocalSqrt"); }
Var SIMDFloat64x2Lib::EntrySelect(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)); // we expect at least 3 explicit args (Int32x4, Float32x4, Float32x4) if (args.Info.Count >= 4 && JavascriptSIMDInt32x4::Is(args[1]) && JavascriptSIMDFloat64x2::Is(args[2]) && JavascriptSIMDFloat64x2::Is(args[3])) { JavascriptSIMDInt32x4 *mask = JavascriptSIMDInt32x4::FromVar(args[1]); Assert(mask); JavascriptSIMDFloat64x2 *fmask = JavascriptSIMDFloat64x2::FromInt32x4Bits(mask, scriptContext); JavascriptSIMDFloat64x2 *tvalue = JavascriptSIMDFloat64x2::FromVar(args[2]); JavascriptSIMDFloat64x2 *fvalue = JavascriptSIMDFloat64x2::FromVar(args[3]); Assert(fmask && tvalue && fvalue); SIMDValue maskValue, trueValue, falseValue, resultValue; maskValue = fmask->GetValue(); trueValue = tvalue->GetValue(); falseValue = fvalue->GetValue(); resultValue = SIMDFloat64x2Operation::OpSelect(maskValue, trueValue, falseValue); return JavascriptSIMDFloat64x2::New(&resultValue, scriptContext); } JavascriptError::ThrowTypeError(scriptContext, JSERR_SimdFloat32x4TypeMismatch, L"select"); }