Closed Bug 531324 Opened 15 years ago Closed 15 years ago

nanojit: improve int32 constant generation in i386 backend

Categories

(Core :: JavaScript Engine, defect)

x86
Linux
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
In some places the i386 back-end will use xor(r,r) to generate a zero constant, which is more compact than loading a zero immediate.  But it doesn't look for this opportunity everywhere it could.

This patch creates a new function for generating constants that always tries to use xor(r,r) if possible.  There's a complication that xor(r,r) clobbers the condition codes, which causes problems in some places, so we allow for that.

The net result is that xor(r,r) is used in more places than before.
Attachment #414786 - Flags: review?(graydon)
Neat. Does it speed anything up? Also curious if the same can be done via a trailing default-false bool arg on the asm_int function, rather than an overload. I don't have a strong style preference, just erring on the side of "fewer functions".
(In reply to comment #1)
> Neat. Does it speed anything up? 

I might be seeing roughly a 3ms speedup for SunSpider -- I've tried it on a couple of revisions -- but it's being too noisy to tell for sure.

> Also curious if the same can be done via a
> trailing default-false bool arg on the asm_int function, rather than an
> overload.

The first asm_int() allocates a register, the second just emits the code, so that doesn't really work.  You could argue that the name shouldn't be reused, I was just following the X64 backend which has a similar overloading of asm_quad().

Are you happy with the patch?
Comment on attachment 414786 [details] [diff] [review]
patch

Yeah, sure. Thanks!
Attachment #414786 - Flags: review?(graydon) → review+
http://hg.mozilla.org/tracemonkey/rev/d4547fa92c0f
Whiteboard: fixed-in-nanojit → fixed-in-nanojit, fixed-in-tracemonkey
http://hg.mozilla.org/mozilla-central/rev/d4547fa92c0f
Status: ASSIGNED → RESOLVED
Closed: 15 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: