The default bug view has changed. See this FAQ.

IonMonkey: Inline calls to constructors

RESOLVED FIXED

Status

()

Core
JavaScript Engine
RESOLVED FIXED
5 years ago
5 years ago

People

(Reporter: dvander, Assigned: sstangl)

Tracking

(Blocks: 2 bugs)

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

(Reporter)

Description

5 years ago
Right now we skip inlining a scripted function if the function is being called as a constructor.
(Assignee)

Updated

5 years ago
Assignee: general → sstangl
(Assignee)

Comment 1

5 years ago
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.
Attachment #637725 - Flags: review?(dvander)
(Assignee)

Comment 2

5 years ago
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)
(Reporter)

Comment 3

5 years ago
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+
(Assignee)

Comment 4

5 years ago
https://hg.mozilla.org/projects/ionmonkey/rev/f79d7ca811e6
Status: NEW → RESOLVED
Last Resolved: 5 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.