Skip to content

Commit e527ba4

Browse files
mythrialleCommit Bot
authored andcommitted
Merged: [interpreter] Store accumulator to callee after optional chain checks
Revision: df98901 BUG=chromium:1171954 NOTRY=true NOPRESUBMIT=true NOTREECHECKS=true R=​rmcilroy@chromium.org (cherry picked from commit f309db5) Change-Id: If09e1503ca07b47a112362495ec0bb9d502118c9 Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2674008 Reviewed-by: Ross McIlroy <rmcilroy@chromium.org> Cr-Original-Commit-Position: refs/branch-heads/8.9@{#33} Cr-Original-Branched-From: 16b9bbb-refs/heads/8.9.255@{#1} Cr-Original-Branched-From: d16a2a6-refs/heads/master@{#72039} Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2706110 Reviewed-by: Mythri Alle <mythria@chromium.org> Commit-Queue: Achuith Bhandarkar <achuith@chromium.org> Cr-Commit-Position: refs/branch-heads/8.6@{#62} Cr-Branched-From: a64aed2-refs/heads/8.6.395@{#1} Cr-Branched-From: a626bc0-refs/heads/master@{#69472}
1 parent 8bf16a4 commit e527ba4

3 files changed

Lines changed: 24 additions & 4 deletions

File tree

src/interpreter/bytecode-generator.cc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4892,8 +4892,9 @@ void BytecodeGenerator::VisitCall(Call* expr) {
48924892
Property* property = chain->expression()->AsProperty();
48934893
BuildOptionalChain([&]() {
48944894
VisitAndPushIntoRegisterList(property->obj(), &args);
4895-
VisitPropertyLoadForRegister(args.last_register(), property, callee);
4895+
VisitPropertyLoad(args.last_register(), property);
48964896
});
4897+
builder()->StoreAccumulatorInRegister(callee);
48974898
break;
48984899
}
48994900
case Call::SUPER_CALL:

test/mjsunit/regress/regress-crbug-1038178.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ function opt(){
1515
(((function(){})())?.v)()
1616
}
1717
%PrepareFunctionForOptimization(opt)
18-
assertThrows(opt());
19-
assertThrows(opt());
18+
assertThrows(() => opt());
19+
assertThrows(() => opt());
2020
%OptimizeFunctionOnNextCall(opt)
21-
assertThrows(opt());
21+
assertThrows(() => opt());
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
// Copyright 2021 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: --always-opt
6+
7+
// This causes the register used by the call in the later try-catch block to be
8+
// used by the ToName conversion for null which causes a DCHECK fail when
9+
// compiling. If register allocation changes, this test may no longer reproduce
10+
// the crash but it is not easy write a proper test because it is linked to
11+
// register allocation. This test should always work, so shouldn't cause any
12+
// flakes.
13+
try {
14+
var { [null]: __v_12, } = {};
15+
} catch (e) {}
16+
17+
try {
18+
assertEquals((__v_40?.o?.m)().p);
19+
} catch (e) {}

0 commit comments

Comments
 (0)