Closed Bug 739572 Opened 12 years ago Closed 12 years ago

IonMonkey: Inline Array.prototype.{push,pop,shift,concat}

Categories

(Core :: JavaScript Engine, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: jandem, Assigned: jandem)

References

(Blocks 1 open bug)

Details

Attachments

(2 files, 1 obsolete file)

Kraken's crypto tests use array.push and array.concat a lot. JM+TI inlines these functions, and also inlines array.pop and array.shift. IM should do the same.
Attached patch Part 1: Inline pop and shift (obsolete) — Splinter Review
This is a small v8-deltablue win. I can land the jsarray* changes on m-c first.
Attachment #610058 - Flags: review?(dvander)
The stub calls js::array_push directly now. I think I will change part 1 to do the same to avoid the jsarray* changes/complexity.

I will add array.concat once we have inline object allocation.
Attachment #610129 - Flags: review?(dvander)
Comment on attachment 610058 [details] [diff] [review]
Part 1: Inline pop and shift

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

Nice.

::: js/src/ion/VMFunctions.cpp
@@ +238,5 @@
>  
> +static inline void
> +SetReturnOverrideIfInvalidated(JSContext *cx, const Value &rval)
> +{
> +    if (!GetTopIonJSScript(cx)->ion)

This isn't quite enough, I think, because ->ion could be ION_DISABLED_SCRIPT or (maybe worse). You need to cache the original IonScript. Maybe we should have an AutoDetectInvalidation.
Attachment #610058 - Flags: review?(dvander) → review+
Attachment #610129 - Flags: review?(dvander) → review+
Avoids most of the jsarray.* changes and I added the AutoDetectInvalidation class you suggested.
Attachment #610058 - Attachment is obsolete: true
Attachment #611511 - Flags: review?(dvander)
Comment on attachment 611511 [details] [diff] [review]
Part 1: Inline pop and shift - v2

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

::: js/src/ion/VMFunctions.cpp
@@ +252,5 @@
> +    // If the result is |undefined|, the array was probably empty and we
> +    // have to monitor the return value.
> +    *rval = argv[0];
> +    if (rval->isUndefined()) {
> +        AutoDetectInvalidation adi(cx, rval);

I think it's better to move these AutoDetectInvalidation calls to the very top, since a slight breeze can invalidate script->ion, it's safer to grab it ASAP.
Attachment #611511 - Flags: review?(dvander) → review+
Marking FIXED, we can file a follow-up for array.concat.
Status: ASSIGNED → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.