Closed Bug 1741411 Opened 3 years ago Closed 3 years ago

Optimised spread calls emit duplicate lookups

Categories

(Core :: JavaScript Engine, defect, P1)

defect

Tracking

()

RESOLVED FIXED
96 Branch
Tracking Status
firefox96 --- fixed

People

(Reporter: anba, Assigned: anba)

Details

Attachments

(2 files)

This test case currently fails:

var count = 0;
var scope = {
  get args() {
    count++;
    return "";
  }
};

with (scope) {
  [].push(...args);
}

// Ensure |args| is only looked up once.
assertEq(count, 1);

This commit changes the byte code for optimised spread calls to emit the spread
operand only once.

The new BytecodeEmitter::emitSpreadIntoArray() method was added to spread an
on-stack value into an array. This method is needed to avoid emitting the spread
operand another time in 'BytecodeEmitter::emitArray()`.

After part 1 we can lift the single name operand restriction and emit
JSOp::OptimizeSpreadCall for all calls with a single spread argument.

Depends on D131242

Severity: -- → S3
Priority: -- → P1
Pushed by andre.bargull@gmail.com:
https://hg.mozilla.org/integration/autoland/rev/f87b1d574cbc
Part 1: Only emit argument operand once for optimised spread calls. r=iain
https://hg.mozilla.org/integration/autoland/rev/7f550858162e
Part 2: Emit JSOp::OptimizeSpreadCall for all calls with a single spread argument. r=iain

Backed out 6 changesets (Bug 1741411, Bug 1740737) for causing build bustages on CacheIR.cpp.
Backout link
Push with failures
Failure Log

Flags: needinfo?(andrebargull)
Flags: needinfo?(andrebargull)
Pushed by andre.bargull@gmail.com:
https://hg.mozilla.org/integration/autoland/rev/a05795a5d581
Part 1: Only emit argument operand once for optimised spread calls. r=iain
https://hg.mozilla.org/integration/autoland/rev/d58b06af1ac7
Part 2: Emit JSOp::OptimizeSpreadCall for all calls with a single spread argument. r=iain
Status: ASSIGNED → RESOLVED
Closed: 3 years ago
Resolution: --- → FIXED
Target Milestone: --- → 96 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: