Closed Bug 517405 Opened 15 years ago Closed 15 years ago

nanojit: don't compute x86 FP conditions twice(!)

Categories

(Core :: JavaScript Engine, defect)

x86
macOS
defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: n.nethercote, Assigned: n.nethercote)

Details

(Whiteboard: fixed-in-nanojit, fixed-in-tracemonkey)

Attachments

(1 file)

Attached patch patchSplinter Review
asm_fcond() computes the condition twice.  Yes, you read that right.  Here's
example code:

      flt2 = flt fdiv1, js_BooleanOrUndefinedToNumber2
               ucomisd xmm0,xmm1
               lahf
               test ah, 5
               setnp eax
               movzx eax,eax
               ucomisd xmm1,xmm0
               seta eax
               movzx eax,eax

The first five instructions compute it (badly), then the last three
recompute it (better).  I don't know how this got past quality control, but
simply chopping out a few lines in Nativei386.cpp results in the first five
instructions being avoided.  Amusingly, the Sparc back-end is heavily based
on the x86 back-end but it doesn't make this mistake.

It doesn't speed up SunSpider, unfortunately, presumably because asm_fcond()
doesn't occur very often (most comparisons are handled within asm_.  In fact I'm getting a 6ms slow-down but that
clearly must be noise.
Attachment #401382 - Flags: review?(rreitmai)
Attachment #401382 - Flags: review?(rreitmai) → review+
Comment on attachment 401382 [details] [diff] [review]
patch

Good catch; maybe old cut&paste bug?
http://hg.mozilla.org/tracemonkey/rev/04014b568209
Whiteboard: fixed-in-nanojit → fixed-in-nanojit, fixed-in-tracemonkey
http://hg.mozilla.org/tracemonkey/rev/04014b568209
Status: ASSIGNED → RESOLVED
Closed: 15 years ago
Resolution: --- → FIXED
Depends on: 528305
No longer depends on: 528305
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: