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

deps: fix Array.prototype.forEach on v8 6.8 #22899

Closed
wants to merge 1 commit into from
Closed
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 @@ -29,7 +29,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.28',
'v8_embedder_string': '-node.29',

# Enable disassembler for `--print-code` v8 options
'v8_enable_disassembler': 1,
Expand Down
15 changes: 8 additions & 7 deletions deps/v8/src/builtins/array.tq
Original file line number Diff line number Diff line change
Expand Up @@ -300,20 +300,21 @@ module array {

macro ArrayForEachTorqueContinuation(
context: Context, o: Object, len: Number, callbackfn: Callable,
thisArg: Object, initial_k: Smi): Object {
thisArg: Object, initial_k: Number): Object {
// 5. Let k be 0.
// 6. Repeat, while k < len
for (let k: Smi = initial_k; k < len; k = k + 1) {
for (let k: Number = initial_k; k < len; k = k + 1) {
// 6a. Let Pk be ! ToString(k).
let pK: String = ToString_Inline(context, k);
// k is guaranteed to be a positive integer, hence ToString is
// side-effect free and HasProperty/GetProperty do the conversion inline.

// 6b. Let kPresent be ? HasProperty(O, Pk).
let kPresent: Oddball = HasPropertyObject(o, pK, context, kHasProperty);
let kPresent: Oddball = HasPropertyObject(o, k, context, kHasProperty);

// 6c. If kPresent is true, then
if (kPresent == True) {
// 6c. i. Let kValue be ? Get(O, Pk).
let kValue: Object = GetProperty(context, o, pK);
let kValue: Object = GetProperty(context, o, k);

// 6c. ii. Perform ? Call(callbackfn, T, <kValue, k, O>).
Call(context, callbackfn, thisArg, kValue, k, o);
Expand Down Expand Up @@ -346,7 +347,7 @@ module array {
to: Object): Object {
try {
let callbackfn: Callable = cast<Callable>(callback) otherwise Unexpected;
let k: Smi = cast<Smi>(initialK) otherwise Unexpected;
let k: Number = cast<Number>(initialK) otherwise Unexpected;
let number_length: Number = cast<Number>(length) otherwise Unexpected;

return ArrayForEachTorqueContinuation(
Expand Down Expand Up @@ -446,7 +447,7 @@ module array {
let thisArg: Object = arguments.length > 1 ? arguments[1] : Undefined;

// Special cases.
let k: Smi = 0;
let k: Number = 0;
try {
return FastArrayForEach(context, o, len, callbackfn, thisArg)
otherwise Bailout;
Expand Down