Last Comment Bug 768270 - IonMonkey: Inline calls to constructors
: IonMonkey: Inline calls to constructors
Status: RESOLVED FIXED
:
Product: Core
Classification: Components
Component: JavaScript Engine (show other bugs)
: unspecified
: All All
: -- normal (vote)
: ---
Assigned To: Sean Stangl [:sstangl]
:
Mentors:
Depends on:
Blocks: IonSpeed 765980
  Show dependency treegraph
 
Reported: 2012-06-25 16:54 PDT by David Anderson [:dvander]
Modified: 2012-06-28 19:01 PDT (History)
3 users (show)
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---


Attachments
Inline calls to constructors. (17.16 KB, patch)
2012-06-28 16:25 PDT, Sean Stangl [:sstangl]
dvander: review+
Details | Diff | Splinter Review

Description David Anderson [:dvander] 2012-06-25 16:54:59 PDT
Right now we skip inlining a scripted function if the function is being called as a constructor.
Comment 1 Sean Stangl [:sstangl] 2012-06-28 16:25:21 PDT
Created attachment 637725 [details] [diff] [review]
Inline calls to constructors.

Straightforward. Allocation of |this| is performed caller-side; return value stitching is done by the caller to the callee's blocks.

Perf gains are minimal -- many inlining sites are denied by the Oracle due to a likely-bogus TypeBarrier on the return. Also affects non-constructors. Leaving for a separate bug.
Comment 2 Sean Stangl [:sstangl] 2012-06-28 16:38:41 PDT
Results from x86 on a tiny benchmark that does not suffer from TI denial:

> function Foo() {
>   this.x = 5;
>   this.y = 6;
> }
> 
> function f() {
>   var a = 0;
>   for (var i = 0; i < 100000000; i++) {
>     var x = new Foo();
>     a += x.y;
>   }
>   return a;
> }
>
> f();

with patch: 2.56s
--ion-inlining=off: 3.11s
--no-ion: 2.95s

v8: 0.60s (generational)
Comment 3 David Anderson [:dvander] 2012-06-28 17:31:02 PDT
Comment on attachment 637725 [details] [diff] [review]
Inline calls to constructors.

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

::: js/src/ion/MIR.h
@@ +1524,5 @@
> +// Given a MIRType_Value A and a MIRType_Object B:
> +// If the Value may be safely unboxed to an Object, return Object(A).
> +// Otherwise, return B.
> +// Used to implement return behavior for inlined constructors.
> +class MFilterObject

MReturnFromCtor?
Comment 4 Sean Stangl [:sstangl] 2012-06-28 19:01:55 PDT
https://hg.mozilla.org/projects/ionmonkey/rev/f79d7ca811e6

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