Closed Bug 1787794 Opened 2 years ago Closed 2 years ago

Clean-up some code for destructuring bytecode and paren-free arrow parsing

Categories

(Core :: JavaScript Engine, task, P1)

task

Tracking

()

RESOLVED FIXED
106 Branch
Tracking Status
firefox106 --- fixed

People

(Reporter: anba, Assigned: anba)

References

Details

Attachments

(10 files)

48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
No description provided.

This shaves off one byte in byte code size:

dis(function(){ [...a] = [] })

Before:
00092: 27 True # [] []Symbol.iterator.next []Symbol.iterator [] true
00093: 27 Unpick 1 # [] []Symbol.iterator.next []Symbol.iterator true []
00095: 27 TryDestructuring # [] []Symbol.iterator.next []Symbol.iterator true []

After:
00092: 1 True # [] []Symbol.iterator.next []Symbol.iterator [] true
00093: 1 Swap # [] []Symbol.iterator.next []Symbol.iterator true []
00094: 1 TryDestructuring # [] []Symbol.iterator.next []Symbol.iterator true []

Directly pass lhs to emitSetOrInitializeDestructuring().

Part 6 will further align Object and Array destructuring code.

Depends on D155850

The property is most likely a normal property key and not a number, so let's
handle the normal property key case first.

Depends on D155851

BigInt property keys are parsed as synthetic computed properties, so these
cases no longer apply.

Depends on D155852

emitDestructuringLHSRef() and emitSetOrInitializeDestructuring() no longer
need to inspect target to handle spread and assignment expressions when we
directly pass the unpacked parse nodes.

Depends on D155854

Instead of branching around parenFreeArrow in multiple places, handle the
paren-free arrow function case in a separate if-block. This also simplifies
the Token::Modifier handling, because we can always pass a constant.

Depends on D155855

TokenStreamPosition no longer contains GC things.

Depends on D155856

There isn't a good reason to keep a simple while loop in a separate function.

Depends on D155858

Pushed by andre.bargull@gmail.com:
https://hg.mozilla.org/integration/autoland/rev/5e9c66da7409
Part 1: Prefer BytecodeEmitter::emitUnpickN() over JSOp::Unpick. r=arai
https://hg.mozilla.org/integration/autoland/rev/f5e5764cc4d3
Part 2: Directly pass 'lhs' to emitSetOrInitializeDestructuring. r=arai
https://hg.mozilla.org/integration/autoland/rev/b495ed555e0d
Part 3: Reorder access in destructuring so most likely cases come first. r=arai
https://hg.mozilla.org/integration/autoland/rev/39525ff15d29
Part 4: Remove unreachable code for BigInt property keys. r=arai
https://hg.mozilla.org/integration/autoland/rev/4abc0092802a
Part 5: Reorder more property name operations to handle simple names first. r=arai
https://hg.mozilla.org/integration/autoland/rev/71436fb16132
Part 6: Align Array and Object destructuring code paths. r=arai
https://hg.mozilla.org/integration/autoland/rev/cd0dd29a5c65
Part 7: Simplify paren-free arrow function parsing. r=arai
https://hg.mozilla.org/integration/autoland/rev/8fbfb862f801
Part 8: Remove a stale comment. r=arai
https://hg.mozilla.org/integration/autoland/rev/ee76c50ba4b7
Part 9: Remove unused NumericLiteral setters. r=arai
https://hg.mozilla.org/integration/autoland/rev/2a4095902192
Part 10: Inline literalIsZeroNoRadix into its single caller. r=arai

Backed out for causing build bustages on BytecodeEmitter.cpp

Backout link

Push with failures

Failure log

Failure line: /builds/worker/checkouts/gecko/js/src/frontend/BytecodeEmitter.cpp:2635:5: error: unannotated fall-through between switch labels [-Werror,-Wimplicit-fallthrough]

Flags: needinfo?(andrebargull)

Sigh. Why does linux64 (opt and debug) don't have --enable-warnings-as-errors?

Flags: needinfo?(andrebargull)
Pushed by andre.bargull@gmail.com:
https://hg.mozilla.org/integration/autoland/rev/eba6980e67ff
Part 1: Prefer BytecodeEmitter::emitUnpickN() over JSOp::Unpick. r=arai
https://hg.mozilla.org/integration/autoland/rev/89b1c584ae8e
Part 2: Directly pass 'lhs' to emitSetOrInitializeDestructuring. r=arai
https://hg.mozilla.org/integration/autoland/rev/a05af0c15ace
Part 3: Reorder access in destructuring so most likely cases come first. r=arai
https://hg.mozilla.org/integration/autoland/rev/4a19790129b7
Part 4: Remove unreachable code for BigInt property keys. r=arai
https://hg.mozilla.org/integration/autoland/rev/28622fa10a79
Part 5: Reorder more property name operations to handle simple names first. r=arai
https://hg.mozilla.org/integration/autoland/rev/5cbe09ca8c43
Part 6: Align Array and Object destructuring code paths. r=arai
https://hg.mozilla.org/integration/autoland/rev/782ce39e8d24
Part 7: Simplify paren-free arrow function parsing. r=arai
https://hg.mozilla.org/integration/autoland/rev/6a84be70015e
Part 8: Remove a stale comment. r=arai
https://hg.mozilla.org/integration/autoland/rev/412ef9eb0609
Part 9: Remove unused NumericLiteral setters. r=arai
https://hg.mozilla.org/integration/autoland/rev/b267528cb51a
Part 10: Inline literalIsZeroNoRadix into its single caller. r=arai
Blocks: sm-runtime
Severity: -- → N/A
Priority: -- → P1
Blocks: sm-meta
No longer blocks: sm-runtime
Regressions: 1788180
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: