Closed Bug 864265 Opened 7 years ago Closed 7 years ago

Check for integer exponent in ecmaPow instead of js_math_pow

Categories

(Core :: JavaScript Engine, defect)

defect
Not set

Tracking

()

RESOLVED FIXED
mozilla23

People

(Reporter: jandem, Assigned: jandem)

References

(Blocks 1 open bug)

Details

Attachments

(1 file)

Attached patch PatchSplinter Review
Math.pow is often called with an exponent that's either int32 or double. js_math_pow already has a check for integer-valued doubles, but Ion code calls ecmaPow directly so we should just move the check there.

This is a noticeable win on Kraken imaging-darkroom and Octane-raytrace.
Attachment #740216 - Flags: review?(hv1989)
Comment on attachment 740216 [details] [diff] [review]
Patch

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

Nice catch! Didn't see this one when investigating raytrace.

::: js/src/jsmath.cpp
@@ +498,5 @@
>  #endif
>  JSBool
>  js_math_pow(JSContext *cx, unsigned argc, Value *vp)
>  {
> +    double x, y;

I think you can leave the definition "z" here at the top.
(This is just to have at least 1 comment :P)
Attachment #740216 - Flags: review?(hv1989) → review+
Thanks for the quick review! Convention is to declare vars as close as possible to their first use, so I left the "double z" there.

https://hg.mozilla.org/integration/mozilla-inbound/rev/ebb2d369bad2
Blocks: 768745
https://hg.mozilla.org/mozilla-central/rev/ebb2d369bad2
Status: ASSIGNED → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla23
You need to log in before you can comment on or make changes to this bug.