Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(97)

Side by Side Diff: src/compiler/common-operator-reducer.cc

Issue 1450883003: [turbofan] Check for dead node in the common operator reducer. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | test/mjsunit/regress/regress-556543.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/compiler/common-operator-reducer.h" 5 #include "src/compiler/common-operator-reducer.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "src/compiler/common-operator.h" 9 #include "src/compiler/common-operator.h"
10 #include "src/compiler/graph.h" 10 #include "src/compiler/graph.h"
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
197 Node* if_true = merge->InputAt(0); 197 Node* if_true = merge->InputAt(0);
198 Node* if_false = merge->InputAt(1); 198 Node* if_false = merge->InputAt(1);
199 if (if_true->opcode() != IrOpcode::kIfTrue) { 199 if (if_true->opcode() != IrOpcode::kIfTrue) {
200 std::swap(if_true, if_false); 200 std::swap(if_true, if_false);
201 std::swap(vtrue, vfalse); 201 std::swap(vtrue, vfalse);
202 } 202 }
203 if (if_true->opcode() == IrOpcode::kIfTrue && 203 if (if_true->opcode() == IrOpcode::kIfTrue &&
204 if_false->opcode() == IrOpcode::kIfFalse && 204 if_false->opcode() == IrOpcode::kIfFalse &&
205 if_true->InputAt(0) == if_false->InputAt(0)) { 205 if_true->InputAt(0) == if_false->InputAt(0)) {
206 Node* const branch = if_true->InputAt(0); 206 Node* const branch = if_true->InputAt(0);
207 // Check that the branch is not dead already.
208 if (branch->opcode() != IrOpcode::kBranch) return NoChange();
207 Node* const cond = branch->InputAt(0); 209 Node* const cond = branch->InputAt(0);
208 if (cond->opcode() == IrOpcode::kFloat32LessThan) { 210 if (cond->opcode() == IrOpcode::kFloat32LessThan) {
209 Float32BinopMatcher mcond(cond); 211 Float32BinopMatcher mcond(cond);
210 if (mcond.left().Is(0.0) && mcond.right().Equals(vtrue) && 212 if (mcond.left().Is(0.0) && mcond.right().Equals(vtrue) &&
211 vfalse->opcode() == IrOpcode::kFloat32Sub) { 213 vfalse->opcode() == IrOpcode::kFloat32Sub) {
212 Float32BinopMatcher mvfalse(vfalse); 214 Float32BinopMatcher mvfalse(vfalse);
213 if (mvfalse.left().IsZero() && mvfalse.right().Equals(vtrue)) { 215 if (mvfalse.left().IsZero() && mvfalse.right().Equals(vtrue)) {
214 // We might now be able to further reduce the {merge} node. 216 // We might now be able to further reduce the {merge} node.
215 Revisit(merge); 217 Revisit(merge);
216 return Change(node, machine()->Float32Abs(), vtrue); 218 return Change(node, machine()->Float32Abs(), vtrue);
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
384 node->ReplaceInput(0, a); 386 node->ReplaceInput(0, a);
385 node->ReplaceInput(1, b); 387 node->ReplaceInput(1, b);
386 node->TrimInputCount(2); 388 node->TrimInputCount(2);
387 NodeProperties::ChangeOp(node, op); 389 NodeProperties::ChangeOp(node, op);
388 return Changed(node); 390 return Changed(node);
389 } 391 }
390 392
391 } // namespace compiler 393 } // namespace compiler
392 } // namespace internal 394 } // namespace internal
393 } // namespace v8 395 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | test/mjsunit/regress/regress-556543.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698