Closed Bug 1344476 Opened 7 years ago Closed 7 years ago

Add helper function to emit JSOP_POP or JSOP_POPN for given amount

Categories

(Core :: JavaScript Engine, enhancement)

enhancement
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla55
Tracking Status
firefox55 --- fixed

People

(Reporter: arai, Assigned: arai)

Details

Attachments

(1 file)

JSOP_POP is single byte, and JSOP_POPN is 3 bytes, so using JSOP_POP is shorter for popping 1 or 2 values.
it would be better adding dedicated function that receives the amount of values to pop and emit better opcode sequence to it.
regarding bug 1147371 comment #36
> I chose |pop; pop| because it's 2 bytes, and |popn 2| is 3 bytes.

added BytecodeEmitter::emitPopN that emits JSOP_POP when popping 1 or 2 values, and JSOP_POPN for other cases,
and used emitPopN where popping possibly multiple values.
Assignee: nobody → arai.unmht
Status: NEW → ASSIGNED
Attachment #8844763 - Flags: review?(shu)
Comment on attachment 8844763 [details] [diff] [review]
Add BytecodeEmitter::emitPopN to emit shorter bytecode for given pop count.

Review of attachment 8844763 [details] [diff] [review]:
-----------------------------------------------------------------

Nice, thanks.
Attachment #8844763 - Flags: review?(shu) → review+
https://hg.mozilla.org/integration/mozilla-inbound/rev/5dff3bf590ba88c906073e0a22a9f9b33a77b927
Bug 1344476 - Add BytecodeEmitter::emitPopN to emit shorter bytecode for given pop count. r=shu
https://hg.mozilla.org/mozilla-central/rev/5dff3bf590ba
Status: ASSIGNED → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla55
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: