Commit 1de5512 1 parent 67ecb10 commit 1de5512 Copy full SHA for 1de5512
File tree 11 files changed +190
-7
lines changed
11 files changed +190
-7
lines changed Original file line number Diff line number Diff line change 36
36
37
37
# Reset this number to 0 on major V8 upgrades.
38
38
# Increment by one for each non-official patch applied to deps/v8.
39
- 'v8_embedder_string' : '-node.19 ' ,
39
+ 'v8_embedder_string' : '-node.20 ' ,
40
40
41
41
##### V8 defaults for Node.js #####
42
42
Original file line number Diff line number Diff line change @@ -85,7 +85,8 @@ transitioning javascript builtin SetPrototypeDifference(
85
85
}
86
86
} label SlowPath {
87
87
// 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)) {
89
90
// a. Let index be 0.
90
91
let thisIter = collections::NewOrderedHashSetIterator(table.GetTable());
91
92
Original file line number Diff line number Diff line change @@ -81,7 +81,8 @@ transitioning javascript builtin SetPrototypeIntersection(
81
81
}
82
82
} label SlowPath {
83
83
// 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)) {
85
86
// a. Let index be 0.
86
87
let thisIter = collections::NewOrderedHashSetIterator(table.GetTable());
87
88
Original file line number Diff line number Diff line change @@ -73,7 +73,8 @@ transitioning javascript builtin SetPrototypeIsDisjointFrom(
73
73
}
74
74
} label SlowPath {
75
75
// 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)) {
77
78
// a. Let index be 0.
78
79
let thisIter = collections::NewOrderedHashSetIterator(table.GetTable());
79
80
Original file line number Diff line number Diff line change @@ -25,7 +25,8 @@ transitioning javascript builtin SetPrototypeIsSubsetOf(
25
25
const thisSize = table.LoadSize();
26
26
27
27
// 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)) {
29
30
return False;
30
31
}
31
32
Original file line number Diff line number Diff line change @@ -26,7 +26,8 @@ transitioning javascript builtin SetPrototypeIsSupersetOf(
26
26
const thisSize = table.LoadSize();
27
27
28
28
// 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)) {
30
31
return False;
31
32
}
32
33
Original file line number Diff line number Diff line change 305
305
assertThrows ( ( ) => {
306
306
new Set ( ) . difference ( setLike ) ;
307
307
} , 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 281
281
282
282
assertEquals ( [ 43 ] , Array . from ( firstSet . intersection ( evil ) ) ) ;
283
283
} ) ( ) ;
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 216
216
217
217
assertFalse ( firstSet . isDisjointFrom ( evil ) ) ;
218
218
} ) ( ) ;
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 266
266
267
267
assertEquals ( firstSet . isSubsetOf ( setLike ) , true ) ;
268
268
} ) ( ) ;
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
+ } ) ( ) ;
Original file line number Diff line number Diff line change 245
245
246
246
assertTrue ( firstSet . isSupersetOf ( evil ) ) ;
247
247
} ) ( ) ;
248
+
249
+ ( function TestIsSupersetOfSetLikeWithInfiniteSize ( ) {
250
+ let setLike = {
251
+ size : Infinity ,
252
+ has ( v ) {
253
+ return true ;
254
+ } ,
255
+ keys ( ) {
256
+ throw new Error ( 'Unexpected call to |keys| method' ) ;
257
+ } ,
258
+ } ;
259
+
260
+ const firstSet = new Set ( ) ;
261
+ firstSet . add ( 42 ) ;
262
+ firstSet . add ( 43 ) ;
263
+
264
+ assertEquals ( firstSet . isSupersetOf ( setLike ) , false ) ;
265
+ } ) ( ) ;
266
+
267
+ ( function TestIsSupersetOfSetLikeWithNegativeInfiniteSize ( ) {
268
+ let setLike = {
269
+ size : - Infinity ,
270
+ has ( v ) {
271
+ return true ;
272
+ } ,
273
+ keys ( ) {
274
+ throw new Error ( 'Unexpected call to |keys| method' ) ;
275
+ } ,
276
+ } ;
277
+
278
+ assertThrows ( ( ) => {
279
+ new Set ( ) . isSupersetOf ( setLike ) ;
280
+ } , RangeError , '\'-Infinity\' is an invalid size' ) ;
281
+ } ) ( ) ;
You can’t perform that action at this time.
0 commit comments