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

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

Issue 1942733002: Revert of [turbofan] Remove left-over change bits from ChangeLowering. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 7 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/simplified-operator.cc ('k') | src/compiler/typer.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/simplified-operator-reducer.h" 5 #include "src/compiler/simplified-operator-reducer.h"
6 6
7 #include "src/compiler/js-graph.h" 7 #include "src/compiler/js-graph.h"
8 #include "src/compiler/machine-operator.h" 8 #include "src/compiler/machine-operator.h"
9 #include "src/compiler/node-matchers.h" 9 #include "src/compiler/node-matchers.h"
10 #include "src/compiler/operator-properties.h" 10 #include "src/compiler/operator-properties.h"
(...skipping 13 matching lines...) Expand all
24 Reduction SimplifiedOperatorReducer::Reduce(Node* node) { 24 Reduction SimplifiedOperatorReducer::Reduce(Node* node) {
25 switch (node->opcode()) { 25 switch (node->opcode()) {
26 case IrOpcode::kBooleanNot: { 26 case IrOpcode::kBooleanNot: {
27 HeapObjectMatcher m(node->InputAt(0)); 27 HeapObjectMatcher m(node->InputAt(0));
28 if (m.HasValue()) { 28 if (m.HasValue()) {
29 return Replace(jsgraph()->BooleanConstant(!m.Value()->BooleanValue())); 29 return Replace(jsgraph()->BooleanConstant(!m.Value()->BooleanValue()));
30 } 30 }
31 if (m.IsBooleanNot()) return Replace(m.InputAt(0)); 31 if (m.IsBooleanNot()) return Replace(m.InputAt(0));
32 break; 32 break;
33 } 33 }
34 case IrOpcode::kChangeBitToTagged: { 34 case IrOpcode::kChangeBitToBool: {
35 Int32Matcher m(node->InputAt(0)); 35 Int32Matcher m(node->InputAt(0));
36 if (m.Is(0)) return Replace(jsgraph()->FalseConstant()); 36 if (m.Is(0)) return Replace(jsgraph()->FalseConstant());
37 if (m.Is(1)) return Replace(jsgraph()->TrueConstant()); 37 if (m.Is(1)) return Replace(jsgraph()->TrueConstant());
38 if (m.IsChangeTaggedToBit()) return Replace(m.InputAt(0)); 38 if (m.IsChangeBoolToBit()) return Replace(m.InputAt(0));
39 break; 39 break;
40 } 40 }
41 case IrOpcode::kChangeTaggedToBit: { 41 case IrOpcode::kChangeBoolToBit: {
42 HeapObjectMatcher m(node->InputAt(0)); 42 HeapObjectMatcher m(node->InputAt(0));
43 if (m.HasValue()) return ReplaceInt32(m.Value()->BooleanValue()); 43 if (m.HasValue()) return ReplaceInt32(m.Value()->BooleanValue());
44 if (m.IsChangeBitToTagged()) return Replace(m.InputAt(0)); 44 if (m.IsChangeBitToBool()) return Replace(m.InputAt(0));
45 break; 45 break;
46 } 46 }
47 case IrOpcode::kChangeFloat64ToTagged: { 47 case IrOpcode::kChangeFloat64ToTagged: {
48 Float64Matcher m(node->InputAt(0)); 48 Float64Matcher m(node->InputAt(0));
49 if (m.HasValue()) return ReplaceNumber(m.Value()); 49 if (m.HasValue()) return ReplaceNumber(m.Value());
50 if (m.IsChangeTaggedToFloat64()) return Replace(m.node()->InputAt(0)); 50 if (m.IsChangeTaggedToFloat64()) return Replace(m.node()->InputAt(0));
51 break; 51 break;
52 } 52 }
53 case IrOpcode::kChangeInt31ToTaggedSigned: 53 case IrOpcode::kChangeInt31ToTagged:
54 case IrOpcode::kChangeInt32ToTagged: { 54 case IrOpcode::kChangeInt32ToTagged: {
55 Int32Matcher m(node->InputAt(0)); 55 Int32Matcher m(node->InputAt(0));
56 if (m.HasValue()) return ReplaceNumber(m.Value()); 56 if (m.HasValue()) return ReplaceNumber(m.Value());
57 if (m.IsChangeTaggedToInt32() || m.IsChangeTaggedSignedToInt32()) { 57 if (m.IsChangeTaggedToInt32() || m.IsChangeTaggedSignedToInt32()) {
58 return Replace(m.InputAt(0)); 58 return Replace(m.InputAt(0));
59 } 59 }
60 break; 60 break;
61 } 61 }
62 case IrOpcode::kChangeTaggedToFloat64: { 62 case IrOpcode::kChangeTaggedToFloat64: {
63 NumberMatcher m(node->InputAt(0)); 63 NumberMatcher m(node->InputAt(0));
64 if (m.HasValue()) return ReplaceFloat64(m.Value()); 64 if (m.HasValue()) return ReplaceFloat64(m.Value());
65 if (m.IsChangeFloat64ToTagged()) return Replace(m.node()->InputAt(0)); 65 if (m.IsChangeFloat64ToTagged()) return Replace(m.node()->InputAt(0));
66 if (m.IsChangeInt31ToTaggedSigned() || m.IsChangeInt32ToTagged()) { 66 if (m.IsChangeInt31ToTagged() || m.IsChangeInt32ToTagged()) {
67 return Change(node, machine()->ChangeInt32ToFloat64(), m.InputAt(0)); 67 return Change(node, machine()->ChangeInt32ToFloat64(), m.InputAt(0));
68 } 68 }
69 if (m.IsChangeUint32ToTagged()) { 69 if (m.IsChangeUint32ToTagged()) {
70 return Change(node, machine()->ChangeUint32ToFloat64(), m.InputAt(0)); 70 return Change(node, machine()->ChangeUint32ToFloat64(), m.InputAt(0));
71 } 71 }
72 break; 72 break;
73 } 73 }
74 case IrOpcode::kChangeTaggedToInt32: { 74 case IrOpcode::kChangeTaggedToInt32: {
75 NumberMatcher m(node->InputAt(0)); 75 NumberMatcher m(node->InputAt(0));
76 if (m.HasValue()) return ReplaceInt32(DoubleToInt32(m.Value())); 76 if (m.HasValue()) return ReplaceInt32(DoubleToInt32(m.Value()));
77 if (m.IsChangeFloat64ToTagged()) { 77 if (m.IsChangeFloat64ToTagged()) {
78 return Change(node, machine()->ChangeFloat64ToInt32(), m.InputAt(0)); 78 return Change(node, machine()->ChangeFloat64ToInt32(), m.InputAt(0));
79 } 79 }
80 if (m.IsChangeInt31ToTaggedSigned() || m.IsChangeInt32ToTagged()) { 80 if (m.IsChangeInt31ToTagged() || m.IsChangeInt32ToTagged()) {
81 return Replace(m.InputAt(0)); 81 return Replace(m.InputAt(0));
82 } 82 }
83 break; 83 break;
84 } 84 }
85 case IrOpcode::kChangeTaggedToUint32: { 85 case IrOpcode::kChangeTaggedToUint32: {
86 NumberMatcher m(node->InputAt(0)); 86 NumberMatcher m(node->InputAt(0));
87 if (m.HasValue()) return ReplaceUint32(DoubleToUint32(m.Value())); 87 if (m.HasValue()) return ReplaceUint32(DoubleToUint32(m.Value()));
88 if (m.IsChangeFloat64ToTagged()) { 88 if (m.IsChangeFloat64ToTagged()) {
89 return Change(node, machine()->ChangeFloat64ToUint32(), m.InputAt(0)); 89 return Change(node, machine()->ChangeFloat64ToUint32(), m.InputAt(0));
90 } 90 }
91 if (m.IsChangeUint32ToTagged()) return Replace(m.InputAt(0)); 91 if (m.IsChangeUint32ToTagged()) return Replace(m.InputAt(0));
92 break; 92 break;
93 } 93 }
94 case IrOpcode::kChangeUint32ToTagged: { 94 case IrOpcode::kChangeUint32ToTagged: {
95 Uint32Matcher m(node->InputAt(0)); 95 Uint32Matcher m(node->InputAt(0));
96 if (m.HasValue()) return ReplaceNumber(FastUI2D(m.Value())); 96 if (m.HasValue()) return ReplaceNumber(FastUI2D(m.Value()));
97 break; 97 break;
98 } 98 }
99 case IrOpcode::kTruncateTaggedToWord32: { 99 case IrOpcode::kTruncateTaggedToWord32: {
100 NumberMatcher m(node->InputAt(0)); 100 NumberMatcher m(node->InputAt(0));
101 if (m.HasValue()) return ReplaceInt32(DoubleToInt32(m.Value())); 101 if (m.HasValue()) return ReplaceInt32(DoubleToInt32(m.Value()));
102 if (m.IsChangeInt31ToTaggedSigned() || m.IsChangeInt32ToTagged() || 102 if (m.IsChangeInt31ToTagged() || m.IsChangeInt32ToTagged() ||
103 m.IsChangeUint32ToTagged()) { 103 m.IsChangeUint32ToTagged()) {
104 return Replace(m.InputAt(0)); 104 return Replace(m.InputAt(0));
105 } 105 }
106 if (m.IsChangeFloat64ToTagged()) { 106 if (m.IsChangeFloat64ToTagged()) {
107 return Change(node, machine()->TruncateFloat64ToWord32(), m.InputAt(0)); 107 return Change(node, machine()->TruncateFloat64ToWord32(), m.InputAt(0));
108 } 108 }
109 break; 109 break;
110 } 110 }
111 case IrOpcode::kNumberCeil: 111 case IrOpcode::kNumberCeil:
112 case IrOpcode::kNumberFloor: 112 case IrOpcode::kNumberFloor:
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
177 Graph* SimplifiedOperatorReducer::graph() const { return jsgraph()->graph(); } 177 Graph* SimplifiedOperatorReducer::graph() const { return jsgraph()->graph(); }
178 178
179 179
180 MachineOperatorBuilder* SimplifiedOperatorReducer::machine() const { 180 MachineOperatorBuilder* SimplifiedOperatorReducer::machine() const {
181 return jsgraph()->machine(); 181 return jsgraph()->machine();
182 } 182 }
183 183
184 } // namespace compiler 184 } // namespace compiler
185 } // namespace internal 185 } // namespace internal
186 } // namespace v8 186 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/simplified-operator.cc ('k') | src/compiler/typer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698