Closed Bug 807185 Opened 7 years ago Closed 7 years ago

IonMonkey: optimize the non-native test in visitCallGeneric

Categories

(Core :: JavaScript Engine, defect)

defect
Not set

Tracking

()

RESOLVED FIXED
mozilla19

People

(Reporter: luke, Assigned: luke)

References

Details

(Whiteboard: [ion:t])

Attachments

(1 file)

In the earlier JSFunction days you had to mask flags with JSFUN_KINDMASK and then compare against JSFUN_INTERPRETED.  Now that that gunk has been cleared, JSFUN_INTERPRETED is a single bit and can be tested directly.  dvander said this code was hot (hence the custom load16ZeroExtend_mask which could now be removed).  Ideally, I think, we'd load an (aligned) 32-bit word (at offset 0 in JSFunction) and test JSFUN_INTERPRETED bit shifted appropriately).
I forgot to mention, there is the same test in visitApplyArgsGeneric.
Great! Good good good.

Since no code requires |flags| after this test, on x86 and x86_64, where TEST exists with signature r/m32,r32 (or r/m32,i32), we could even perform the test without loading into a register.
Attached patch patchSplinter Review
I can see a distinct 2-3% speedup on a micro-benchmark that has a polymorphic callsite.  SS and V8 seem unaffected.
Assignee: general → luke
Status: NEW → ASSIGNED
Attachment #677237 - Flags: review?(sstangl)
Oh yeah, this applies on top of bug 807228.
Depends on: 807228
Comment on attachment 677237 [details] [diff] [review]
patch

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

::: js/src/ion/IonMacroAssembler.h
@@ +269,5 @@
> +        // 16-bit loads are slow and unaligned 32-bit loads may be too so
> +        // perform an aligned 32-bit load and adjust the bitmask accordingly.
> +        JS_STATIC_ASSERT(offsetof(JSFunction, nargs) % sizeof(uint32_t) == 0);
> +        JS_STATIC_ASSERT(offsetof(JSFunction, flags) == offsetof(JSFunction, nargs) + 2);
> +        JS_STATIC_ASSERT(IS_LITTLE_ENDIAN);

These asserts are extremely thorough. Hopefully, future modifications to this file will use them as an example.
Attachment #677237 - Flags: review?(sstangl) → review+
https://hg.mozilla.org/mozilla-central/rev/2628f57bdd4b
Status: ASSIGNED → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla19
You need to log in before you can comment on or make changes to this bug.