PageRenderTime 17ms CodeModel.GetById 2ms app.highlight 10ms RepoModel.GetById 2ms app.codeStats 0ms

/js/src/jit-test/tests/jaeger/normalIntTypedArrays.js

http://github.com/zpao/v8monkey
JavaScript | 49 lines | 43 code | 4 blank | 2 comment | 3 complexity | 1e534f059e37d56d3deebdebde5393ba MD5 | raw file
 1// vim: set ts=4 sw=4 tw=99 et:
 2
 3function testInt32Array(L) {
 4    var f = new Int32Array(8);
 5    assertEq(f[0], 0);
 6    assertEq(f[L], 0);
 7    assertEq(f[L+8], undefined);
 8    assertEq(f[8], undefined);
 9    f[0] = 12;
10    f[L+1] = 13;
11    f[2] = f[1];
12    f[L+3] = 4294967295;
13    f[L+4] = true;
14    f[L+5] = L;
15    assertEq(f[0], 12);
16    assertEq(f[1], 13);
17    assertEq(f[2], 13);
18    assertEq(f[3], -1);
19    assertEq(f[4], 1);
20    assertEq(f[5], 0);
21}
22
23function testUint32Array(L) {
24    var f = new Uint32Array(8);
25    assertEq(f[0], 0);
26    assertEq(f[L], 0);
27    assertEq(f[L+8], undefined);
28    assertEq(f[8], undefined);
29    f[0] = 12;
30    f[L+1] = 13;
31    f[2] = f[1];
32    f[L+3] = 4294967295;
33    f[L+4] = true;
34    f[L+5] = L;
35    assertEq(f[0], 12);
36    assertEq(f[1], 13);
37    assertEq(f[2], 13);
38    assertEq(f[3], 4294967295);
39    assertEq(f[4], 1);
40    assertEq(f[5], 0);
41}
42
43for (var i = 0; i < 10; i++) {
44    //testInt32Array(0);
45    testUint32Array(0);
46    if (i == 5)
47        gc();
48}
49