Enable ShouldInitFixedSlots for LNewPlainObject
Categories
(Core :: JavaScript Engine: JIT, enhancement)
Tracking
()
Tracking | Status | |
---|---|---|
firefox106 | --- | fixed |
People
(Reporter: anba, Assigned: anba)
Details
Attachments
(3 files)
Enable ShouldInitFixedSlots (bug 1009664) for LNewPlainObject. This improves the codegen for var obj = {a: 0, b:0}
;
From:
[Codegen] # LIR=NewPlainObject
[Codegen] movabsq $0x23421d862300, %r14
[Codegen] movabsq $0x7f2e68e0e690, %r13
[Codegen] movq 0x0(%r13), %r10
[Codegen] addq $48, %r10
[Codegen] cmpq %r10, 0x18(%r13)
[Codegen] jb .Lfrom210
[Codegen] movq %r10, 0x0(%r13)
[Codegen] subq $40, %r10
[Codegen] movabsq $0x7f2e68e30848, %r11
[Codegen] movq %r11, -0x8(%r10)
[Codegen] movq %r14, 0x0(%r10)
[Codegen] movabsq $0x55f86dfdb908, %r11
[Codegen] movq %r11, 0x8(%r10)
[Codegen] movabsq $0x55f86dfdb8e0, %r11
[Codegen] movq %r11, 0x10(%r10)
[Codegen] movabsq $0xfff9800000000000, %r13
[Codegen] movq %r13, 0x18(%r10)
[Codegen] movq %r13, 0x20(%r10)
[Codegen] .set .Llabel281, .
[Codegen] # LIR=OsiPoint
[Codegen] .set .Llabel281, .
[Codegen] .set .Llabel281, .
[Codegen] .set .Llabel281, .
[Codegen] # LIR=StoreFixedSlotT
[Codegen] movabsq $0x7f2e68e30010, %r11
[Codegen] testl $0x1, 0x0(%r11)
[Codegen] je .Lfrom304
[Codegen] movq 0x18(%r10), %r11
[Codegen] shrq $47, %r11
[Codegen] cmpl $0x1fff6, %r11d
[Codegen] jb .Lfrom325
[Codegen] push %rdx
[Codegen] leaq 0x18(%r10), %rdx
[Codegen] call .Lfrom335
[Codegen] pop %rdx
[Codegen] .set .Llabel336, .
[Codegen] .set .Lfrom325, .Llabel336
[Codegen] .set .Llabel336, .
[Codegen] .set .Lfrom304, .Llabel336
[Codegen] movabsq $0xfff8800000000000, %r11
[Codegen] movq %r11, 0x18(%r10)
[Codegen] # LIR=StoreFixedSlotT
[Codegen] movabsq $0x7f2e68e30010, %r11
[Codegen] testl $0x1, 0x0(%r11)
[Codegen] je .Lfrom373
[Codegen] movq 0x20(%r10), %r11
[Codegen] shrq $47, %r11
[Codegen] cmpl $0x1fff6, %r11d
[Codegen] jb .Lfrom394
[Codegen] push %rdx
[Codegen] leaq 0x20(%r10), %rdx
[Codegen] call .Lfrom404
[Codegen] pop %rdx
[Codegen] .set .Llabel405, .
[Codegen] .set .Lfrom394, .Llabel405
[Codegen] .set .Llabel405, .
[Codegen] .set .Lfrom373, .Llabel405
[Codegen] movabsq $0xfff8800000000000, %r11
[Codegen] movq %r11, 0x20(%r10)
To:
[Codegen] # LIR=NewPlainObject
[Codegen] movabsq $0x2c9aec462300, %r14
[Codegen] movabsq $0x7fb1e1d0e690, %r13
[Codegen] movq 0x0(%r13), %r10
[Codegen] addq $48, %r10
[Codegen] cmpq %r10, 0x18(%r13)
[Codegen] jb .Lfrom210
[Codegen] movq %r10, 0x0(%r13)
[Codegen] subq $40, %r10
[Codegen] movabsq $0x7fb1e1d34448, %r11
[Codegen] movq %r11, -0x8(%r10)
[Codegen] movq %r14, 0x0(%r10)
[Codegen] movabsq $0x55d12b401908, %r11
[Codegen] movq %r11, 0x8(%r10)
[Codegen] movabsq $0x55d12b4018e0, %r11
[Codegen] movq %r11, 0x10(%r10)
[Codegen] .set .Llabel263, .
[Codegen] # LIR=OsiPoint
[Codegen] .set .Llabel263, .
[Codegen] .set .Llabel263, .
[Codegen] .set .Llabel263, .
[Codegen] # LIR=StoreFixedSlotT
[Codegen] movabsq $0xfff8800000000000, %r11
[Codegen] movq %r11, 0x18(%r10)
[Codegen] # LIR=StoreFixedSlotT
[Codegen] movabsq $0xfff8800000000000, %r11
[Codegen] movq %r11, 0x20(%r10)
Assignee | ||
Comment 1•2 years ago
|
||
std::pair<uint32_t, uint32_t>
can be returned in a single register on 64-bit
platforms.
Assignee | ||
Comment 2•2 years ago
|
||
There are three callers to ShouldInitFixedSlots()
:
-
LNewObject
:
The non-VM call instruction is only used forObject.create
calls, in which
case any following store instruction definitely won't beMFixedStore
, but
insteadMAddAndStoreSlot
. That means any optimisations fromShouldInitFixedSlots
don't apply for this case. -
LNewNamedLambdaObject
:
The template object contains a fixed slot which holds an Object value (the
callee function), soShouldInitFixedSlots
won't perform any optimisations.
(ShouldInitFixedSlots
requires that all fixed slots haveUndefined
as their
initial value.) -
LNewCallObject
:
The template object contains a fixed slot which holds either an Object or a Null
value (the enclosing environment object), soShouldInitFixedSlots
won't perform
any optimisations.
That means all current callers of ShouldInitFixedSlots
are actually no-ops.
MacroAssembler::initGCSlots()
is now always called with initContents=true
,
so we can remove the parameter.
Depends on D156053
Assignee | ||
Comment 3•2 years ago
|
||
Change ShouldInitFixedSlots
so we can use it for LNewPlainObject
by directly
passing the shape and the number of fixed slots.
All fixed slots for LNewPlainObject
are initialised to Undefined
, so we can
remove the first loop which iterates over all fixed slots. Between MNewPlainObject
and the MStoreFixedSlot
instructions, we may have some (hoisted) constants and
a MGuardShape
instruction, which we need to skip. The MStoreFixedSlot
aren't
scattered over multiple blocks, so we can remove the MGoto
handling. Also remove
the MNop
handling, because we no longer emit MNop
except for
assertRecoveredOnBailoutResult()
. (We should probably rename MNop
at this
point.)
Depends on D156054
Pushed by andre.bargull@gmail.com: https://hg.mozilla.org/integration/autoland/rev/b807e5423079 Part 1: Return std::pair from FindStartOfUninitializedAndUndefinedSlots. r=jandem https://hg.mozilla.org/integration/autoland/rev/bf83a41a519a Part 2: Remove non-working ShouldInitFixedSlots calls. r=jandem https://hg.mozilla.org/integration/autoland/rev/88c791bdc5ee Part 3: Enable ShouldInitFixedSlots for CreatePlainObject. r=jandem
Comment 5•2 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/b807e5423079
https://hg.mozilla.org/mozilla-central/rev/bf83a41a519a
https://hg.mozilla.org/mozilla-central/rev/88c791bdc5ee
Description
•