зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1195588: IonMonkey - Actually convert number to double during recovering ToDouble, r=nbp
@@ -1093,20 +1097,28 @@ MToDouble::writeRecoverData(CompactBuffe } RToDouble::RToDouble(CompactBufferReader& reader) { } bool RToDouble::recover(JSContext* cx, SnapshotIterator& iter) const { - Value v = iter.read(); + RootedValue v(cx, iter.read()); + RootedValue result(cx); MOZ_ASSERT(!v.isObject()); - iter.storeInstructionResult(v); + MOZ_ASSERT(!v.isSymbol()); + + double dbl; + if (!ToNumber(cx, v, &dbl)) + return false; + + result.setDouble(dbl); + iter.storeInstructionResult(result); return true; } bool MToFloat32::writeRecoverData(CompactBufferWriter& writer) const { MOZ_ASSERT(canRecoverOnBailout()); writer.writeUnsigned(uint32_t(RInstruction::Recover_ToFloat32));
This commit is contained in:
Родитель
4265c0e543
Коммит
c337c5963d
|
@ -0,0 +1,15 @@
|
|||
function m(f) {
|
||||
for (var k = 0; k < 2; ++k) {
|
||||
try {
|
||||
f()
|
||||
} catch (e) {}
|
||||
}
|
||||
}
|
||||
function g(i) {
|
||||
x
|
||||
}
|
||||
m(g)
|
||||
function h() {
|
||||
g(Math.sqrt(+((function() {}) < 1)))
|
||||
}
|
||||
m(h)
|
|
@ -1098,10 +1098,18 @@ RToDouble::RToDouble(CompactBufferReader& reader)
|
|||
bool
|
||||
RToDouble::recover(JSContext* cx, SnapshotIterator& iter) const
|
||||
{
|
||||
Value v = iter.read();
|
||||
RootedValue v(cx, iter.read());
|
||||
RootedValue result(cx);
|
||||
|
||||
MOZ_ASSERT(!v.isObject());
|
||||
iter.storeInstructionResult(v);
|
||||
MOZ_ASSERT(!v.isSymbol());
|
||||
|
||||
double dbl;
|
||||
if (!ToNumber(cx, v, &dbl))
|
||||
return false;
|
||||
|
||||
result.setDouble(dbl);
|
||||
iter.storeInstructionResult(result);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче