summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/ion/testArrayBufferByteLength.js
blob: bf5fc4983344426f3f49dcd007f7fb3c97c4ccb7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
// |jit-test| --ion-warmup-threshold=50

var ArrayBufferByteLength = getSelfHostedValue("ArrayBufferByteLength");

function testBasic() {
  var arr = [1, 2, 3];
  var tarr = new Int32Array(arr);
  var abuf = tarr.buffer;

  var arrLength = arr.length;
  var bytesPerElement = Int32Array.BYTES_PER_ELEMENT;

  var f = function() {
    assertEq(ArrayBufferByteLength(abuf), arrLength * bytesPerElement);
  };
  do {
    f();
  } while (!inIon());
}
testBasic();