Closed Bug 768270 Opened 12 years ago Closed 12 years ago

IonMonkey: Inline calls to constructors

Categories

(Core :: JavaScript Engine, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: dvander, Assigned: sstangl)

References

(Blocks 2 open bugs)

Details

Attachments

(1 file)

Right now we skip inlining a scripted function if the function is being called as a constructor.
Assignee: general → sstangl
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.
Attachment #637725 - Flags: review?(dvander)
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 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?
Attachment #637725 - Flags: review?(dvander) → review+
https://hg.mozilla.org/projects/ionmonkey/rev/f79d7ca811e6
Status: NEW → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.