Skip to content

Commit c25cc4e

Browse files
GeorgNeisCommit Bot
authored andcommitted
[turbofan] Remove bogus DCHECK and add a comment
Bug: chromium:1062916 Change-Id: Ic29ca849fb17c1409cc11018fdbc9d3363ebd55c Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2110027 Auto-Submit: Georg Neis <neis@chromium.org> Commit-Queue: Tobias Tebbi <tebbi@chromium.org> Reviewed-by: Tobias Tebbi <tebbi@chromium.org> Cr-Commit-Position: refs/heads/master@{#66801}
1 parent 7905090 commit c25cc4e

2 files changed

Lines changed: 27 additions & 9 deletions

File tree

src/compiler/constant-folding-reducer.cc

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -43,18 +43,16 @@ Node* TryGetConstant(JSGraph* jsgraph, Node* node) {
4343
bool IsAlreadyBeingFolded(Node* node) {
4444
DCHECK(FLAG_assert_types);
4545
if (node->opcode() == IrOpcode::kFoldConstant) return true;
46-
bool found = false;
4746
for (Edge edge : node->use_edges()) {
48-
if (!NodeProperties::IsValueEdge(edge)) continue;
49-
if (edge.from()->opcode() == IrOpcode::kFoldConstant) {
50-
DCHECK(!found);
51-
found = true;
52-
#ifndef ENABLE_SLOW_DCHECKS
53-
break;
54-
#endif
47+
if (NodeProperties::IsValueEdge(edge) &&
48+
edge.from()->opcode() == IrOpcode::kFoldConstant) {
49+
// Note: {node} may have gained new value uses since the time it was
50+
// "constant-folded", and theses uses should ideally be rewritten as well.
51+
// For simplicity, we ignore them here.
52+
return true;
5553
}
5654
}
57-
return found;
55+
return false;
5856
}
5957
} // namespace
6058

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
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: --allow-natives-syntax --no-analyze-environment-liveness --no-use-ic
6+
7+
function foo(x) {
8+
var a = [];
9+
for (var k1 in x) {
10+
for (var k2 in x) {
11+
a.k2;
12+
}
13+
}
14+
return a.join();
15+
}
16+
17+
%PrepareFunctionForOptimization(foo);
18+
foo({p: 42});
19+
%OptimizeFunctionOnNextCall(foo);
20+
foo();

0 commit comments

Comments
 (0)