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

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

Issue 2108793003: [turbofan] Drop the obsolete TypeGuard operator. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@MathRandom
Patch Set: Created 4 years, 5 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/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 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 case IrOpcode::kNumberTrunc: { 168 case IrOpcode::kNumberTrunc: {
169 Node* const input = NodeProperties::GetValueInput(node, 0); 169 Node* const input = NodeProperties::GetValueInput(node, 0);
170 Type* const input_type = NodeProperties::GetType(input); 170 Type* const input_type = NodeProperties::GetType(input);
171 if (input_type->Is(type_cache_.kIntegerOrMinusZeroOrNaN)) { 171 if (input_type->Is(type_cache_.kIntegerOrMinusZeroOrNaN)) {
172 return Replace(input); 172 return Replace(input);
173 } 173 }
174 break; 174 break;
175 } 175 }
176 case IrOpcode::kReferenceEqual: 176 case IrOpcode::kReferenceEqual:
177 return ReduceReferenceEqual(node); 177 return ReduceReferenceEqual(node);
178 case IrOpcode::kTypeGuard:
179 return ReduceTypeGuard(node);
180 default: 178 default:
181 break; 179 break;
182 } 180 }
183 return NoChange(); 181 return NoChange();
184 } 182 }
185 183
186 Reduction SimplifiedOperatorReducer::ReduceReferenceEqual(Node* node) { 184 Reduction SimplifiedOperatorReducer::ReduceReferenceEqual(Node* node) {
187 DCHECK_EQ(IrOpcode::kReferenceEqual, node->opcode()); 185 DCHECK_EQ(IrOpcode::kReferenceEqual, node->opcode());
188 Node* const left = NodeProperties::GetValueInput(node, 0); 186 Node* const left = NodeProperties::GetValueInput(node, 0);
189 Node* const right = NodeProperties::GetValueInput(node, 1); 187 Node* const right = NodeProperties::GetValueInput(node, 1);
190 HeapObjectMatcher match_left(left); 188 HeapObjectMatcher match_left(left);
191 HeapObjectMatcher match_right(right); 189 HeapObjectMatcher match_right(right);
192 if (match_left.HasValue() && match_right.HasValue()) { 190 if (match_left.HasValue() && match_right.HasValue()) {
193 if (match_left.Value().is_identical_to(match_right.Value())) { 191 if (match_left.Value().is_identical_to(match_right.Value())) {
194 return Replace(jsgraph()->TrueConstant()); 192 return Replace(jsgraph()->TrueConstant());
195 } else { 193 } else {
196 return Replace(jsgraph()->FalseConstant()); 194 return Replace(jsgraph()->FalseConstant());
197 } 195 }
198 } 196 }
199 return NoChange(); 197 return NoChange();
200 } 198 }
201 199
202 Reduction SimplifiedOperatorReducer::ReduceTypeGuard(Node* node) {
203 DCHECK_EQ(IrOpcode::kTypeGuard, node->opcode());
204 Node* const input = NodeProperties::GetValueInput(node, 0);
205 Type* const input_type = NodeProperties::GetTypeOrAny(input);
206 Type* const guard_type = TypeOf(node->op());
207 if (input_type->Is(guard_type)) return Replace(input);
208 return NoChange();
209 }
210
211 Reduction SimplifiedOperatorReducer::Change(Node* node, const Operator* op, 200 Reduction SimplifiedOperatorReducer::Change(Node* node, const Operator* op,
212 Node* a) { 201 Node* a) {
213 DCHECK_EQ(node->InputCount(), OperatorProperties::GetTotalInputCount(op)); 202 DCHECK_EQ(node->InputCount(), OperatorProperties::GetTotalInputCount(op));
214 DCHECK_LE(1, node->InputCount()); 203 DCHECK_LE(1, node->InputCount());
215 node->ReplaceInput(0, a); 204 node->ReplaceInput(0, a);
216 NodeProperties::ChangeOp(node, op); 205 NodeProperties::ChangeOp(node, op);
217 return Changed(node); 206 return Changed(node);
218 } 207 }
219 208
220 Reduction SimplifiedOperatorReducer::ReplaceBoolean(bool value) { 209 Reduction SimplifiedOperatorReducer::ReplaceBoolean(bool value) {
(...skipping 23 matching lines...) Expand all
244 Graph* SimplifiedOperatorReducer::graph() const { return jsgraph()->graph(); } 233 Graph* SimplifiedOperatorReducer::graph() const { return jsgraph()->graph(); }
245 234
246 235
247 MachineOperatorBuilder* SimplifiedOperatorReducer::machine() const { 236 MachineOperatorBuilder* SimplifiedOperatorReducer::machine() const {
248 return jsgraph()->machine(); 237 return jsgraph()->machine();
249 } 238 }
250 239
251 } // namespace compiler 240 } // namespace compiler
252 } // namespace internal 241 } // namespace internal
253 } // namespace v8 242 } // 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