Skip to content

Commit

Permalink
Bug 1916260 - Part 9: Resolve binding in destructuring before retriev…
Browse files Browse the repository at this point in the history
…ing destructured element. r=arai

`BytecodeEmitter::emitDestructuringLHSRef` needs to call `NameOpEmitter::prepareForRhs`
to emit the necessary steps to resolve environment bindings. To avoid adding a new
`skipPrepareForRhs` method to `NameOpEmitter`, instead pass `DestructuringLHSRef&`
to `emitDestructuringLHSRef`, where `DestructuringLHSRef` holds the emitter for the
destructuring left-hand side reference.

Tests are in <tc39/test262#4216>.

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

UltraBlame original commit: 5a9e48dab16e9706ff963d6155df153acb6a0354
  • Loading branch information
marco-c committed Sep 6, 2024
1 parent 478f00b commit 5e3e1dc
Show file tree
Hide file tree
Showing 9 changed files with 579 additions and 1,053 deletions.
1,189 changes: 520 additions & 669 deletions js/src/frontend/BytecodeEmitter.cpp

Large diffs are not rendered by default.

30 changes: 11 additions & 19 deletions js/src/frontend/BytecodeEmitter.h
Original file line number Diff line number Diff line change
Expand Up @@ -574,6 +574,9 @@ class
ClassEmitter
;
class
DestructuringLHSRef
;
class
ElemOpEmitter
;
class
Expand Down Expand Up @@ -5968,22 +5971,6 @@ it
emits
nothing
.
/
/
|
emitted
|
parameter
receives
the
number
of
values
pushed
onto
the
stack
.
[
[
nodiscard
Expand All @@ -5995,9 +5982,11 @@ emitDestructuringLHSRef
ParseNode
*
target
size_t
*
emitted
DestructuringFlavor
flav
DestructuringLHSRef
&
lref
)
;
/
Expand Down Expand Up @@ -6068,6 +6057,9 @@ ParseNode
target
DestructuringFlavor
flav
DestructuringLHSRef
&
lref
)
;
/
Expand Down
47 changes: 0 additions & 47 deletions js/src/frontend/ElemOpEmitter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -892,53 +892,6 @@ bool
ElemOpEmitter
:
:
skipObjAndKeyAndRhs
(
)
{
MOZ_ASSERT
(
state_
=
=
State
:
:
Start
)
;
MOZ_ASSERT
(
isSimpleAssignment
(
)
|
|
isPropInit
(
)
)
;
#
ifdef
DEBUG
state_
=
State
:
:
Rhs
;
#
endif
return
true
;
}
bool
ElemOpEmitter
:
:
emitDelete
(
)
Expand Down
Loading

0 comments on commit 5e3e1dc

Please sign in to comment.