Closed Bug 1739650 Opened 4 years ago Closed 4 years ago

Support array scalar replacement for MApplyArray and MConstructArray

Categories

(Core :: JavaScript Engine: JIT, enhancement, P1)

enhancement

Tracking

()

RESOLVED FIXED
96 Branch
Tracking Status
firefox96 --- fixed

People

(Reporter: anba, Assigned: anba)

References

(Blocks 1 open bug)

Details

Attachments

(2 external files)

This is useful when inlining spread calls, for example in default derived class constructors.

class C extends class {} {}

new C(1, 2, 3);

currently generates:

((4)) resumepoint 37 30 35 37 37 | 89 32 31 30 35 34 21 19 17 16 19
37 constant undefined Undefined
38 constant shape at 263c4ff60f80 Shape
39 constant 0x0 I[0, 0] : Int32
40 newarrayobject constant38:Shape Object
41 elements newarrayobject40:Object Elements
42 storeelement elements41:Elements constant39:Int32 constant30:Int32
43 postwritebarrier newarrayobject40:Object constant30:Int32
44 storeelement elements41:Elements constant30:Int32 constant31:Int32
92 keepaliveobject newarrayobject40:Object
45 postwritebarrier newarrayobject40:Object constant31:Int32
46 storeelement elements41:Elements constant31:Int32 constant32:Int32
91 keepaliveobject newarrayobject40:Object
47 postwritebarrier newarrayobject40:Object constant32:Int32
48 setinitializedlength elements41:Elements constant31:Int32
90 keepaliveobject newarrayobject40:Object
49 superfunction guardspecificfunction34:Object Value
50 unbox superfunction49 to Object (fallible) Object
51 createthis unbox50:Object loaddynamicslotandunbox89:Object Value
52 elements newarrayobject40:Object Elements
53 constructarray unbox50:Object elements52:Elements createthis51:Value loaddynamicslotandunbox89:Object Value
((4)) resumepoint 53 35 40 35 37 37 | 89 32 31 30 35 34 21 19 17 16 19
54 goto block6

but with scalar replacement support, this can be improved to:

((4)) resumepoint 37 30 35 37 37 | 29 32 31 30 35 34 21 19 17 16 19
37 constant undefined Undefined
38 constant shape at 3eb298060f80 Shape
39 constant 0x0 I[0, 0] : Int32
40 newarrayobject constant38:Shape Object
41 arraystate newarrayobject40:Object constant39:Int32 constant37:Undefined constant37:Undefined constant37:Undefined Object
42 arraystate newarrayobject40:Object constant39:Int32 constant30:Int32 constant37:Undefined constant37:Undefined Object
43 arraystate newarrayobject40:Object constant39:Int32 constant30:Int32 constant31:Int32 constant37:Undefined Object
44 arraystate newarrayobject40:Object constant39:Int32 constant30:Int32 constant31:Int32 constant32:Int32 Object
45 arraystate newarrayobject40:Object constant32:Int32 constant30:Int32 constant31:Int32 constant32:Int32 Object
46 superfunction guardspecificfunction34:Object Value
47 unbox superfunction46 to Object (fallible) Object
48 createthis unbox47:Object unbox33:Object Value
49 call unbox47:Object createthis48:Value constant30:Int32 constant31:Int32 constant32:Int32 loaddynamicslot29:Value Value
((4)) resumepoint 49 35 40 35 37 37 | 29 32 31 30 35 34 21 19 17 16 19
50 goto block6

This follows the approach we use when performing scalar replacement for arguments
in MApplyArgsObj. Scalar replacement is currently restricted to MNewArrayObject,
because only this instruction is guaranteed to be packed.

And also support array scalar replacement for MConstructArray.

Depends on D130480

Pushed by andre.bargull@gmail.com: https://hg.mozilla.org/integration/autoland/rev/5806df2b62db Part 1: Support array scalar replacement for MApplyArray. r=iain https://hg.mozilla.org/integration/autoland/rev/2a27eb3a670a Part 2: Support array scalar replacement for MConstructArray. r=iain
Severity: -- → N/A
Priority: -- → P1
Status: ASSIGNED → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → 96 Branch
Regressions: 1744520
Regressions: 1761947
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: