Skip to content

Commit 04d9d74

Browse files
mrcvtlv8-scoped@luci-project-accounts.iam.gserviceaccount.com
authored andcommitted
[deoptimizer] Handle undefined in MaterializeFixedDoubleArray
When V8_ENABLE_UNDEFINED_DOUBLE is enabled, holey double arrays can store undefined values encoded as Float64::undefined_nan(). During deoptimization, the translated value for such an element evaluates to undefined_value. MaterializeFixedDoubleArray previously assumed that any non-number element must be the_hole_value, leading to a CHECK failure when encountering undefined_value. This CL handles undefined_value under V8_ENABLE_UNDEFINED_DOUBLE by calling array->set_undefined(i). Fixed: 546308452 Change-Id: I445ec4fbc09431ef1cced29870eec18895b894fd Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/8260330 Reviewed-by: Victor Gomes <victorgomes@chromium.org> Commit-Queue: Marco Vitale <mrcvtl@chromium.org> Cr-Commit-Position: refs/heads/main@{#109271}
1 parent 4397869 commit 04d9d74

2 files changed

Lines changed: 35 additions & 0 deletions

File tree

‎src/deoptimizer/translated-state.cc‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2204,6 +2204,10 @@ void TranslatedState::MaterializeFixedDoubleArray(TranslatedFrame* frame,
22042204
DirectHandle<Object> value = frame->values_[*value_index].GetValue();
22052205
if (IsNumber(*value)) {
22062206
array->set(i, Object::NumberValue(*value));
2207+
#ifdef V8_ENABLE_UNDEFINED_DOUBLE
2208+
} else if (value.is_identical_to(isolate()->factory()->undefined_value())) {
2209+
array->set_undefined(i);
2210+
#endif // V8_ENABLE_UNDEFINED_DOUBLE
22072211
} else {
22082212
CHECK(value.is_identical_to(isolate()->factory()->the_hole_value()));
22092213
array->set_the_hole(isolate(), i);
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
// Copyright 2026 the V8 project authors. All rights reserved.
2+
// Use of this source code is governed by a BSD-style license that can be
3+
// found in the LICENSE file.
4+
5+
// Flags: --allow-natives-syntax --turbolev --turbolev-future --no-lazy-feedback-allocation
6+
7+
for (let v0 = 0; v0 < 5; v0++) {
8+
const v3 = [1.5, 2.5];
9+
async function* f4(a5, a6, ...a7) {
10+
for (let v8 = 0; v8 < 5; v8++) {
11+
v8++;
12+
for (let v11 = 0; v11 < 5; v11++) {
13+
%OptimizeOsr();
14+
}
15+
function f13(a14, a15) {
16+
return a15;
17+
}
18+
f13(v0, Symbol);
19+
}
20+
for (let v19 = 0; v19 < 5; v19++) {
21+
const v22 = Array(undefined, v19);
22+
const v24 = {
23+
[Symbol]() {},
24+
};
25+
for await (await using v25 of v3) {}
26+
v22[99] = Array;
27+
}
28+
return Symbol;
29+
}
30+
f4(Symbol, v3, Symbol, v0, v0, v0).next(v3).catch(() => {});
31+
}

0 commit comments

Comments
 (0)