Closed Bug 1595533 Opened 5 years ago Closed 5 years ago

Use jsop_unpick for post-increment with object-element

Categories

(Core :: JavaScript Engine, task)

task
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla72
Tracking Status
firefox72 --- fixed

People

(Reporter: anba, Assigned: anba)

Details

Attachments

(2 files)

This was already implemented in bug 1472211, but somehow got reverted in bug 1466000.

a[k]++ emits the following bytecode sequence:

getgname "a"                    # a
checkobjcoercible               # a
getgname "k"                    # a k
toid                            # a TOID(k)
dup2                            # a TOID(k) a TOID(k)
getelem                         # a TOID(k) a[TOID(k)]
tonumeric                       # a TOID(k) (tonumeric a[TOID(k)])
dup                             # a TOID(k) (tonumeric a[TOID(k)]) (tonumeric a[TOID(k)])
inc                             # a TOID(k) (tonumeric a[TOID(k)]) (inc (tonumeric a[TOID(k)]))
pick 3                          # TOID(k) (tonumeric a[TOID(k)]) (inc (tonumeric a[TOID(k)])) a
pick 3                          # (tonumeric a[TOID(k)]) (inc (tonumeric a[TOID(k)])) a TOID(k)
pick 2                          # (tonumeric a[TOID(k)]) a TOID(k) (inc (tonumeric a[TOID(k)]))
setelem                         # (tonumeric a[TOID(k)]) a[TOID(k)]
pop                             # (tonumeric a[TOID(k)])

The three pick operations can be replaced with a single unpick operation:

getgname "a"                    # a
checkobjcoercible               # a
getgname "k"                    # a k
toid                            # a TOID(k)
dup2                            # a TOID(k) a TOID(k)
getelem                         # a TOID(k) a[TOID(k)]
tonumeric                       # a TOID(k) (tonumeric a[TOID(k)])
dup                             # a TOID(k) (tonumeric a[TOID(k)]) (tonumeric a[TOID(k)])
unpick 3                        # (tonumeric a[TOID(k)]) a TOID(k) (tonumeric a[TOID(k)])
inc                             # (tonumeric a[TOID(k)]) a TOID(k) (inc (tonumeric a[TOID(k)]))
setelem                         # (tonumeric a[TOID(k)]) a[TOID(k)]
pop                             # (tonumeric a[TOID(k)])
Attachment #9107856 - Attachment description: Bug 1595533: Replace JSOP_PICK sequence with a single JSOP_UNPICK. r=arai! → Bug 1595533 - Part 1: Replace JSOP_PICK sequence in ElemOpEmitter with a single JSOP_UNPICK. r=arai!
Pushed by dluca@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/6c550f7a2547
Part 1: Replace JSOP_PICK sequence in ElemOpEmitter with a single JSOP_UNPICK. r=arai
https://hg.mozilla.org/integration/autoland/rev/eb6a4954d374
Part 2: Use JSOP_UNPICK for inc/dec in PropOpEmitter.cpp. r=arai
Status: ASSIGNED → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla72
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: