Skip to content

Commit

Permalink
Bug 1844115 - Part 1: Avoid creating String wrapper objects in Iterat…
Browse files Browse the repository at this point in the history
…or.from. r=allstarschh

Update per <tc39/proposal-iterator-helpers#281>.

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

UltraBlame original commit: e909fbf5b324f9a1a490c634818c1fea3005f35f
  • Loading branch information
marco-c committed Jul 21, 2023
1 parent c4133c2 commit 0d97fea
Showing 1 changed file with 37 additions and 20 deletions.
57 changes: 37 additions & 20 deletions js/src/builtin/Iterator.js
Original file line number Diff line number Diff line change
Expand Up @@ -302,8 +302,27 @@ function
GetIteratorFlattenable
(
obj
rejectStrings
)
{
assert
(
typeof
rejectStrings
=
=
=
"
boolean
"
"
rejectStrings
is
a
boolean
"
)
;
if
(
!
Expand All @@ -313,6 +332,21 @@ obj
)
)
{
if
(
rejectStrings
|
|
typeof
obj
!
=
=
"
string
"
)
{
ThrowTypeError
(
JSMSG_OBJECT_REQUIRED
Expand All @@ -331,6 +365,7 @@ obj
)
;
}
}
var
method
=
Expand Down Expand Up @@ -408,32 +443,13 @@ IteratorFrom
O
)
{
if
(
typeof
O
=
=
=
"
string
"
)
{
O
=
ToObject
(
O
)
;
}
var
iterator
=
GetIteratorFlattenable
(
O
false
)
;
var
Expand Down Expand Up @@ -1669,6 +1685,7 @@ innerIterator
GetIteratorFlattenable
(
mapped
true
)
;
var
Expand Down

0 comments on commit 0d97fea

Please sign in to comment.