summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/ion/testArrayBufferByteLength.js
blob: 0eb75b5dd56aeb510f5274ecf06d3f2ee499a16b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
var ArrayBufferByteLength = getSelfHostedValue("ArrayBufferByteLength");

setJitCompilerOption("ion.warmup.trigger", 50);

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();