summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/profiler/native-trampoline.js
blob: e140874a1572190eaed5bc051aefa29e2eb8bef2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
enableGeckoProfilingWithSlowAssertions();

function testBasic() {
    var arr = [2, -1];
    var cmp = function(x, y) {
        readGeckoProfilingStack();
        return x - y;
    };
    for (var i = 0; i < 20; i++) {
        arr.sort(cmp);
    }
}
testBasic();

function testRectifierFrame() {
    var arr = [2, -1];
    var cmp = function(x, y, z, a) {
        readGeckoProfilingStack();
        return x - y;
    };
    for (var i = 0; i < 20; i++) {
        arr.sort(cmp);
    }
}
testRectifierFrame();

function testRectifierFrameCaller() {
    var o = {};
    var calls = 0;
    Object.defineProperty(o, "length", {get: function() {
        calls++;
        readGeckoProfilingStack();
        return 0;
    }});
    for (var i = 0; i < 20; i++) {
        Array.prototype.sort.call(o);
    }
    assertEq(calls, 20);
}
testRectifierFrameCaller();