Debian Codegraph @

js/src/jit-test/tests/basic/metadata-hook.js

raw
1
2 enableShellAllocationMetadataBuilder();
3
4 function Foo() {
5 this.x = 0;
6 this.y = 1;
7 }
8
9 function hello() {
10 function there() {
11 w = new Foo();
12 x = [1,2,3];
13 y = [2,3,5];
14 z = {a:0,b:1};
15 }
16 callee = there;
17 callee();
18 }
19 hello();
20
21 var wc = getAllocationMetadata(w).index;
22 var xc = getAllocationMetadata(x).index;
23 var yc = getAllocationMetadata(y).index;
24 var zc = getAllocationMetadata(z).index;
25
26 assertEq(xc > wc, true);
27 assertEq(yc > xc, true);
28 assertEq(zc > yc, true);
29 assertEq(getAllocationMetadata(x).stack[0], callee);
30 assertEq(getAllocationMetadata(x).stack[1], hello);