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 727 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
738 if (lower()) DeferReplacement(node, node->InputAt(0)); | 738 if (lower()) DeferReplacement(node, node->InputAt(0)); |
739 } else { | 739 } else { |
740 // Require the input in float64 format and perform truncation. | 740 // Require the input in float64 format and perform truncation. |
741 // TODO(turbofan): avoid a truncation with a smi check. | 741 // TODO(turbofan): avoid a truncation with a smi check. |
742 VisitUnop(node, kTypeUint32 | kRepFloat64, kTypeUint32 | kRepWord32); | 742 VisitUnop(node, kTypeUint32 | kRepFloat64, kTypeUint32 | kRepWord32); |
743 if (lower()) | 743 if (lower()) |
744 node->set_op(lowering->machine()->TruncateFloat64ToInt32()); | 744 node->set_op(lowering->machine()->TruncateFloat64ToInt32()); |
745 } | 745 } |
746 break; | 746 break; |
747 } | 747 } |
| 748 case IrOpcode::kPlainPrimitiveToNumber: { |
| 749 VisitUnop(node, kMachAnyTagged, kTypeNumber | kRepTagged); |
| 750 if (lower()) { |
| 751 // PlainPrimitiveToNumber(x) => Call(ToNumberStub, x, no-context) |
| 752 Operator::Properties properties = node->op()->properties(); |
| 753 Callable callable = CodeFactory::ToNumber(jsgraph_->isolate()); |
| 754 CallDescriptor::Flags flags = CallDescriptor::kNoFlags; |
| 755 CallDescriptor* desc = Linkage::GetStubCallDescriptor( |
| 756 callable.descriptor(), 0, flags, properties, jsgraph_->zone()); |
| 757 node->set_op(jsgraph_->common()->Call(desc)); |
| 758 node->InsertInput(jsgraph_->zone(), 0, |
| 759 +jsgraph_->HeapConstant(callable.code())); |
| 760 node->AppendInput(jsgraph_->zone(), jsgraph_->NoContextConstant()); |
| 761 } |
| 762 break; |
| 763 } |
748 case IrOpcode::kReferenceEqual: { | 764 case IrOpcode::kReferenceEqual: { |
749 VisitBinop(node, kMachAnyTagged, kRepBit); | 765 VisitBinop(node, kMachAnyTagged, kRepBit); |
750 if (lower()) node->set_op(lowering->machine()->WordEqual()); | 766 if (lower()) node->set_op(lowering->machine()->WordEqual()); |
751 break; | 767 break; |
752 } | 768 } |
753 case IrOpcode::kStringEqual: { | 769 case IrOpcode::kStringEqual: { |
754 VisitBinop(node, kMachAnyTagged, kRepBit); | 770 VisitBinop(node, kMachAnyTagged, kRepBit); |
755 if (lower()) lowering->DoStringEqual(node); | 771 if (lower()) lowering->DoStringEqual(node); |
756 break; | 772 break; |
757 } | 773 } |
(...skipping 750 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1508 | 1524 |
1509 void SimplifiedLowering::DoStringLessThanOrEqual(Node* node) { | 1525 void SimplifiedLowering::DoStringLessThanOrEqual(Node* node) { |
1510 node->set_op(machine()->IntLessThanOrEqual()); | 1526 node->set_op(machine()->IntLessThanOrEqual()); |
1511 node->ReplaceInput(0, StringComparison(node, true)); | 1527 node->ReplaceInput(0, StringComparison(node, true)); |
1512 node->ReplaceInput(1, jsgraph()->SmiConstant(EQUAL)); | 1528 node->ReplaceInput(1, jsgraph()->SmiConstant(EQUAL)); |
1513 } | 1529 } |
1514 | 1530 |
1515 } // namespace compiler | 1531 } // namespace compiler |
1516 } // namespace internal | 1532 } // namespace internal |
1517 } // namespace v8 | 1533 } // namespace v8 |
OLD | NEW |