diff options
Diffstat (limited to 'js/src/jit-test/tests/ion/typedarrayindex-const-double-representable-as-int32.js')
-rw-r--r-- | js/src/jit-test/tests/ion/typedarrayindex-const-double-representable-as-int32.js | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/js/src/jit-test/tests/ion/typedarrayindex-const-double-representable-as-int32.js b/js/src/jit-test/tests/ion/typedarrayindex-const-double-representable-as-int32.js new file mode 100644 index 0000000000..03468621fa --- /dev/null +++ b/js/src/jit-test/tests/ion/typedarrayindex-const-double-representable-as-int32.js @@ -0,0 +1,19 @@ +function f(n) { + const ta = new Int32Array(n); + + // When the TypedArray has a zero length, accessing the element at index 0 + // should return undefined. That'll lead to using MGuardNumberToIntPtrIndex + // with supportOOB for the TypedArray index conversion. + const r = n === 0 ? undefined : 0; + + // numberToDouble always returns a double number. + const k = numberToDouble(0); + + for (var i = 0; i < 10; ++i) { + assertEq(ta[k], r); + } +} + +for (var i = 0; i < 2; ++i) { + f(i); +} |