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

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

Issue 1195443004: [turbofan] Remove another ineffective optimization from the ControlReducer. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 6 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/cctest/compiler/test-control-reducer.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/graph-reducer.h" 8 #include "src/compiler/graph-reducer.h"
9 #include "src/compiler/js-graph.h" 9 #include "src/compiler/js-graph.h"
10 #include "src/compiler/node-marker.h" 10 #include "src/compiler/node-marker.h"
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 return result == node ? NoChange() : Replace(result); 86 return result == node ? NoChange() : Replace(result);
87 } 87 }
88 88
89 // Try to statically fold a condition. 89 // Try to statically fold a condition.
90 Decision DecideCondition(Node* cond, bool recurse = true) { 90 Decision DecideCondition(Node* cond, bool recurse = true) {
91 switch (cond->opcode()) { 91 switch (cond->opcode()) {
92 case IrOpcode::kInt32Constant: 92 case IrOpcode::kInt32Constant:
93 return Int32Matcher(cond).Is(0) ? kFalse : kTrue; 93 return Int32Matcher(cond).Is(0) ? kFalse : kTrue;
94 case IrOpcode::kInt64Constant: 94 case IrOpcode::kInt64Constant:
95 return Int64Matcher(cond).Is(0) ? kFalse : kTrue; 95 return Int64Matcher(cond).Is(0) ? kFalse : kTrue;
96 case IrOpcode::kNumberConstant:
97 return NumberMatcher(cond).Is(0) ? kFalse : kTrue;
98 case IrOpcode::kHeapConstant: { 96 case IrOpcode::kHeapConstant: {
99 Handle<Object> object = 97 Handle<Object> object =
100 HeapObjectMatcher<Object>(cond).Value().handle(); 98 HeapObjectMatcher<Object>(cond).Value().handle();
101 return object->BooleanValue() ? kTrue : kFalse; 99 return object->BooleanValue() ? kTrue : kFalse;
102 } 100 }
103 case IrOpcode::kPhi: { 101 case IrOpcode::kPhi: {
104 if (!recurse) return kUnknown; // Only go one level deep checking phis. 102 if (!recurse) return kUnknown; // Only go one level deep checking phis.
105 Decision result = kUnknown; 103 Decision result = kUnknown;
106 // Check if all inputs to a phi result in the same decision. 104 // Check if all inputs to a phi result in the same decision.
107 for (int i = cond->op()->ValueInputCount() - 1; i >= 0; i--) { 105 for (int i = cond->op()->ValueInputCount() - 1; i >= 0; i--) {
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after
375 case IrOpcode::kIfFalse: 373 case IrOpcode::kIfFalse:
376 return impl.ReduceIfProjection(node, kFalse); 374 return impl.ReduceIfProjection(node, kFalse);
377 default: 375 default:
378 return node; 376 return node;
379 } 377 }
380 } 378 }
381 379
382 } // namespace compiler 380 } // namespace compiler
383 } // namespace internal 381 } // namespace internal
384 } // namespace v8 382 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | test/cctest/compiler/test-control-reducer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698