Skip to content

Commit

Permalink
Bug 1916260 - Part 6: Evaluate SuperBase before ToPropertyKey. r=spid…
Browse files Browse the repository at this point in the history
…ermonkey-reviewers,jandem

The spec PR reordered the `ToPropertyKey` call to happen in `GetValue` resp.
`PutValue`, which means it has to happen after `GetSuperBase`.

Tests are included in <tc39/test262#4216>.

Differential Revision: https://phabricator.services.mozilla.com/D220825

UltraBlame original commit: e7e456e896ff809e6883f37dc5ba8c6a30e0c3d6
  • Loading branch information
marco-c committed Sep 6, 2024
1 parent 73c6f4a commit e54a863
Showing 1 changed file with 95 additions and 48 deletions.
143 changes: 95 additions & 48 deletions js/src/frontend/ElemOpEmitter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,39 @@ State
Key
)
;
if
(
isSuper
(
)
)
{
if
(
!
bce_
-
>
emitSuperBase
(
)
)
{
/
/
[
stack
]
THIS
?
THIS
KEY
SUPERBASE
return
false
;
}
}
/
/
Inc
Expand All @@ -365,6 +398,7 @@ it
must
be
converted
by
ToPropertyKey
only
once
Expand All @@ -385,6 +419,13 @@ isCompoundAssignment
{
if
(
isSuper
(
)
)
{
if
(
!
bce_
-
Expand All @@ -394,7 +435,7 @@ emit1
JSOp
:
:
ToPropertyKey
Swap
)
)
{
Expand All @@ -403,50 +444,52 @@ ToPropertyKey
[
stack
]
#
if
Super
/
/
[
stack
]
THIS
KEY
/
/
[
stack
]
#
otherwise
/
/
[
stack
]
OBJ
SUPERBASE
KEY
return
false
;
}
}
if
(
isSuper
!
bce_
-
>
emit1
(
JSOp
:
:
ToPropertyKey
)
)
{
/
/
[
stack
]
THIS
SUPERBASE
KEY
return
false
;
}
if
(
!
bce_
-
>
emitSuperBase
emit1
(
JSOp
:
:
Swap
)
)
{
Expand All @@ -456,34 +499,12 @@ emitSuperBase
stack
]
THIS
?
THIS
KEY
SUPERBASE
return
false
;
}
}
if
(
isIncDec
(
)
|
|
isCompoundAssignment
(
)
)
{
if
(
isSuper
(
)
)
{
if
(
!
Expand Down Expand Up @@ -526,6 +547,32 @@ emit1
JSOp
:
:
ToPropertyKey
)
)
{
/
/
[
stack
]
OBJ
KEY
return
false
;
}
if
(
!
bce_
-
>
emit1
(
JSOp
:
:
Dup2
)
)
Expand Down

0 comments on commit e54a863

Please sign in to comment.