diff --git a/js/src/builtin/SIMD.cpp b/js/src/builtin/SIMD.cpp index 69b07a20d58b..279c777e1645 100644 --- a/js/src/builtin/SIMD.cpp +++ b/js/src/builtin/SIMD.cpp @@ -221,6 +221,9 @@ static const JSFunctionSpec SimdTypedObjectMethods[] = { // // The JS_INLINABLE_FN macro refers to js::JitInfo_##native which we provide as // Simd##Type##_##Operation +// +// /!\ Don't forget to keep this list in sync with the SIMD instrinics used in +// SelfHosting.cpp. namespace js { namespace jit { diff --git a/js/src/builtin/SIMD.h b/js/src/builtin/SIMD.h index 3d0e0d38f7e0..4d45c30c162f 100644 --- a/js/src/builtin/SIMD.h +++ b/js/src/builtin/SIMD.h @@ -1020,6 +1020,16 @@ bool IsVectorObject(HandleValue v); template bool ToSimdConstant(JSContext* cx, HandleValue v, jit::SimdConstant* out); +JSObject* +InitSimdClass(JSContext* cx, HandleObject obj); + +namespace jit { + +extern const JSJitInfo JitInfo_SimdInt32x4_extractLane; +extern const JSJitInfo JitInfo_SimdFloat32x4_extractLane; + +} // namespace jit + #define DECLARE_SIMD_FLOAT32X4_FUNCTION(Name, Func, Operands) \ extern bool \ simd_float32x4_##Name(JSContext* cx, unsigned argc, Value* vp); @@ -1092,9 +1102,6 @@ simd_bool64x2_##Name(JSContext* cx, unsigned argc, Value* vp); BOOL64X2_FUNCTION_LIST(DECLARE_SIMD_BOOL64x2_FUNCTION) #undef DECLARE_SIMD_BOOL64x2_FUNCTION -JSObject* -InitSimdClass(JSContext* cx, HandleObject obj); - } /* namespace js */ #endif /* builtin_SIMD_h */ diff --git a/js/src/jit-test/tests/SIMD/bug1241872.js b/js/src/jit-test/tests/SIMD/bug1241872.js new file mode 100644 index 000000000000..31847701633e --- /dev/null +++ b/js/src/jit-test/tests/SIMD/bug1241872.js @@ -0,0 +1,10 @@ +if (typeof SIMD !== 'object') + exit(0); + +function test() { + return SIMD.Float32x4().toSource(); +} + +var r = ''; +for (var i = 0; i < 10000; i++) + r = test(); diff --git a/js/src/vm/SelfHosting.cpp b/js/src/vm/SelfHosting.cpp index 55f9a8fc18d7..a1defbddb0f7 100644 --- a/js/src/vm/SelfHosting.cpp +++ b/js/src/vm/SelfHosting.cpp @@ -1652,11 +1652,11 @@ static const JSFunctionSpec intrinsic_functions[] = { JS_FN("std_SIMD_Int8x16_extractLane", simd_int8x16_extractLane, 2,0), JS_FN("std_SIMD_Int16x8_extractLane", simd_int16x8_extractLane, 2,0), - JS_INLINABLE_FN("std_SIMD_Int32x4_extractLane", simd_int32x4_extractLane, 2,0, SimdInt32x4), + JS_INLINABLE_FN("std_SIMD_Int32x4_extractLane", simd_int32x4_extractLane, 2,0, SimdInt32x4_extractLane), JS_FN("std_SIMD_Uint8x16_extractLane", simd_uint8x16_extractLane, 2,0), JS_FN("std_SIMD_Uint16x8_extractLane", simd_uint16x8_extractLane, 2,0), JS_FN("std_SIMD_Uint32x4_extractLane", simd_uint32x4_extractLane, 2,0), - JS_INLINABLE_FN("std_SIMD_Float32x4_extractLane", simd_float32x4_extractLane,2,0, SimdFloat32x4), + JS_INLINABLE_FN("std_SIMD_Float32x4_extractLane", simd_float32x4_extractLane,2,0, SimdFloat32x4_extractLane), JS_FN("std_SIMD_Float64x2_extractLane", simd_float64x2_extractLane, 2,0), JS_FN("std_SIMD_Bool8x16_extractLane", simd_bool8x16_extractLane, 2,0), JS_FN("std_SIMD_Bool16x8_extractLane", simd_bool16x8_extractLane, 2,0),