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

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

Issue 830923002: Do not reduce effect phis of loops. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Added a comment 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 | « no previous file | test/mjsunit/compiler/regress-ntl-effect.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.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-matchers.h" 9 #include "src/compiler/node-matchers.h"
10 #include "src/compiler/node-properties-inl.h" 10 #include "src/compiler/node-properties-inl.h"
(...skipping 385 matching lines...) Expand 10 before | Expand all | Expand 10 after
396 if (result == kFalse) return fvalue; 396 if (result == kFalse) return fvalue;
397 return node; 397 return node;
398 } 398 }
399 399
400 // Reduce redundant phis. 400 // Reduce redundant phis.
401 Node* ReducePhi(Node* node) { 401 Node* ReducePhi(Node* node) {
402 int n = node->InputCount(); 402 int n = node->InputCount();
403 if (n <= 1) return dead(); // No non-control inputs. 403 if (n <= 1) return dead(); // No non-control inputs.
404 if (n == 2) return node->InputAt(0); // Only one non-control input. 404 if (n == 2) return node->InputAt(0); // Only one non-control input.
405 405
406 // Never remove an effect phi from a (potentially non-terminating) loop.
407 // Otherwise, we might end up eliminating effect nodes, such as calls,
408 // before the loop.
409 if (node->opcode() == IrOpcode::kEffectPhi &&
410 NodeProperties::GetControlInput(node)->opcode() == IrOpcode::kLoop) {
411 return node;
412 }
413
406 Node* replacement = NULL; 414 Node* replacement = NULL;
407 Node::Inputs inputs = node->inputs(); 415 Node::Inputs inputs = node->inputs();
408 for (InputIter it = inputs.begin(); n > 1; --n, ++it) { 416 for (InputIter it = inputs.begin(); n > 1; --n, ++it) {
409 Node* input = *it; 417 Node* input = *it;
410 if (input->opcode() == IrOpcode::kDead) continue; // ignore dead inputs. 418 if (input->opcode() == IrOpcode::kDead) continue; // ignore dead inputs.
411 if (input != node && input != replacement) { // non-redundant input. 419 if (input != node && input != replacement) { // non-redundant input.
412 if (replacement != NULL) return node; 420 if (replacement != NULL) return node;
413 replacement = input; 421 replacement = input;
414 } 422 }
415 } 423 }
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
569 Node* ControlReducer::ReduceBranchForTesting(JSGraph* jsgraph, 577 Node* ControlReducer::ReduceBranchForTesting(JSGraph* jsgraph,
570 CommonOperatorBuilder* common, 578 CommonOperatorBuilder* common,
571 Node* node) { 579 Node* node) {
572 Zone zone(jsgraph->graph()->zone()->isolate()); 580 Zone zone(jsgraph->graph()->zone()->isolate());
573 ControlReducerImpl impl(&zone, jsgraph, common); 581 ControlReducerImpl impl(&zone, jsgraph, common);
574 return impl.ReduceBranch(node); 582 return impl.ReduceBranch(node);
575 } 583 }
576 } 584 }
577 } 585 }
578 } // namespace v8::internal::compiler 586 } // namespace v8::internal::compiler
OLDNEW
« no previous file with comments | « no previous file | test/mjsunit/compiler/regress-ntl-effect.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698