Bug 1585990 - Fix WebAssembly multi-value Ion codegen r=luke

Differential Revision: https://phabricator.services.mozilla.com/D48154

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Andy Wingo 2019-10-22 10:03:20 +00:00
Родитель 686acfc93a
Коммит 78f01e1de1
1 изменённых файлов: 30 добавлений и 12 удалений

Просмотреть файл

@ -1185,15 +1185,19 @@ class FunctionCompiler {
} }
public: public:
void pushDefs(const DefVector& defs) { MOZ_MUST_USE bool pushDefs(const DefVector& defs) {
if (inDeadCode()) { if (inDeadCode()) {
return; return true;
} }
MOZ_ASSERT(numPushed(curBlock_) == 0); MOZ_ASSERT(numPushed(curBlock_) == 0);
if (!curBlock_->ensureHasSlots(defs.length())) {
return false;
}
for (MDefinition* def : defs) { for (MDefinition* def : defs) {
MOZ_ASSERT(def->type() != MIRType::None); MOZ_ASSERT(def->type() != MIRType::None);
curBlock_->push(def); curBlock_->push(def);
} }
return true;
} }
bool popPushedDefs(DefVector* defs) { bool popPushedDefs(DefVector* defs) {
@ -1210,12 +1214,12 @@ class FunctionCompiler {
} }
private: private:
void addJoinPredecessor(const DefVector& defs, MBasicBlock** joinPred) { bool addJoinPredecessor(const DefVector& defs, MBasicBlock** joinPred) {
*joinPred = curBlock_; *joinPred = curBlock_;
if (inDeadCode()) { if (inDeadCode()) {
return; return true;
} }
pushDefs(defs); return pushDefs(defs);
} }
public: public:
@ -1249,7 +1253,9 @@ class FunctionCompiler {
if (!elseBlock) { if (!elseBlock) {
*thenJoinPred = nullptr; *thenJoinPred = nullptr;
} else { } else {
addJoinPredecessor(values, thenJoinPred); if (!addJoinPredecessor(values, thenJoinPred)) {
return false;
}
curBlock_ = elseBlock; curBlock_ = elseBlock;
mirGraph().moveBlockToEnd(curBlock_); mirGraph().moveBlockToEnd(curBlock_);
@ -1269,7 +1275,9 @@ class FunctionCompiler {
} }
MBasicBlock* elseJoinPred; MBasicBlock* elseJoinPred;
addJoinPredecessor(values, &elseJoinPred); if (!addJoinPredecessor(values, &elseJoinPred)) {
return false;
}
mozilla::Array<MBasicBlock*, 2> blocks; mozilla::Array<MBasicBlock*, 2> blocks;
size_t numJoinPreds = 0; size_t numJoinPreds = 0;
@ -1484,7 +1492,9 @@ class FunctionCompiler {
return false; return false;
} }
pushDefs(values); if (!pushDefs(values)) {
return false;
}
curBlock_->end(jump); curBlock_->end(jump);
curBlock_ = nullptr; curBlock_ = nullptr;
@ -1507,7 +1517,9 @@ class FunctionCompiler {
return false; return false;
} }
pushDefs(values); if (!pushDefs(values)) {
return false;
}
curBlock_->end(test); curBlock_->end(test);
curBlock_ = joinBlock; curBlock_ = joinBlock;
@ -1568,7 +1580,9 @@ class FunctionCompiler {
} }
} }
pushDefs(values); if (!pushDefs(values)) {
return false;
}
curBlock_->end(table); curBlock_->end(table);
curBlock_ = nullptr; curBlock_ = nullptr;
@ -1791,7 +1805,9 @@ static bool EmitElse(FunctionCompiler& f) {
return false; return false;
} }
f.pushDefs(thenValues); if (!f.pushDefs(thenValues)) {
return false;
}
if (!f.switchToElse(f.iter().controlItem(), &f.iter().controlItem())) { if (!f.switchToElse(f.iter().controlItem(), &f.iter().controlItem())) {
return false; return false;
@ -1811,7 +1827,9 @@ static bool EmitEnd(FunctionCompiler& f) {
MBasicBlock* block = f.iter().controlItem(); MBasicBlock* block = f.iter().controlItem();
f.iter().popEnd(); f.iter().popEnd();
f.pushDefs(preJoinDefs); if (!f.pushDefs(preJoinDefs)) {
return false;
}
DefVector postJoinDefs; DefVector postJoinDefs;
switch (kind) { switch (kind) {