Closed
Bug 1788039
Opened 3 years ago
Closed 3 years ago
Avoid unnecessary dup/pop sequences for post-increment/decrement operations
Categories
(Core :: JavaScript Engine, enhancement, P1)
Core
JavaScript Engine
Tracking
()
RESOLVED
FIXED
106 Branch
Tracking | Status | |
---|---|---|
firefox106 | --- | fixed |
People
(Reporter: anba, Assigned: anba)
References
(Blocks 1 open bug)
Details
Attachments
(1 file)
We can use ValueUsage
to determine when the result of the post-increment/decrement operation is unused, which allows to avoid having to emit extra dup/pop operations.
For example dis(function(){ var i = 0; i++ })
improves from:
00000: 1 Zero # 0
00001: 1 SetLocal 0 # 0
00005: 1 Pop #
00006: 1 GetLocal 0 # i
00010: 1 ToNumeric # (tonumeric i)
00011: 1 Dup # (tonumeric i) (tonumeric i)
00012: 1 Inc # (tonumeric i) (inc (tonumeric i))
00013: 1 SetLocal 0 # (tonumeric i) (inc (tonumeric i))
00017: 1 Pop # (tonumeric i)
00018: 1 Pop #
00019: 1 RetRval #
to:
00000: 1 Zero # 0
00001: 1 SetLocal 0 # 0
00005: 1 Pop #
00006: 1 GetLocal 0 # i
00010: 1 ToNumeric # (tonumeric i)
00011: 1 Inc # (inc (tonumeric i))
00012: 1 SetLocal 0 # (inc (tonumeric i))
00016: 1 Pop #
00017: 1 RetRval #
Assignee | ||
Comment 1•3 years ago
|
||
Pass through ValueUsage
to determine when the expression result is unused.
When the result isn't used, we can then avoid having to emit dup/pop byte codes.
Updated•3 years ago
|
Pushed by andre.bargull@gmail.com:
https://hg.mozilla.org/integration/autoland/rev/ccec17d8541d
Avoid unnecessary stack operations for post-increment/decrement. r=arai
Comment 3•3 years ago
|
||
bugherder |
Status: ASSIGNED → RESOLVED
Closed: 3 years ago
Resolution: --- → FIXED
Target Milestone: --- → 106 Branch
You need to log in
before you can comment on or make changes to this bug.
Description
•