Bug 1439898: wasm: Don't render more unreachable items; r=lth

MozReview-Commit-ID: EQx4pzpuNhn

--HG--
extra : rebase_source : ab8ebfb5203faea19e079bd83d1541aaf79c219c
This commit is contained in:
Benjamin Bouvier 2018-02-22 20:01:34 +01:00
parent daf1b034f1
commit e33e3eaf64
2 changed files with 11 additions and 4 deletions

View File

@ -229,7 +229,7 @@ function get(instance, name) {
// code.
if (typeof WebAssembly.Global === "function")
return ValueResult(Number(instance.value.exports[name]));
return ValueResult(Number(instance.value.exports[name]));
return ValueResult(instance.value.exports[name]);
}

View File

@ -398,6 +398,9 @@ AstDecodeBrTable(AstDecodeContext& c)
if (!c.iter().readBrTable(&depths, &defaultDepth, &type, nullptr, nullptr))
return false;
if (c.iter().currentBlockHasPolymorphicBase())
return true;
AstRefVector table(c.lifo);
if (!table.resize(depths.length()))
return false;
@ -652,15 +655,19 @@ AstDecodeSelect(AstDecodeContext& c)
if (!c.iter().readSelect(&type, nullptr, nullptr, nullptr))
return false;
if (c.iter().currentBlockHasPolymorphicBase())
return true;
AstDecodeStackItem selectFalse = c.popCopy();
AstDecodeStackItem selectTrue = c.popCopy();
AstDecodeStackItem cond = c.popCopy();
AstTernaryOperator* ternary = new(c.lifo) AstTernaryOperator(Op::Select, cond.expr, selectTrue.expr, selectFalse.expr);
if (!ternary)
auto* select = new(c.lifo) AstTernaryOperator(Op::Select, cond.expr, selectTrue.expr,
selectFalse.expr);
if (!select)
return false;
if (!c.push(AstDecodeStackItem(ternary)))
if (!c.push(AstDecodeStackItem(select)))
return false;
return true;