summaryrefslogtreecommitdiff
path: root/test/debugInfo.asm.js
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2017-04-28 10:48:27 -0700
committerGitHub <noreply@github.com>2017-04-28 10:48:27 -0700
commit5d4f9eb82226acc0fdb5e2dea1a04e17c340c371 (patch)
treeb1b18217aec65f04da0080a1d6d2266489d56db7 /test/debugInfo.asm.js
parenta0b162d13c7e8d5df1f1b6e33efd4d9e3f699aa9 (diff)
downloadbinaryen-5d4f9eb82226acc0fdb5e2dea1a04e17c340c371.tar.gz
binaryen-5d4f9eb82226acc0fdb5e2dea1a04e17c340c371.tar.bz2
binaryen-5d4f9eb82226acc0fdb5e2dea1a04e17c340c371.zip
Preserve debug info through the optimizer (#981)
* add debugInfo option to passes, and use it to keep debug info alive through optimizations when we need it * add fib testcase for debug info * when preserving debug info, do not move code around call-imports, so debug info intrinsics remain stationary * improve wasm-module-building handling of the single-threaded case: don't create workers, which is more efficient and also nicer for debugging * process debug info in a more precise way, reordering it from being after the node (as it was a comment in JS) to before the node * remove unreachable hack for debug info, which is no longer needed since we reorder them, and make sure to finalize blocks in which we reorder
Diffstat (limited to 'test/debugInfo.asm.js')
-rw-r--r--test/debugInfo.asm.js62
1 files changed, 61 insertions, 1 deletions
diff --git a/test/debugInfo.asm.js b/test/debugInfo.asm.js
index 929d79804..29b08575a 100644
--- a/test/debugInfo.asm.js
+++ b/test/debugInfo.asm.js
@@ -1,5 +1,6 @@
function () {
"use asm";
+ var STACKTOP = 0;
function add(x, y) {
x = x | 0;
y = y | 0;
@@ -21,6 +22,65 @@ function () {
x = (x | 0) % (y | 0); //@line 3 "even-opted.cpp"
return x + y | 0;
}
- return { add: add, ret: ret, opts: opts };
+ function fib($0) {
+ $0 = $0|0;
+ var $$0$lcssa = 0, $$01518 = 0, $$01518$phi = 0, $$01617 = 0, $$019 = 0, $1 = 0, $2 = 0, $3 = 0, $exitcond = 0, label = 0, sp = 0;
+ sp = STACKTOP;
+ $1 = ($0|0)>(0); //@line 3 "fib.c"
+ if ($1) {
+ $$01518 = 0;$$01617 = 0;$$019 = 1;
+ } else {
+ $$0$lcssa = 1;
+ return ($$0$lcssa|0); //@line 8 "fib.c"
+ }
+ while(1) {
+ $2 = (($$019) + ($$01518))|0; //@line 4 "fib.c"
+ $3 = (($$01617) + 1)|0; //@line 3 "fib.c"
+ $exitcond = ($3|0)==($0|0); //@line 3 "fib.c"
+ if ($exitcond) {
+ $$0$lcssa = $2;
+ break;
+ } else {
+ $$01518$phi = $$019;$$01617 = $3;$$019 = $2;$$01518 = $$01518$phi;
+ }
+ }
+ return ($$0$lcssa|0); //@line 8 "fib.c"
+ }
+ function switch_reach($p) {
+ $p = $p|0;
+ var $0 = 0, $call = 0, $magic = 0, $rc$0 = 0, $switch$split2D = 0, label = 0, sp = 0;
+ sp = STACKTOP;
+ $magic = ((($p)) + 52|0);
+ $0 = $magic;
+ $switch$split2D = ($0|0)<(1369188723);
+ if ($switch$split2D) {
+ switch ($0|0) {
+ case -1108210269: {
+ label = 2;
+ break;
+ }
+ default: {
+ $rc$0 = 0;
+ }
+ }
+ } else {
+ switch ($0|0) {
+ case 1369188723: {
+ label = 2;
+ break;
+ }
+ default: {
+ $rc$0 = 0;
+ }
+ }
+ }
+ if ((label|0) == 2) {
+ $call = switch_reach($p) | 0;
+ $rc$0 = $call;
+ }
+ switch_reach($p) | 0;
+ return ($rc$0|0); //@line 59950 "/tmp/emscripten_test_binaryen2_28hnAe/src.c"
+ }
+ return { add: add, ret: ret, opts: opts, fib: fib, switch_reach: switch_reach };
}