Skip to content

Commit f70ceea

Browse files
tebbiCommit Bot
authored andcommitted
[turbofan] teach escape analysis about oddly occurring simplified number ops
Bug: chromium:726638 Change-Id: Ib30b147ec60f9f13c5164765f8c63be7a1339e9f Reviewed-on: https://chromium-review.googlesource.com/517497 Reviewed-by: Michael Starzinger <[email protected]> Commit-Queue: Tobias Tebbi <[email protected]> Cr-Commit-Position: refs/heads/master@{#45634}
1 parent fc3f29d commit f70ceea

2 files changed

Lines changed: 28 additions & 0 deletions

File tree

src/compiler/escape-analysis.cc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -846,6 +846,10 @@ bool EscapeStatusAnalysis::CheckUsesForEscape(Node* uses, Node* rep,
846846
case IrOpcode::kObjectIsString:
847847
case IrOpcode::kObjectIsSymbol:
848848
case IrOpcode::kObjectIsUndetectable:
849+
#define CASE(opcode) case IrOpcode::k##opcode:
850+
SIMPLIFIED_NUMBER_BINOP_LIST(CASE)
851+
SIMPLIFIED_NUMBER_UNOP_LIST(CASE)
852+
#undef CASE
849853
if (SetEscaped(rep)) {
850854
TRACE("Setting #%d (%s) to escaped because of use by #%d (%s)\n",
851855
rep->id(), rep->op()->mnemonic(), use->id(),
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
// Copyright 2017 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 --turbo-escape
6+
7+
function foo() {
8+
var a = {x:1};
9+
var b = {x:1.5, y: 1};
10+
var x;
11+
for (var i = 0; i < 1; i = {}) {
12+
// The second iteration of this loop is dead code, leading to a
13+
// contradiction between dynamic and static information.
14+
x = a.x + 0.5;
15+
x = a.x % 0.5;
16+
x = Math.abs(a.x);
17+
a = b;
18+
}
19+
return x;
20+
}
21+
foo();
22+
foo();
23+
%OptimizeFunctionOnNextCall(foo);
24+
foo();

0 commit comments

Comments
 (0)