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

Side by Side Diff: src/compiler/control-reducer.cc

Issue 816053002: [turbofan] First version of loop peeling. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 11 months 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 | « BUILD.gn ('k') | src/compiler/graph-visualizer.cc » ('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.h" 5 #include "src/compiler/common-operator.h"
6 #include "src/compiler/control-reducer.h" 6 #include "src/compiler/control-reducer.h"
7 #include "src/compiler/graph.h" 7 #include "src/compiler/graph.h"
8 #include "src/compiler/js-graph.h" 8 #include "src/compiler/js-graph.h"
9 #include "src/compiler/node-marker.h" 9 #include "src/compiler/node-marker.h"
10 #include "src/compiler/node-matchers.h" 10 #include "src/compiler/node-matchers.h"
(...skipping 439 matching lines...) Expand 10 before | Expand all | Expand 10 after
450 if (live > 1 && live == node->InputCount()) return node; // nothing to do. 450 if (live > 1 && live == node->InputCount()) return node; // nothing to do.
451 451
452 TRACE(("ReduceMerge: #%d:%s (%d live)\n", node->id(), 452 TRACE(("ReduceMerge: #%d:%s (%d live)\n", node->id(),
453 node->op()->mnemonic(), live)); 453 node->op()->mnemonic(), live));
454 454
455 if (live == 0) return dead(); // no remaining inputs. 455 if (live == 0) return dead(); // no remaining inputs.
456 456
457 // Gather phis and effect phis to be edited. 457 // Gather phis and effect phis to be edited.
458 ZoneVector<Node*> phis(zone_); 458 ZoneVector<Node*> phis(zone_);
459 for (Node* const use : node->uses()) { 459 for (Node* const use : node->uses()) {
460 if (use->opcode() == IrOpcode::kPhi || 460 if (IrOpcode::IsPhiOpcode(use->opcode())) phis.push_back(use);
461 use->opcode() == IrOpcode::kEffectPhi) {
462 phis.push_back(use);
463 }
464 } 461 }
465 462
466 if (live == 1) { 463 if (live == 1) {
467 // All phis are redundant. Replace them with their live input. 464 // All phis are redundant. Replace them with their live input.
468 for (Node* const phi : phis) ReplaceNode(phi, phi->InputAt(live_index)); 465 for (Node* const phi : phis) ReplaceNode(phi, phi->InputAt(live_index));
469 // The merge itself is redundant. 466 // The merge itself is redundant.
470 return node->InputAt(live_index); 467 return node->InputAt(live_index);
471 } 468 }
472 469
473 // Edit phis in place, removing dead inputs and revisiting them. 470 // Edit phis in place, removing dead inputs and revisiting them.
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
588 Node* ControlReducer::ReduceBranchForTesting(JSGraph* jsgraph, 585 Node* ControlReducer::ReduceBranchForTesting(JSGraph* jsgraph,
589 CommonOperatorBuilder* common, 586 CommonOperatorBuilder* common,
590 Node* node) { 587 Node* node) {
591 Zone zone(jsgraph->graph()->zone()->isolate()); 588 Zone zone(jsgraph->graph()->zone()->isolate());
592 ControlReducerImpl impl(&zone, jsgraph, common); 589 ControlReducerImpl impl(&zone, jsgraph, common);
593 return impl.ReduceBranch(node); 590 return impl.ReduceBranch(node);
594 } 591 }
595 } 592 }
596 } 593 }
597 } // namespace v8::internal::compiler 594 } // namespace v8::internal::compiler
OLDNEW
« no previous file with comments | « BUILD.gn ('k') | src/compiler/graph-visualizer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698