Bug 1285522: Don't DCE opcodes which can throw exceptions at runtime; r=sunfish

MozReview-Commit-ID: 6TppTpNJ1Kx

--HG--
extra : rebase_source : 016b7055f664ff69a274454218818cc796c8b4be
This commit is contained in:
Benjamin Bouvier 2016-07-06 18:26:21 +02:00
Родитель 2d3673925f
Коммит 6b289d22cc
2 изменённых файлов: 7 добавлений и 1 удалений

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

@ -1,4 +1,4 @@
// |jit-test| test-also-wasm-baseline
// TODO dce'd effectful instructions
// TODO (baseline should trap on invalid conversion)
quit();
var importedArgs = ['traps.wast']; load(scriptdir + '../spec.js');

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

@ -5210,6 +5210,7 @@ class MWasmTruncateToInt64
isUnsigned_(isUnsigned)
{
setResultType(MIRType::Int64);
setGuard(); // not removable because of possible side-effects.
setMovable();
}
@ -5242,6 +5243,7 @@ class MWasmTruncateToInt32
: MUnaryInstruction(def), isUnsigned_(isUnsigned)
{
setResultType(MIRType::Int32);
setGuard(); // not removable because of possible side-effects.
setMovable();
}
@ -6737,6 +6739,8 @@ class MDiv : public MBinaryArithInstruction
MDiv* div = new(alloc) MDiv(left, right, type);
div->unsigned_ = unsignd;
div->trapOnError_ = trapOnError;
if (trapOnError)
div->setGuard(); // not removable because of possible side-effects.
if (type == MIRType::Int32)
div->setTruncateKind(Truncate);
return div;
@ -6861,6 +6865,8 @@ class MMod : public MBinaryArithInstruction
MMod* mod = new(alloc) MMod(left, right, type);
mod->unsigned_ = unsignd;
mod->trapOnError_ = trapOnError;
if (trapOnError)
mod->setGuard(); // not removable because of possible side-effects.
if (type == MIRType::Int32)
mod->setTruncateKind(Truncate);
return mod;