Closed Bug 818414 Opened 13 years ago Closed 13 years ago

CodeGenerator::visitValueToInt32 generates suboptimal code

Categories

(Core :: JavaScript Engine, defect)

x86
macOS
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla20

People

(Reporter: bzbarsky, Assigned: evilpies)

Details

Attachments

(1 file)

From JIT Inspector output: movq %rcx, %r11 shrq $47, %r11 cmpl $0x1fff1, %r11d je ((1014)) movq %rcx, %r11 shrq $47, %r11 cmpl $0x1fff3, %r11d je ((1034)) movq %rcx, %r11 shrq $47, %r11 cmpl $0x1fff0, %r11d ja ((1054)) The repeated movq/shrq are totally unnecessary, afaict. And later on after some maybe-jumps and a bit of playing with the xmm registers there's more of the same: movq %rcx, %r11 shrq $47, %r11 cmpl $0x1fff6, %r11d jne ((1111)) Seems like grabbing the tag once, then testing repeatedly, would be nicer...
Attached patch v1Splinter Review
Boris, good work, keep them coming. Looks like there are quite a few things that can be optimized when you actually look at the generated code.
Attachment #688905 - Flags: review?(jdemooij)
Assignee: general → evilpies
Status: NEW → ASSIGNED
Comment on attachment 688905 [details] [diff] [review] v1 Review of attachment 688905 [details] [diff] [review]: ----------------------------------------------------------------- Good catch.
Attachment #688905 - Flags: review?(jdemooij) → review+
Status: ASSIGNED → RESOLVED
Closed: 13 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla20
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: