Open Bug 1700422 Opened 4 years ago Updated 2 months ago

Support constructors in scalar replacement

Categories

(Core :: JavaScript Engine: JIT, task, P3)

task

Tracking

()

People

(Reporter: iain, Unassigned)

References

(Blocks 1 open bug)

Details

Given a simple constructor like function Point(x,y) { this.x = x; this.y = y; }, it should be possible to inline calls to that constructor and scalar-replace the result object. Right now, we don't. The biggest obstacle is that we don't support scalar replacement of AddAndStoreSlot. We might be able to fix that if IsObjectEscaped passed along the current shape of the object.

Digging into this a little, it looks like it worked in Ion (implemented in bug 1064358). Maybe it broke when we removed the definite properties analysis?

(In reply to Iain Ireland [:iain] from comment #0)

Digging into this a little, it looks like it worked in Ion (implemented in bug 1064358). Maybe it broke when we removed the definite properties analysis?

It worked in Ion because type inference (TI) was in charge to iterate once over the code, using Ion as an Analysis, to construct a single object with all properties already created.

We might be able to use Scalar Replacement for constructed object even when escaped, in order to recover the same feature as TI provided. This would work as long as escaping instructions prevent any further replacement from happening. — edit: and the we handle the merging blocks.

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