OLD | NEW |
1 // Copyright 2016 the V8 project authors. All rights reserved. | 1 // Copyright 2016 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/typed-optimization.h" | 5 #include "src/compiler/typed-optimization.h" |
6 | 6 |
7 #include "src/compilation-dependencies.h" | 7 #include "src/compilation-dependencies.h" |
8 #include "src/compiler/js-graph.h" | 8 #include "src/compiler/js-graph.h" |
9 #include "src/compiler/node-properties.h" | 9 #include "src/compiler/node-properties.h" |
10 #include "src/compiler/simplified-operator.h" | 10 #include "src/compiler/simplified-operator.h" |
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
212 // NumberToUint32(NumberDivide(lhs, rhs)) | 212 // NumberToUint32(NumberDivide(lhs, rhs)) |
213 // | 213 // |
214 // and just smash the type of the {lhs} on the {node}, | 214 // and just smash the type of the {lhs} on the {node}, |
215 // as the truncated result must be in the same range as | 215 // as the truncated result must be in the same range as |
216 // {lhs} since {rhs} cannot be less than 1 (due to the | 216 // {lhs} since {rhs} cannot be less than 1 (due to the |
217 // plain-number type constraint on the {node}). | 217 // plain-number type constraint on the {node}). |
218 NodeProperties::ChangeOp(node, simplified()->NumberToUint32()); | 218 NodeProperties::ChangeOp(node, simplified()->NumberToUint32()); |
219 NodeProperties::SetType(node, lhs_type); | 219 NodeProperties::SetType(node, lhs_type); |
220 return Changed(node); | 220 return Changed(node); |
221 } | 221 } |
222 if (lhs_type->Is(Type::Signed32()) && rhs_type->Is(Type::Unsigned32())) { | |
223 NodeProperties::ChangeOp(node, simplified()->NumberToInt32()); | |
224 NodeProperties::SetType(node, lhs_type); | |
225 return Changed(node); | |
226 } | |
227 } | 222 } |
228 return NoChange(); | 223 return NoChange(); |
229 } | 224 } |
230 | 225 |
231 Reduction TypedOptimization::ReduceNumberRoundop(Node* node) { | 226 Reduction TypedOptimization::ReduceNumberRoundop(Node* node) { |
232 Node* const input = NodeProperties::GetValueInput(node, 0); | 227 Node* const input = NodeProperties::GetValueInput(node, 0); |
233 Type* const input_type = NodeProperties::GetType(input); | 228 Type* const input_type = NodeProperties::GetType(input); |
234 if (input_type->Is(type_cache_.kIntegerOrMinusZeroOrNaN)) { | 229 if (input_type->Is(type_cache_.kIntegerOrMinusZeroOrNaN)) { |
235 return Replace(input); | 230 return Replace(input); |
236 } | 231 } |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
322 | 317 |
323 Isolate* TypedOptimization::isolate() const { return jsgraph()->isolate(); } | 318 Isolate* TypedOptimization::isolate() const { return jsgraph()->isolate(); } |
324 | 319 |
325 SimplifiedOperatorBuilder* TypedOptimization::simplified() const { | 320 SimplifiedOperatorBuilder* TypedOptimization::simplified() const { |
326 return jsgraph()->simplified(); | 321 return jsgraph()->simplified(); |
327 } | 322 } |
328 | 323 |
329 } // namespace compiler | 324 } // namespace compiler |
330 } // namespace internal | 325 } // namespace internal |
331 } // namespace v8 | 326 } // namespace v8 |
OLD | NEW |