Closed Bug 1720781 Opened 2 months ago Closed 2 months ago

New Test262 Tests target-super-identifier-reference-null.js and target-super-computed-reference-null.js fail

Categories

(Core :: JavaScript Engine, defect, P3)

defect

Tracking

()

RESOLVED FIXED
92 Branch
Tracking Status
firefox92 --- fixed

People

(Reporter: mgaudet, Assigned: anba)

Details

Attachments

(4 files)

I am working on importing an updated copy of test262. The following two tests fail on central:

test262/language/expressions/assignment/target-super-identifier-reference-null.js
test262/language/expressions/assignment/target-super-computed-reference-null.js

with the error message uncaught exception: Test262Error: Expected SameValue(«0», «1») to be true

The code looks like this:

var count = 0;
class C {
  static m() {
    super.x = count += 1;
  }
}

Object.setPrototypeOf(C, null)
C.m();

I think the problem here is that we emit SuperBase too soon:

0000:  FunctionThis                    # THIS
00001:  SetLocal 0                      # THIS
00005:  Pop                             # 
main:
00006:  GetLocal 0                      # this
00010:  Callee                          # this CALLEE
00011:  SuperBase                       # this HOMEOBJECTPROTO
00012:  BindGName "count"               # this HOMEOBJECTPROTO GLOBAL
00017:  GetGName "count"                # this HOMEOBJECTPROTO GLOBAL count
00022:  One                             # this HOMEOBJECTPROTO GLOBAL count 1
00023:  Add                             # this HOMEOBJECTPROTO GLOBAL (count += 1)
00024:  StrictSetGName "count"          # this HOMEOBJECTPROTO (count += 1)
00029:  StrictSetPropSuper "x"          # (count += 1)
00034:  Pop                             # 
00035:  RetRval                         # 

The spec expects us to do something more like this:

BindGName "count"               # GLOBAL
GetGName "count"                # GLOBAL count
One                             # GLOBAL count 1
Add                             # GLOBAL (count += 1)
StrictSetGName "count"          # (count += 1)
GetLocal 0                      # (count += 1) this
Callee                          # (count += 1) this CALLEE
SuperBase                       # (count += 1) this HOMEOBJECTPROTO
Pick 2                          # this HOMEOBJECTPROTO (count += 1) 
StrictSetPropSuper "x"          # (count += )1

I don't know the frontend well enough to know where to fix this.

Severity: -- → S4
Priority: -- → P3
Assignee: nobody → andrebargull
Status: NEW → ASSIGNED

That way it's easier to compare the super and non-super operations.

Depends on D120609

The PR removes the RequireObjectCoercible() call in MakeSuperPropertyReference,
which means JSOp::SuperBase should no longer throw when the prototype is null.

Depends on D120610

Pushed by andre.bargull@gmail.com:
https://hg.mozilla.org/integration/autoland/rev/fa231d611193
Part 1: Remove no longer needed CheckObjCoercible. r=iain
https://hg.mozilla.org/integration/autoland/rev/7dbf83e48430
Part 2: Align super and non-super property operations in the interpreter. r=iain
https://hg.mozilla.org/integration/autoland/rev/561144893879
Part 3: Don't throw for null-proto in JSOp::SuperBase. r=iain
https://hg.mozilla.org/integration/autoland/rev/18be06839d58
Part 4: Remove unused local variables. r=iain
You need to log in before you can comment on or make changes to this bug.