mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1028573 - Implement RInstruction for MathFunction::round. r=nbp
This commit is contained in:
parent
12e818afee
commit
494e623000
@ -163,14 +163,22 @@ function radd_float(i) {
|
||||
return i;
|
||||
}
|
||||
|
||||
var uceFault_round = eval(uneval(uceFault).replace('uceFault', 'uceFault_round'));
|
||||
var uceFault_round_number = eval(uneval(uceFault).replace('uceFault', 'uceFault_round'));
|
||||
function rround_number(i) {
|
||||
var x = Math.round(i + 1.4);
|
||||
if (uceFault_round(i) || uceFault_round(i))
|
||||
if (uceFault_round_number(i) || uceFault_round_number(i))
|
||||
assertEq(x, 100); /* = i + 1*/
|
||||
return i;
|
||||
}
|
||||
|
||||
var uceFault_round_double = eval(uneval(uceFault).replace('uceFault', 'uceFault_round_double'));
|
||||
function rround_double(i) {
|
||||
var x = Math.round(i + (-1 >>> 0));
|
||||
if (uceFault_round_double(i) || uceFault_round_double(i))
|
||||
assertEq(x, 99 + (-1 >>> 0)); /* = i + 2 ^ 32 - 1 */
|
||||
return i;
|
||||
}
|
||||
|
||||
var uceFault_add_object = eval(uneval(uceFault).replace('uceFault', 'uceFault_add_object'));
|
||||
function radd_object(i) {
|
||||
var t = i;
|
||||
@ -355,6 +363,7 @@ for (i = 0; i < 100; i++) {
|
||||
rconcat_string(i);
|
||||
rconcat_number(i);
|
||||
rround_number(i);
|
||||
rround_double(i);
|
||||
rpow_number(i);
|
||||
rpow_object(i);
|
||||
}
|
||||
|
@ -4321,6 +4321,10 @@ class MMathFunction
|
||||
}
|
||||
void trySpecializeFloat32(TempAllocator &alloc);
|
||||
void computeRange(TempAllocator &alloc);
|
||||
bool writeRecoverData(CompactBufferWriter &writer) const;
|
||||
bool canRecoverOnBailout() const {
|
||||
return function_ == Round;
|
||||
}
|
||||
};
|
||||
|
||||
class MAdd : public MBinaryArithInstruction
|
||||
|
@ -560,6 +560,20 @@ RPow::recover(JSContext *cx, SnapshotIterator &iter) const
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
MMathFunction::writeRecoverData(CompactBufferWriter &writer) const
|
||||
{
|
||||
MOZ_ASSERT(canRecoverOnBailout());
|
||||
switch (function_) {
|
||||
case Round:
|
||||
writer.writeUnsigned(uint32_t(RInstruction::Recover_Round));
|
||||
return true;
|
||||
default:
|
||||
MOZ_ASSUME_UNREACHABLE("Unknown math function.");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
bool
|
||||
MNewObject::writeRecoverData(CompactBufferWriter &writer) const
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user