Skip to content

Commit 219b28b

Browse files
GeorgNeisCommit Bot
authored andcommitted
[turbofan] Fix bug in inlining
JSInliningHeuristic::Finalize did not take into account that by the time it gets called some of the candidate nodes may have changed to non-call operators. Bug: chromium:1127319 Change-Id: I180ed36de98455be6b55790ba7bdb4391ff5fd5c Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2409273 Reviewed-by: Tobias Tebbi <[email protected]> Commit-Queue: Georg Neis <[email protected]> Auto-Submit: Georg Neis <[email protected]> Cr-Commit-Position: refs/heads/master@{#69874}
1 parent 12d8d12 commit 219b28b

2 files changed

Lines changed: 43 additions & 4 deletions

File tree

src/compiler/js-inlining-heuristic.cc

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -260,10 +260,9 @@ void JSInliningHeuristic::Finalize() {
260260
Candidate candidate = *i;
261261
candidates_.erase(i);
262262

263-
// Make sure we don't try to inline dead candidate nodes.
264-
if (candidate.node->IsDead()) {
265-
continue;
266-
}
263+
// Ignore this candidate if it's no longer valid.
264+
if (!IrOpcode::IsInlineeOpcode(candidate.node->opcode())) continue;
265+
if (candidate.node->IsDead()) continue;
267266

268267
// Make sure we have some extra budget left, so that any small functions
269268
// exposed by this function would be given a chance to inline.
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
// Copyright 2020 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: --interrupt-budget=1024
6+
7+
function v1() {
8+
const v4 = Reflect;
9+
const v8 = [11.11];
10+
const v10 = {__proto__:1111, a:-1, c:RegExp, f:v8, d:1111, e:-1};
11+
const v12 = [11.11];
12+
function v13() {}
13+
const v16 = {a:v13, b:v13, c:v13, d:v13, e:v13, f:v13, g:v13, h:v13, i:v13, j:v13};
14+
}
15+
16+
function foo() {
17+
let v22 = Number;
18+
v22 = v1;
19+
const v23 = false;
20+
if (v23) {
21+
v22 = Number;
22+
} else {
23+
function v24() {
24+
const v28 = ".Cactus"[0];
25+
for (let v32 = 0; v32 < 7; v32++) {}
26+
}
27+
new Promise(v24);
28+
try {
29+
for (const v37 of v36) {
30+
const v58 = [cactus,cactus,[] = cactus] = v117;
31+
}
32+
} catch(v119) {
33+
}
34+
}
35+
v22();
36+
}
37+
38+
for (let i = 0; i < 10; i++) {
39+
foo();
40+
}

0 commit comments

Comments
 (0)