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

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

Issue 817243003: [turbofan] Introduce CommonOperatorReducer. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 12 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 | « src/compiler/common-operator-reducer.h ('k') | src/compiler/pipeline.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "src/compiler/common-operator-reducer.h"
6
7 #include "src/compiler/common-operator.h"
8
9 namespace v8 {
10 namespace internal {
11 namespace compiler {
12
13 Reduction CommonOperatorReducer::Reduce(Node* node) {
14 switch (node->opcode()) {
15 case IrOpcode::kEffectPhi:
16 case IrOpcode::kPhi: {
17 int const input_count = node->InputCount();
18 if (input_count > 1) {
19 Node* const replacement = node->InputAt(0);
20 for (int i = 1; i < input_count - 1; ++i) {
21 if (node->InputAt(i) != replacement) return NoChange();
22 }
23 return Replace(replacement);
24 }
25 break;
26 }
27 case IrOpcode::kSelect: {
28 if (node->InputAt(1) == node->InputAt(2)) {
29 return Replace(node->InputAt(1));
30 }
31 break;
32 }
33 default:
34 break;
35 }
36 return NoChange();
37 }
38
39 } // namespace compiler
40 } // namespace internal
41 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/common-operator-reducer.h ('k') | src/compiler/pipeline.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698