OLD | NEW |
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-lowering.h" | 5 #include "src/compiler/simplified-lowering.h" |
6 | 6 |
7 #include <limits> | 7 #include <limits> |
8 | 8 |
9 #include "src/base/bits.h" | 9 #include "src/base/bits.h" |
10 #include "src/code-factory.h" | 10 #include "src/code-factory.h" |
(...skipping 426 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
437 | 437 |
438 const Operator* Uint32Op(Node* node) { | 438 const Operator* Uint32Op(Node* node) { |
439 return changer_->Uint32OperatorFor(node->opcode()); | 439 return changer_->Uint32OperatorFor(node->opcode()); |
440 } | 440 } |
441 | 441 |
442 const Operator* Float64Op(Node* node) { | 442 const Operator* Float64Op(Node* node) { |
443 return changer_->Float64OperatorFor(node->opcode()); | 443 return changer_->Float64OperatorFor(node->opcode()); |
444 } | 444 } |
445 | 445 |
446 bool CanLowerToInt32Binop(Node* node, MachineTypeUnion use) { | 446 bool CanLowerToInt32Binop(Node* node, MachineTypeUnion use) { |
447 return BothInputsAre(node, Type::Signed32()) && !CanObserveNonInt32(use); | 447 return BothInputsAre(node, Type::Signed32()) && |
| 448 (!CanObserveNonInt32(use) || |
| 449 NodeProperties::GetBounds(node).upper->Is(Type::Signed32())); |
448 } | 450 } |
449 | 451 |
450 bool CanLowerToInt32AdditiveBinop(Node* node, MachineTypeUnion use) { | 452 bool CanLowerToInt32AdditiveBinop(Node* node, MachineTypeUnion use) { |
451 return BothInputsAre(node, safe_int_additive_range_) && | 453 return BothInputsAre(node, safe_int_additive_range_) && |
452 !CanObserveNonInt32(use); | 454 !CanObserveNonInt32(use); |
453 } | 455 } |
454 | 456 |
455 bool CanLowerToUint32Binop(Node* node, MachineTypeUnion use) { | 457 bool CanLowerToUint32Binop(Node* node, MachineTypeUnion use) { |
456 return BothInputsAre(node, Type::Unsigned32()) && !CanObserveNonUint32(use); | 458 return BothInputsAre(node, Type::Unsigned32()) && |
| 459 (!CanObserveNonUint32(use) || |
| 460 NodeProperties::GetBounds(node).upper->Is(Type::Unsigned32())); |
457 } | 461 } |
458 | 462 |
459 bool CanLowerToUint32AdditiveBinop(Node* node, MachineTypeUnion use) { | 463 bool CanLowerToUint32AdditiveBinop(Node* node, MachineTypeUnion use) { |
460 return BothInputsAre(node, safe_int_additive_range_) && | 464 return BothInputsAre(node, safe_int_additive_range_) && |
461 !CanObserveNonUint32(use); | 465 !CanObserveNonUint32(use); |
462 } | 466 } |
463 | 467 |
464 bool CanObserveNonWord32(MachineTypeUnion use) { | 468 bool CanObserveNonWord32(MachineTypeUnion use) { |
465 return (use & ~(kTypeUint32 | kTypeInt32)) != 0; | 469 return (use & ~(kTypeUint32 | kTypeInt32)) != 0; |
466 } | 470 } |
(...skipping 1140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1607 | 1611 |
1608 void SimplifiedLowering::DoStringLessThanOrEqual(Node* node) { | 1612 void SimplifiedLowering::DoStringLessThanOrEqual(Node* node) { |
1609 node->set_op(machine()->IntLessThanOrEqual()); | 1613 node->set_op(machine()->IntLessThanOrEqual()); |
1610 node->ReplaceInput(0, StringComparison(node, true)); | 1614 node->ReplaceInput(0, StringComparison(node, true)); |
1611 node->ReplaceInput(1, jsgraph()->SmiConstant(EQUAL)); | 1615 node->ReplaceInput(1, jsgraph()->SmiConstant(EQUAL)); |
1612 } | 1616 } |
1613 | 1617 |
1614 } // namespace compiler | 1618 } // namespace compiler |
1615 } // namespace internal | 1619 } // namespace internal |
1616 } // namespace v8 | 1620 } // namespace v8 |
OLD | NEW |