Last Comment Bug 689779 - IonMonkey: Eliminate negative zero checks for a*a
: IonMonkey: Eliminate negative zero checks for a*a
Product: Core
Classification: Components
Component: JavaScript Engine (show other bugs)
: unspecified
: All All
-- normal (vote)
: ---
Assigned To: Terrence Cole [:terrence]
: Jason Orendorff [:jorendorff]
Depends on:
  Show dependency treegraph
Reported: 2011-09-27 15:54 PDT by David Anderson [:dvander]
Modified: 2011-10-21 17:25 PDT (History)
2 users (show)
See Also:
Crash Signature:
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---

benchmark (364 bytes, application/javascript)
2011-09-27 15:54 PDT, David Anderson [:dvander]
no flags Details
First attempt. (1.86 KB, patch)
2011-09-29 11:58 PDT, Terrence Cole [:terrence]
no flags Details | Diff | Splinter Review
v2 (1.63 KB, patch)
2011-09-29 12:40 PDT, Terrence Cole [:terrence]
dvander: review+
Details | Diff | Splinter Review
rebased (1.60 KB, patch)
2011-10-18 16:02 PDT, Terrence Cole [:terrence]
no flags Details | Diff | Splinter Review

Description User image David Anderson [:dvander] 2011-09-27 15:54:31 PDT
Created attachment 562892 [details]

In the attached benchmark, we could get a significant speedup from removing the negative zero check on the multiplication. We should be able to do this in MIR by seeing that (a * a) will never be negative.
Comment 1 User image Terrence Cole [:terrence] 2011-09-29 11:58:14 PDT
Created attachment 563502 [details] [diff] [review]
First attempt.

Speedup is 1.12x, but I need some feedback on the patch's specifics:

1) I think isCongruent is a more specific (and costly) test that we want for this, but I could be quite wrong.

2) Is there a way to implement this check without having to copy the body of MBinaryArithInstruction::foldsTo?

3) Should I add a setter for canBeNegativeZero_?
Comment 2 User image Terrence Cole [:terrence] 2011-09-29 12:40:05 PDT
Created attachment 563524 [details] [diff] [review]

Shorter patch using congruentTo and calling out to super (requires us to re-acquire lhs/rhs).  It seems to be epsilon slower than v1 in the benchmark, but it's well within the error bars.
Comment 3 User image David Anderson [:dvander] 2011-10-05 10:44:08 PDT
Comment on attachment 563524 [details] [diff] [review]

Comment 4 User image Terrence Cole [:terrence] 2011-10-18 16:02:06 PDT
Created attachment 567918 [details] [diff] [review]

I still don't have commit access, but that's no reason to let this bitrot.
Comment 5 User image David Anderson [:dvander] 2011-10-21 17:25:25 PDT

Note You need to log in before you can comment on or make changes to this bug.