Closed Bug 1323099 Opened 8 years ago Closed 7 years ago

Ion GetProperty IC should be used when the input is a Value

Categories

(Core :: JavaScript Engine: JIT, defect, P3)

defect

Tracking

()

RESOLVED FIXED
mozilla54
Performance Impact none
Tracking Status
firefox54 --- fixed

People

(Reporter: jandem, Assigned: jandem)

References

(Blocks 1 open bug)

Details

Attachments

(1 file)

Ion ICs are currently only used when the input is an object. This covers the majority of cases, but we have seen benchmarks (Octane-crypto is one of them, IIRC) that do something like x.length/x.toString()/x[i] where x is {string, object}.

Once bug 1322093 is fixed, it will be easy to fix this: we can upgrade the object-Register in IonGetPropertyIC to a TypedOrValueRegister and make the C++ fallback function take a Value, and then we should automatically emit the right guards and regalloc stuff.

Filing this now so I don't forget about it.
If I recall correctly, this case appears in react code as well. (see Bug 1301690)
I had some WIP patches for this that worked fine. I'll try to get them landed this cycle.
Assignee: nobody → jdemooij
Status: NEW → ASSIGNED
Attached patch Part 1 - GetPropSplinter Review
This patch changes the GetPropertyIC to take a TypedOrValueRegister as input, so now it can be used for any JSOP_GETPROP. We no longer need the shared stub or MCallGetProperty (there are some other places that use this so we can't remove it).

Later we can do something similar for JSOP_GETELEM.
Attachment #8829782 - Flags: review?(hv1989)
For register usage wouldn't it be better to have an object and a value version of GetPropertyCache?
(In reply to Tom Schuster [:evilpie] from comment #4)
> For register usage wouldn't it be better to have an object and a value
> version of GetPropertyCache?

We use a TypedOrValueRegister, so it's either an object register (as before) or a boxed Value.
Comment on attachment 8829782 [details] [diff] [review]
Part 1 - GetProp

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

Nice!

::: js/src/jit/Lowering.cpp
@@ +3656,5 @@
>          defineBox(lir, ins);
>          assignSafepoint(lir, ins);
>      } else {
>          LGetPropertyCacheT* lir =
> +            new(alloc()) LGetPropertyCacheT(useBoxOrTypedOrConstant(value, /* useConst = */ false),

Shouldn't we introduce "useBoxOrTyped" for this?
Attachment #8829782 - Flags: review?(hv1989) → review+
Pushed by jandemooij@gmail.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/bb0de976a39e
part 1 - Use Ion GetPropertyIC also when the input is a boxed Value. r=h4writer
(In reply to Hannes Verschore [:h4writer] from comment #6)
> Shouldn't we introduce "useBoxOrTyped" for this?

Good idea. I added useBoxOrTyped and changed useBoxOrTypedOrConstant to call that in the not-a-constant case.
Keywords: leave-open
There's more to do here (for JSOP_GETELEM) but let's close this one to make it easier to track this.
Status: ASSIGNED → RESOLVED
Closed: 7 years ago
Keywords: leave-open
Resolution: --- → FIXED
Target Milestone: --- → mozilla54
Performance Impact: --- → -
Whiteboard: [qf-]
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: