File tree Expand file tree Collapse file tree 11 files changed +190
-7
lines changed Expand file tree Collapse file tree 11 files changed +190
-7
lines changed Original file line number Diff line number Diff line change 3636
3737 # Reset this number to 0 on major V8 upgrades.
3838 # Increment by one for each non-official patch applied to deps/v8.
39- 'v8_embedder_string' : '-node.19 ' ,
39+ 'v8_embedder_string' : '-node.20 ' ,
4040
4141 ##### V8 defaults for Node.js #####
4242
Original file line number Diff line number Diff line change @@ -85,7 +85,8 @@ transitioning javascript builtin SetPrototypeDifference(
8585 }
8686 } label SlowPath {
8787 // 6. If thisSize ≤ otherRec.[[Size]], then
88- if (thisSize <= Convert<int32>(otherRec.size)) {
88+ if (otherRec.size == V8_INFINITY ||
89+ thisSize <= Convert<int32>(otherRec.size)) {
8990 // a. Let index be 0.
9091 let thisIter = collections::NewOrderedHashSetIterator(table.GetTable());
9192
Original file line number Diff line number Diff line change @@ -81,7 +81,8 @@ transitioning javascript builtin SetPrototypeIntersection(
8181 }
8282 } label SlowPath {
8383 // 6. If thisSize ≤ otherRec.[[Size]], then
84- if (thisSize <= Convert<int32>(otherRec.size)) {
84+ if (otherRec.size == V8_INFINITY ||
85+ thisSize <= Convert<int32>(otherRec.size)) {
8586 // a. Let index be 0.
8687 let thisIter = collections::NewOrderedHashSetIterator(table.GetTable());
8788
Original file line number Diff line number Diff line change @@ -73,7 +73,8 @@ transitioning javascript builtin SetPrototypeIsDisjointFrom(
7373 }
7474 } label SlowPath {
7575 // 5. If thisSize ≤ otherRec.[[Size]], then
76- if (thisSize <= Convert<int32>(otherRec.size)) {
76+ if (otherRec.size == V8_INFINITY ||
77+ thisSize <= Convert<int32>(otherRec.size)) {
7778 // a. Let index be 0.
7879 let thisIter = collections::NewOrderedHashSetIterator(table.GetTable());
7980
Original file line number Diff line number Diff line change @@ -25,7 +25,8 @@ transitioning javascript builtin SetPrototypeIsSubsetOf(
2525 const thisSize = table.LoadSize();
2626
2727 // 5. If thisSize > otherRec.[[Size]], return false.
28- if (thisSize > Convert<int32>(otherRec.size)) {
28+ if (!(otherRec.size == V8_INFINITY) &&
29+ thisSize > Convert<int32>(otherRec.size)) {
2930 return False;
3031 }
3132
Original file line number Diff line number Diff line change @@ -26,7 +26,8 @@ transitioning javascript builtin SetPrototypeIsSupersetOf(
2626 const thisSize = table.LoadSize();
2727
2828 // 5. If thisSize < otherRec.[[Size]], return false.
29- if (thisSize < Convert<int32>(otherRec.size)) {
29+ if (otherRec.size == V8_INFINITY ||
30+ thisSize < Convert<int32>(otherRec.size)) {
3031 return False;
3132 }
3233
Original file line number Diff line number Diff line change 305305 assertThrows ( ( ) => {
306306 new Set ( ) . difference ( setLike ) ;
307307 } , RangeError , "'-1' is an invalid size" ) ;
308- } ) ( )
308+ } ) ( ) ;
309+
310+ ( function TestDifferenceSetLikeWithInfiniteSize ( ) {
311+ let setLike = {
312+ size : Infinity ,
313+ has ( v ) {
314+ return true ;
315+ } ,
316+ keys ( ) {
317+ throw new Error ( 'Unexpected call to |keys| method' ) ;
318+ } ,
319+ } ;
320+
321+ const firstSet = new Set ( ) ;
322+ firstSet . add ( 42 ) ;
323+ firstSet . add ( 43 ) ;
324+
325+ const resultSet = new Set ( ) ;
326+
327+ const resultArray = Array . from ( resultSet ) ;
328+ const differenceArray = Array . from ( firstSet . difference ( setLike ) ) ;
329+
330+ assertEquals ( resultArray , differenceArray ) ;
331+ } ) ( ) ;
332+
333+ ( function TestDifferenceSetLikeWithNegativeInfiniteSize ( ) {
334+ let setLike = {
335+ size : - Infinity ,
336+ has ( v ) {
337+ return true ;
338+ } ,
339+ keys ( ) {
340+ throw new Error ( 'Unexpected call to |keys| method' ) ;
341+ } ,
342+ } ;
343+
344+ assertThrows ( ( ) => {
345+ new Set ( ) . difference ( setLike ) ;
346+ } , RangeError , '\'-Infinity\' is an invalid size' ) ;
347+ } ) ( ) ;
Original file line number Diff line number Diff line change 281281
282282 assertEquals ( [ 43 ] , Array . from ( firstSet . intersection ( evil ) ) ) ;
283283} ) ( ) ;
284+
285+ ( function TestIntersectionSetLikeWithInfiniteSize ( ) {
286+ let setLike = {
287+ size : Infinity ,
288+ has ( v ) {
289+ return true ;
290+ } ,
291+ keys ( ) {
292+ throw new Error ( 'Unexpected call to |keys| method' ) ;
293+ } ,
294+ } ;
295+
296+ const firstSet = new Set ( ) ;
297+ firstSet . add ( 42 ) ;
298+ firstSet . add ( 43 ) ;
299+
300+ const resultArray = [ 42 , 43 ] ;
301+ const intersectionArray = Array . from ( firstSet . intersection ( setLike ) ) ;
302+
303+ assertEquals ( resultArray , intersectionArray ) ;
304+ } ) ( ) ;
305+
306+ ( function TestIntersectionSetLikeWithNegativeInfiniteSize ( ) {
307+ let setLike = {
308+ size : - Infinity ,
309+ has ( v ) {
310+ return true ;
311+ } ,
312+ keys ( ) {
313+ throw new Error ( 'Unexpected call to |keys| method' ) ;
314+ } ,
315+ } ;
316+
317+ assertThrows ( ( ) => {
318+ new Set ( ) . intersection ( setLike ) ;
319+ } , RangeError , '\'-Infinity\' is an invalid size' ) ;
320+ } ) ( ) ;
Original file line number Diff line number Diff line change 216216
217217 assertFalse ( firstSet . isDisjointFrom ( evil ) ) ;
218218} ) ( ) ;
219+
220+ ( function TestIsDisjointFromSetLikeWithInfiniteSize ( ) {
221+ let setLike = {
222+ size : Infinity ,
223+ has ( v ) {
224+ return true ;
225+ } ,
226+ keys ( ) {
227+ throw new Error ( 'Unexpected call to |keys| method' ) ;
228+ } ,
229+ } ;
230+
231+ const firstSet = new Set ( ) ;
232+ firstSet . add ( 42 ) ;
233+ firstSet . add ( 43 ) ;
234+
235+ assertEquals ( firstSet . isDisjointFrom ( setLike ) , false ) ;
236+ } ) ( ) ;
237+
238+ ( function TestIsDisjointFromSetLikeWithNegativeInfiniteSize ( ) {
239+ let setLike = {
240+ size : - Infinity ,
241+ has ( v ) {
242+ return true ;
243+ } ,
244+ keys ( ) {
245+ throw new Error ( 'Unexpected call to |keys| method' ) ;
246+ } ,
247+ } ;
248+
249+ assertThrows ( ( ) => {
250+ new Set ( ) . isDisjointFrom ( setLike ) ;
251+ } , RangeError , '\'-Infinity\' is an invalid size' ) ;
252+ } ) ( ) ;
Original file line number Diff line number Diff line change 266266
267267 assertEquals ( firstSet . isSubsetOf ( setLike ) , true ) ;
268268} ) ( ) ;
269+
270+ ( function TestIsSubsetOfSetLikeWithInfiniteSize ( ) {
271+ let setLike = {
272+ size : Infinity ,
273+ has ( v ) {
274+ return true ;
275+ } ,
276+ keys ( ) {
277+ throw new Error ( 'Unexpected call to |keys| method' ) ;
278+ } ,
279+ } ;
280+
281+ const firstSet = new Set ( ) ;
282+ firstSet . add ( 42 ) ;
283+ firstSet . add ( 43 ) ;
284+
285+ assertEquals ( firstSet . isSubsetOf ( setLike ) , true ) ;
286+ } ) ( ) ;
287+
288+ ( function TestIsSubsetOfSetLikeWithNegativeInfiniteSize ( ) {
289+ let setLike = {
290+ size : - Infinity ,
291+ has ( v ) {
292+ return true ;
293+ } ,
294+ keys ( ) {
295+ throw new Error ( 'Unexpected call to |keys| method' ) ;
296+ } ,
297+ } ;
298+
299+ assertThrows ( ( ) => {
300+ new Set ( ) . isSubsetOf ( setLike ) ;
301+ } , RangeError , '\'-Infinity\' is an invalid size' ) ;
302+ } ) ( ) ;
You can’t perform that action at this time.
0 commit comments