Last Comment Bug 739572 - IonMonkey: Inline Array.prototype.{push,pop,shift,concat}
: IonMonkey: Inline Array.prototype.{push,pop,shift,concat}
Status: RESOLVED FIXED
:
Product: Core
Classification: Components
Component: JavaScript Engine (show other bugs)
: unspecified
: All All
: -- normal (vote)
: ---
Assigned To: Jan de Mooij [:jandem]
:
:
Mentors:
Depends on:
Blocks: IonSpeed
  Show dependency treegraph
 
Reported: 2012-03-27 05:36 PDT by Jan de Mooij [:jandem]
Modified: 2012-07-27 17:07 PDT (History)
4 users (show)
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---


Attachments
Part 1: Inline pop and shift (40.34 KB, patch)
2012-03-28 03:03 PDT, Jan de Mooij [:jandem]
dvander: review+
Details | Diff | Splinter Review
Part 2: Inline push (25.82 KB, patch)
2012-03-28 07:36 PDT, Jan de Mooij [:jandem]
dvander: review+
Details | Diff | Splinter Review
Part 1: Inline pop and shift - v2 (39.45 KB, patch)
2012-04-02 10:28 PDT, Jan de Mooij [:jandem]
dvander: review+
Details | Diff | Splinter Review

Description Jan de Mooij [:jandem] 2012-03-27 05:36:29 PDT
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.
Comment 1 Jan de Mooij [:jandem] 2012-03-28 03:03:51 PDT
Created attachment 610058 [details] [diff] [review]
Part 1: Inline pop and shift

This is a small v8-deltablue win. I can land the jsarray* changes on m-c first.
Comment 2 Jan de Mooij [:jandem] 2012-03-28 07:36:18 PDT
Created attachment 610129 [details] [diff] [review]
Part 2: Inline push

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.
Comment 3 David Anderson [:dvander] 2012-03-29 11:48:43 PDT
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.
Comment 4 Jan de Mooij [:jandem] 2012-04-02 10:28:48 PDT
Created attachment 611511 [details] [diff] [review]
Part 1: Inline pop and shift - v2

Avoids most of the jsarray.* changes and I added the AutoDetectInvalidation class you suggested.
Comment 5 David Anderson [:dvander] 2012-04-02 12:59:41 PDT
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.
Comment 6 Jan de Mooij [:jandem] 2012-04-03 01:47:28 PDT
https://hg.mozilla.org/projects/ionmonkey/rev/cdc5f3570a4c
https://hg.mozilla.org/projects/ionmonkey/rev/7b2c14a9fde2

Keeping this bug open for array.concat.
Comment 7 David Anderson [:dvander] 2012-07-27 17:07:50 PDT
Marking FIXED, we can file a follow-up for array.concat.

Note You need to log in before you can comment on or make changes to this bug.