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

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

Issue 840953003: [turbofan] Correctify representation changes to bit. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: std::isnan 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 | « src/compiler/simplified-operator-reducer.h ('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/access-builder.h" 7 #include "src/compiler/access-builder.h"
8 #include "src/compiler/js-graph.h" 8 #include "src/compiler/js-graph.h"
9 #include "src/compiler/machine-operator.h" 9 #include "src/compiler/machine-operator.h"
10 #include "src/compiler/node-matchers.h" 10 #include "src/compiler/node-matchers.h"
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 HeapObjectMatcher<HeapObject> m(node->InputAt(0)); 47 HeapObjectMatcher<HeapObject> m(node->InputAt(0));
48 if (m.Is(Unique<HeapObject>::CreateImmovable(factory()->false_value()))) { 48 if (m.Is(Unique<HeapObject>::CreateImmovable(factory()->false_value()))) {
49 return ReplaceInt32(0); 49 return ReplaceInt32(0);
50 } 50 }
51 if (m.Is(Unique<HeapObject>::CreateImmovable(factory()->true_value()))) { 51 if (m.Is(Unique<HeapObject>::CreateImmovable(factory()->true_value()))) {
52 return ReplaceInt32(1); 52 return ReplaceInt32(1);
53 } 53 }
54 if (m.IsChangeBitToBool()) return Replace(m.node()->InputAt(0)); 54 if (m.IsChangeBitToBool()) return Replace(m.node()->InputAt(0));
55 break; 55 break;
56 } 56 }
57 case IrOpcode::kChangeWord32ToBit:
58 return ReduceChangeWord32ToBit(node);
57 case IrOpcode::kChangeFloat64ToTagged: { 59 case IrOpcode::kChangeFloat64ToTagged: {
58 Float64Matcher m(node->InputAt(0)); 60 Float64Matcher m(node->InputAt(0));
59 if (m.HasValue()) return ReplaceNumber(m.Value()); 61 if (m.HasValue()) return ReplaceNumber(m.Value());
60 break; 62 break;
61 } 63 }
62 case IrOpcode::kChangeInt32ToTagged: { 64 case IrOpcode::kChangeInt32ToTagged: {
63 Int32Matcher m(node->InputAt(0)); 65 Int32Matcher m(node->InputAt(0));
64 if (m.HasValue()) return ReplaceNumber(m.Value()); 66 if (m.HasValue()) return ReplaceNumber(m.Value());
65 break; 67 break;
66 } 68 }
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 Node* length = graph()->NewNode(simplified()->LoadField(access), input, 131 Node* length = graph()->NewNode(simplified()->LoadField(access), input,
130 graph()->start(), graph()->start()); 132 graph()->start(), graph()->start());
131 Node* compare = graph()->NewNode(simplified()->NumberEqual(), length, 133 Node* compare = graph()->NewNode(simplified()->NumberEqual(), length,
132 jsgraph()->ZeroConstant()); 134 jsgraph()->ZeroConstant());
133 return Change(node, simplified()->BooleanNot(), compare); 135 return Change(node, simplified()->BooleanNot(), compare);
134 } 136 }
135 return NoChange(); 137 return NoChange();
136 } 138 }
137 139
138 140
141 Reduction SimplifiedOperatorReducer::ReduceChangeWord32ToBit(Node* node) {
142 Node* const input = NodeProperties::GetValueInput(node, 0);
143 Type* const input_type = NodeProperties::GetBounds(input).upper;
144 if (input_type->Is(jsgraph()->ZeroOneRangeType())) {
145 // ChangeWord32ToBit(x:bit) => x
146 return Replace(input);
147 }
148 return NoChange();
149 }
150
151
139 Reduction SimplifiedOperatorReducer::Change(Node* node, const Operator* op, 152 Reduction SimplifiedOperatorReducer::Change(Node* node, const Operator* op,
140 Node* a) { 153 Node* a) {
141 DCHECK_EQ(node->InputCount(), OperatorProperties::GetTotalInputCount(op)); 154 DCHECK_EQ(node->InputCount(), OperatorProperties::GetTotalInputCount(op));
142 DCHECK_LE(1, node->InputCount()); 155 DCHECK_LE(1, node->InputCount());
143 node->set_op(op); 156 node->set_op(op);
144 node->ReplaceInput(0, a); 157 node->ReplaceInput(0, a);
145 return Changed(node); 158 return Changed(node);
146 } 159 }
147 160
148 161
(...skipping 30 matching lines...) Expand all
179 } 192 }
180 193
181 194
182 MachineOperatorBuilder* SimplifiedOperatorReducer::machine() const { 195 MachineOperatorBuilder* SimplifiedOperatorReducer::machine() const {
183 return jsgraph()->machine(); 196 return jsgraph()->machine();
184 } 197 }
185 198
186 } // namespace compiler 199 } // namespace compiler
187 } // namespace internal 200 } // namespace internal
188 } // namespace v8 201 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/simplified-operator-reducer.h ('k') | src/compiler/typer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698