summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/ion/typedarrayindex-const-double-representable-as-int32.js
blob: 03468621fa7508dee8693b0615b184e1052fda9b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
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);
}