Closed Bug 894582 Opened 11 years ago Closed 11 years ago

IonMonkey: constant fold arithm operations with double output that fits in int32

Categories

(Core :: JavaScript Engine, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla25

People

(Reporter: h4writer, Assigned: h4writer)

Details

Attachments

(1 file, 1 obsolete file)

Noticed this on kraken-stanford-crypto-ccm. EvaluateConstantOperands uses setNumber what will try to put the value in int32 if possible. Now if the output result needs to be in double, we won't constant fold, since the types don't match. But we can just transform the int32 result to double without precision loss.
Attached patch Patch (obsolete) — Splinter Review
Assignee: general → hv1989
Attachment #776659 - Flags: review?(jdemooij)
Comment on attachment 776659 [details] [diff] [review]
Patch

Review of attachment 776659 [details] [diff] [review]:
-----------------------------------------------------------------

Nice find!

::: js/src/ion/MIR.cpp
@@ +123,5 @@
>      }
>  
> +    // setNumber eagerly transforms a number to int32.
> +    // Transform back to double, if the output type is double.
> +    if (ins->type() == MIRType_Double && MIRTypeFromValue(ret) == MIRType_Int32)

You can use ret.isInt32() instead of MIRTypeFromValue(ret) == MIRType_Int32.
Attachment #776659 - Flags: review?(jdemooij) → review+
Attached patch PatchSplinter Review
Attachment #776659 - Attachment is obsolete: true
Keywords: checkin-needed
https://hg.mozilla.org/mozilla-central/rev/7c5c7d816fbb
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla25
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: