Closed Bug 1115754 Opened 10 years ago Closed 9 years ago

Misc assembler optimizations

Categories

(Core :: JavaScript Engine: JIT, enhancement)

x86_64
All
enhancement
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla37

People

(Reporter: sunfish, Assigned: sunfish)

Details

Attachments

(4 files)

The following patches implement a variety of low-level x86 encoding optimizations.

First is a patch implementing optimized %eax encodings.
Attachment #8541752 - Flags: review?(jdemooij)
This patch optimizes movaps/movapd/movdqa to use 2-byte VEX prefixes instead of 3-byte ones in more cases.
Attachment #8541771 - Flags: review?(jdemooij)
This implements the %eax encoding optimizations for mov instructions.
Attachment #8541776 - Flags: review?(jdemooij)
This patch enables the use of 8-bit jump displacements for jumps where the destination is known (e.g. loop backedges).
Attachment #8541780 - Flags: review?(jdemooij)
OS: Linux → All
Attachment #8541752 - Flags: review?(jdemooij) → review+
Comment on attachment 8541771 [details] [diff] [review]
vex-shrink-moves.patch

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

Clever.
Attachment #8541771 - Flags: review?(jdemooij) → review+
Attachment #8541776 - Flags: review?(jdemooij) → review+
Comment on attachment 8541780 [details] [diff] [review]
jump-shrink.patch

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

Great, also nice cleanup.

::: js/src/jit/shared/BaseAssembler-x86-shared.h
@@ +2884,5 @@
> +        int32_t diff = dst.offset() - m_formatter.size();
> +        spew("jmp        .Llabel%d", dst.offset());
> +
> +        // The jump immediate is an offset from the end of the jump instruction.
> +        // An jump instrution is either 1 byte opcode and 1 byte offset, or 1

Nit: A jump instruction

@@ +2944,5 @@
> +        int32_t diff = dst.offset() - m_formatter.size();
> +        spew("j%s        .Llabel%d", nameCC(cond), dst.offset());
> +
> +        // The jump immediate is an offset from the end of the jump instruction.
> +        // A conditional jump instrution is either 1 byte opcode and 1 byte

Nit: instruction (typo)
Attachment #8541780 - Flags: review?(jdemooij) → review+
Comment on attachment 8541780 [details] [diff] [review]
jump-shrink.patch

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

We should have a way to enforce an absolute address for jumpWithPatch, or a way to ensure that we will SEGV if we ever try to insert a larger address than what is acceptable by the jump size.
Note that loop backedges are patchable in order to handle interuption callbacks.
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: