asm-frames.js (697B)
1 function AsmModule(stdlib, foreign, heap) { 2 "use asm"; 3 var ffi = foreign.t; 4 5 function doTest() { 6 ffi(); 7 } 8 9 function test() { 10 doTest(); 11 } 12 13 return { test: test }; 14 } 15 16 let stack; 17 18 function tester() { 19 stack = saveStack(); 20 } 21 22 const buf = new ArrayBuffer(1024*8); 23 const module = AsmModule(this, { t: tester }, buf); 24 module.test(); 25 26 print(stack); 27 assertEq(stack.functionDisplayName, "tester"); 28 29 assertEq(stack.parent.functionDisplayName, "doTest"); 30 assertEq(stack.parent.line, 6); 31 32 assertEq(stack.parent.parent.functionDisplayName, "test"); 33 assertEq(stack.parent.parent.line, 10); 34 35 assertEq(stack.parent.parent.parent.line, 24); 36 37 assertEq(stack.parent.parent.parent.parent, null);