summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorYury Delendik <ydelendik@mozilla.com>2018-09-05 15:38:46 -0500
committerGitHub <noreply@github.com>2018-09-05 15:38:46 -0500
commit8900ceb7e1adf6b91374c236a30ad7f20b980106 (patch)
tree68f5e9e33b2184016b7029c9e792ca69e0824c0c /src
parentff5d6f922555469d59e04268a143a201197cdce7 (diff)
downloadbinaryen-8900ceb7e1adf6b91374c236a30ad7f20b980106.tar.gz
binaryen-8900ceb7e1adf6b91374c236a30ad7f20b980106.tar.bz2
binaryen-8900ceb7e1adf6b91374c236a30ad7f20b980106.zip
[wasm2js] Fix nested selects (#1671)
In wasmjs, the nested selects are trying to use the same temporary locals. The patch reserves temporaries "at right time" to avoid overriding the values.
Diffstat (limited to 'src')
-rw-r--r--src/wasm2js.h6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/wasm2js.h b/src/wasm2js.h
index 40f8e3057..a88f0fbdc 100644
--- a/src/wasm2js.h
+++ b/src/wasm2js.h
@@ -1966,12 +1966,12 @@ Ref Wasm2JSBuilder::processFunctionBody(Module* m, Function* func, IString resul
return ret;
}
// normal select
- Ref ifTrue = visit(curr->ifTrue, EXPRESSION_RESULT);
- Ref ifFalse = visit(curr->ifFalse, EXPRESSION_RESULT);
- Ref condition = visit(curr->condition, EXPRESSION_RESULT);
ScopedTemp tempIfTrue(curr->type, parent, func),
tempIfFalse(curr->type, parent, func),
tempCondition(i32, parent, func);
+ Ref ifTrue = visit(curr->ifTrue, EXPRESSION_RESULT);
+ Ref ifFalse = visit(curr->ifFalse, EXPRESSION_RESULT);
+ Ref condition = visit(curr->condition, EXPRESSION_RESULT);
return
ValueBuilder::makeSeq(
ValueBuilder::makeBinary(tempIfTrue.getAstName(), SET, ifTrue),