Skip to content

Commit e6a7652

Browse files
committed
Bug 1965844 - Part 4: Correctly update search index for resized typed array in lastIndexOf. r=jandem
Test case in <tc39/test262#4477>. Differential Revision: https://phabricator.services.mozilla.com/D248929 UltraBlame original commit: a7c3286c781fa3d67f2b75540b9be2c476e523a0
1 parent a7c1e30 commit e6a7652

File tree

1 file changed

+69
-43
lines changed

1 file changed

+69
-43
lines changed

js/src/vm/TypedArrayObject.cpp

Lines changed: 69 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -12964,32 +12964,50 @@ return
1296412964
false
1296512965
;
1296612966
}
12967-
len
12967+
if
12968+
(
12969+
fromIndex
12970+
>
12971+
=
12972+
0
12973+
)
12974+
{
12975+
k
1296812976
=
12977+
size_t
12978+
(
1296912979
std
1297012980
:
1297112981
:
1297212982
min
1297312983
(
12984+
fromIndex
12985+
double
12986+
(
1297412987
len
12975-
tarray
1297612988
-
12977-
>
12978-
length
12979-
(
12989+
1
1298012990
)
12981-
.
12982-
valueOr
12983-
(
12984-
0
1298512991
)
1298612992
)
1298712993
;
12988-
if
12994+
}
12995+
else
12996+
{
12997+
double
12998+
d
12999+
=
13000+
double
1298913001
(
1299013002
len
12991-
=
12992-
=
13003+
)
13004+
+
13005+
fromIndex
13006+
;
13007+
if
13008+
(
13009+
d
13010+
<
1299313011
0
1299413012
)
1299513013
{
@@ -13009,50 +13027,48 @@ return
1300913027
true
1301013028
;
1301113029
}
13012-
if
13013-
(
13014-
fromIndex
13015-
>
13016-
=
13017-
0
13018-
)
13019-
{
1302013030
k
1302113031
=
1302213032
size_t
1302313033
(
13024-
std
13025-
:
13026-
:
13027-
min
13028-
(
13029-
fromIndex
13030-
double
13034+
d
13035+
)
13036+
;
13037+
}
13038+
MOZ_ASSERT
1303113039
(
13040+
k
13041+
<
1303213042
len
13033-
-
13034-
1
13035-
)
13036-
)
1303713043
)
1303813044
;
13039-
}
13040-
else
13041-
{
13042-
double
13043-
d
13045+
size_t
13046+
currentLength
1304413047
=
13045-
double
13048+
tarray
13049+
-
13050+
>
13051+
length
1304613052
(
13047-
len
1304813053
)
13049-
+
13050-
fromIndex
13054+
.
13055+
valueOr
13056+
(
13057+
0
13058+
)
1305113059
;
1305213060
if
1305313061
(
13054-
d
13062+
currentLength
1305513063
<
13064+
len
13065+
)
13066+
{
13067+
if
13068+
(
13069+
currentLength
13070+
=
13071+
=
1305613072
0
1305713073
)
1305813074
{
@@ -13074,11 +13090,21 @@ true
1307413090
}
1307513091
k
1307613092
=
13077-
size_t
13093+
std
13094+
:
13095+
:
13096+
min
1307813097
(
13079-
d
13098+
k
13099+
currentLength
13100+
-
13101+
1
1308013102
)
1308113103
;
13104+
len
13105+
=
13106+
currentLength
13107+
;
1308213108
}
1308313109
}
1308413110
MOZ_ASSERT

0 commit comments

Comments
 (0)