Bug 1593015 - Fix WebAssembly baseline codegen for if/then/else with parameters r=lth
authorAndy Wingo <wingo@igalia.com>
Tue, 05 Nov 2019 15:42:12 +0000
changeset 500610 5bfb9d257c441384b0217032236bab42b59374c8
parent 500609 0dfb81870b77e26e03415627ca6407daec0ea1f0
child 500611 f0e9baa206dc4318293804c2c2ccca5c9eb7258e
push id99722
push usercsabou@mozilla.com
push dateTue, 05 Nov 2019 15:44:02 +0000
treeherderautoland@5bfb9d257c44 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerslth
bugs1593015
milestone72.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1593015 - Fix WebAssembly baseline codegen for if/then/else with parameters r=lth Differential Revision: https://phabricator.services.mozilla.com/D51285
js/src/wasm/WasmBaselineCompile.cpp
--- a/js/src/wasm/WasmBaselineCompile.cpp
+++ b/js/src/wasm/WasmBaselineCompile.cpp
@@ -8613,29 +8613,31 @@ bool BaseCompiler::emitIf() {
   ResultType params;
   Nothing unused_cond;
   if (!iter_.readIf(&params, &unused_cond)) {
     return false;
   }
 
   BranchState b(&controlItem().otherLabel, InvertBranch(true));
   if (!deadCode_) {
+    needResultRegisters(params);
     emitBranchSetup(&b);
+    freeResultRegisters(params);
     sync();
-    // Because params can flow immediately to results in the case of an empty
-    // "then" or "else" block, and the result of an if/then is a join in
-    // general, we shuffle params eagerly to the result allocations.
-    topBlockResults(params);
   } else {
     resetLatentOp();
   }
 
   initControl(controlItem(), params);
 
   if (!deadCode_) {
+    // Because params can flow immediately to results in the case of an empty
+    // "then" or "else" block, and the result of an if/then is a join in
+    // general, we shuffle params eagerly to the result allocations.
+    topBlockResults(params);
     emitBranchPerform(&b);
   }
 
   return true;
 }
 
 void BaseCompiler::endIfThen(ResultType type) {
   Control& ifThen = controlItem();
@@ -8721,16 +8723,17 @@ bool BaseCompiler::emitElse() {
   }
 
   deadCode_ = ifThenElse.deadOnArrival;
   bceSafe_ = ifThenElse.bceSafeOnEntry;
 
   fr.resetStackHeight(ifThenElse.stackHeight, params);
 
   if (!deadCode_) {
+    captureResultRegisters(params);
     pushBlockResults(params);
   }
 
   return true;
 }
 
 void BaseCompiler::endIfThenElse(ResultType type) {
   Control& ifThenElse = controlItem();