Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[v22.x] deps: V8: cherry-pick 217457d0a560 #54883

Merged
merged 1 commit into from
Sep 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion common.gypi
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@

# Reset this number to 0 on major V8 upgrades.
# Increment by one for each non-official patch applied to deps/v8.
'v8_embedder_string': '-node.19',
'v8_embedder_string': '-node.20',

##### V8 defaults for Node.js #####

Expand Down
3 changes: 2 additions & 1 deletion deps/v8/src/builtins/set-difference.tq
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,8 @@ transitioning javascript builtin SetPrototypeDifference(
}
} label SlowPath {
// 6. If thisSize ≤ otherRec.[[Size]], then
if (thisSize <= Convert<int32>(otherRec.size)) {
if (otherRec.size == V8_INFINITY ||
thisSize <= Convert<int32>(otherRec.size)) {
// a. Let index be 0.
let thisIter = collections::NewOrderedHashSetIterator(table.GetTable());

Expand Down
3 changes: 2 additions & 1 deletion deps/v8/src/builtins/set-intersection.tq
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,8 @@ transitioning javascript builtin SetPrototypeIntersection(
}
} label SlowPath {
// 6. If thisSize ≤ otherRec.[[Size]], then
if (thisSize <= Convert<int32>(otherRec.size)) {
if (otherRec.size == V8_INFINITY ||
thisSize <= Convert<int32>(otherRec.size)) {
// a. Let index be 0.
let thisIter = collections::NewOrderedHashSetIterator(table.GetTable());

Expand Down
3 changes: 2 additions & 1 deletion deps/v8/src/builtins/set-is-disjoint-from.tq
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,8 @@ transitioning javascript builtin SetPrototypeIsDisjointFrom(
}
} label SlowPath {
// 5. If thisSize ≤ otherRec.[[Size]], then
if (thisSize <= Convert<int32>(otherRec.size)) {
if (otherRec.size == V8_INFINITY ||
thisSize <= Convert<int32>(otherRec.size)) {
// a. Let index be 0.
let thisIter = collections::NewOrderedHashSetIterator(table.GetTable());

Expand Down
3 changes: 2 additions & 1 deletion deps/v8/src/builtins/set-is-subset-of.tq
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ transitioning javascript builtin SetPrototypeIsSubsetOf(
const thisSize = table.LoadSize();

// 5. If thisSize > otherRec.[[Size]], return false.
if (thisSize > Convert<int32>(otherRec.size)) {
if (!(otherRec.size == V8_INFINITY) &&
thisSize > Convert<int32>(otherRec.size)) {
return False;
}

Expand Down
3 changes: 2 additions & 1 deletion deps/v8/src/builtins/set-is-superset-of.tq
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ transitioning javascript builtin SetPrototypeIsSupersetOf(
const thisSize = table.LoadSize();

// 5. If thisSize < otherRec.[[Size]], return false.
if (thisSize < Convert<int32>(otherRec.size)) {
if (otherRec.size == V8_INFINITY ||
thisSize < Convert<int32>(otherRec.size)) {
return False;
}

Expand Down
41 changes: 40 additions & 1 deletion deps/v8/test/mjsunit/harmony/set-difference.js
Original file line number Diff line number Diff line change
Expand Up @@ -305,4 +305,43 @@
assertThrows(() => {
new Set().difference(setLike);
}, RangeError, "'-1' is an invalid size");
})()
})();

(function TestDifferenceSetLikeWithInfiniteSize() {
let setLike = {
size: Infinity,
has(v) {
return true;
},
keys() {
throw new Error('Unexpected call to |keys| method');
},
};

const firstSet = new Set();
firstSet.add(42);
firstSet.add(43);

const resultSet = new Set();

const resultArray = Array.from(resultSet);
const differenceArray = Array.from(firstSet.difference(setLike));

assertEquals(resultArray, differenceArray);
})();

(function TestDifferenceSetLikeWithNegativeInfiniteSize() {
let setLike = {
size: -Infinity,
has(v) {
return true;
},
keys() {
throw new Error('Unexpected call to |keys| method');
},
};

assertThrows(() => {
new Set().difference(setLike);
}, RangeError, '\'-Infinity\' is an invalid size');
})();
37 changes: 37 additions & 0 deletions deps/v8/test/mjsunit/harmony/set-intersection.js
Original file line number Diff line number Diff line change
Expand Up @@ -281,3 +281,40 @@

assertEquals([43], Array.from(firstSet.intersection(evil)));
})();

(function TestIntersectionSetLikeWithInfiniteSize() {
let setLike = {
size: Infinity,
has(v) {
return true;
},
keys() {
throw new Error('Unexpected call to |keys| method');
},
};

const firstSet = new Set();
firstSet.add(42);
firstSet.add(43);

const resultArray = [42, 43];
const intersectionArray = Array.from(firstSet.intersection(setLike));

assertEquals(resultArray, intersectionArray);
})();

(function TestIntersectionSetLikeWithNegativeInfiniteSize() {
let setLike = {
size: -Infinity,
has(v) {
return true;
},
keys() {
throw new Error('Unexpected call to |keys| method');
},
};

assertThrows(() => {
new Set().intersection(setLike);
}, RangeError, '\'-Infinity\' is an invalid size');
})();
34 changes: 34 additions & 0 deletions deps/v8/test/mjsunit/harmony/set-is-disjoint-from.js
Original file line number Diff line number Diff line change
Expand Up @@ -216,3 +216,37 @@

assertFalse(firstSet.isDisjointFrom(evil));
})();

(function TestIsDisjointFromSetLikeWithInfiniteSize() {
let setLike = {
size: Infinity,
has(v) {
return true;
},
keys() {
throw new Error('Unexpected call to |keys| method');
},
};

const firstSet = new Set();
firstSet.add(42);
firstSet.add(43);

assertEquals(firstSet.isDisjointFrom(setLike), false);
})();

(function TestIsDisjointFromSetLikeWithNegativeInfiniteSize() {
let setLike = {
size: -Infinity,
has(v) {
return true;
},
keys() {
throw new Error('Unexpected call to |keys| method');
},
};

assertThrows(() => {
new Set().isDisjointFrom(setLike);
}, RangeError, '\'-Infinity\' is an invalid size');
})();
34 changes: 34 additions & 0 deletions deps/v8/test/mjsunit/harmony/set-is-subset-of.js
Original file line number Diff line number Diff line change
Expand Up @@ -266,3 +266,37 @@

assertEquals(firstSet.isSubsetOf(setLike), true);
})();

(function TestIsSubsetOfSetLikeWithInfiniteSize() {
let setLike = {
size: Infinity,
has(v) {
return true;
},
keys() {
throw new Error('Unexpected call to |keys| method');
},
};

const firstSet = new Set();
firstSet.add(42);
firstSet.add(43);

assertEquals(firstSet.isSubsetOf(setLike), true);
})();

(function TestIsSubsetOfSetLikeWithNegativeInfiniteSize() {
let setLike = {
size: -Infinity,
has(v) {
return true;
},
keys() {
throw new Error('Unexpected call to |keys| method');
},
};

assertThrows(() => {
new Set().isSubsetOf(setLike);
}, RangeError, '\'-Infinity\' is an invalid size');
})();
34 changes: 34 additions & 0 deletions deps/v8/test/mjsunit/harmony/set-is-superset-of.js
Original file line number Diff line number Diff line change
Expand Up @@ -245,3 +245,37 @@

assertTrue(firstSet.isSupersetOf(evil));
})();

(function TestIsSupersetOfSetLikeWithInfiniteSize() {
let setLike = {
size: Infinity,
has(v) {
return true;
},
keys() {
throw new Error('Unexpected call to |keys| method');
},
};

const firstSet = new Set();
firstSet.add(42);
firstSet.add(43);

assertEquals(firstSet.isSupersetOf(setLike), false);
})();

(function TestIsSupersetOfSetLikeWithNegativeInfiniteSize() {
let setLike = {
size: -Infinity,
has(v) {
return true;
},
keys() {
throw new Error('Unexpected call to |keys| method');
},
};

assertThrows(() => {
new Set().isSupersetOf(setLike);
}, RangeError, '\'-Infinity\' is an invalid size');
})();
Loading