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

Side by Side Diff: src/compiler/simplified-lowering.cc

Issue 2170343002: [turbofan] Change Float64Max/Float64Min to JavaScript semantics. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: mips/mips64 ports. 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-lowering.h ('k') | src/compiler/simplified-operator.h » ('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-lowering.h" 5 #include "src/compiler/simplified-lowering.h"
6 6
7 #include <limits> 7 #include <limits>
8 8
9 #include "src/address-map.h" 9 #include "src/address-map.h"
10 #include "src/base/bits.h" 10 #include "src/base/bits.h"
(...skipping 1745 matching lines...) Expand 10 before | Expand all | Expand 10 after
1756 MachineRepresentation::kFloat64); 1756 MachineRepresentation::kFloat64);
1757 if (lower()) DeferReplacement(node, lowering->Float64Floor(node)); 1757 if (lower()) DeferReplacement(node, lowering->Float64Floor(node));
1758 return; 1758 return;
1759 } 1759 }
1760 case IrOpcode::kNumberFround: { 1760 case IrOpcode::kNumberFround: {
1761 VisitUnop(node, UseInfo::TruncatingFloat64(), 1761 VisitUnop(node, UseInfo::TruncatingFloat64(),
1762 MachineRepresentation::kFloat32); 1762 MachineRepresentation::kFloat32);
1763 if (lower()) NodeProperties::ChangeOp(node, Float64Op(node)); 1763 if (lower()) NodeProperties::ChangeOp(node, Float64Op(node));
1764 return; 1764 return;
1765 } 1765 }
1766 case IrOpcode::kNumberMax: {
1767 // TODO(turbofan): We should consider feedback types here as well.
1768 if (BothInputsAreUnsigned32(node)) {
1769 VisitUint32Binop(node);
1770 if (lower()) {
1771 lowering->DoMax(node, lowering->machine()->Uint32LessThan(),
1772 MachineRepresentation::kWord32);
1773 }
1774 } else if (BothInputsAreSigned32(node)) {
1775 VisitInt32Binop(node);
1776 if (lower()) {
1777 lowering->DoMax(node, lowering->machine()->Int32LessThan(),
1778 MachineRepresentation::kWord32);
1779 }
1780 } else if (BothInputsAre(node, Type::PlainNumber())) {
1781 VisitFloat64Binop(node);
1782 if (lower()) {
1783 lowering->DoMax(node, lowering->machine()->Float64LessThan(),
1784 MachineRepresentation::kFloat64);
1785 }
1786 } else {
1787 VisitFloat64Binop(node);
1788 if (lower()) NodeProperties::ChangeOp(node, Float64Op(node));
1789 }
1790 return;
1791 }
1792 case IrOpcode::kNumberMin: {
1793 // TODO(turbofan): We should consider feedback types here as well.
1794 if (BothInputsAreUnsigned32(node)) {
1795 VisitUint32Binop(node);
1796 if (lower()) {
1797 lowering->DoMin(node, lowering->machine()->Uint32LessThan(),
1798 MachineRepresentation::kWord32);
1799 }
1800 } else if (BothInputsAreSigned32(node)) {
1801 VisitInt32Binop(node);
1802 if (lower()) {
1803 lowering->DoMin(node, lowering->machine()->Int32LessThan(),
1804 MachineRepresentation::kWord32);
1805 }
1806 } else if (BothInputsAre(node, Type::PlainNumber())) {
1807 VisitFloat64Binop(node);
1808 if (lower()) {
1809 lowering->DoMin(node, lowering->machine()->Float64LessThan(),
1810 MachineRepresentation::kFloat64);
1811 }
1812 } else {
1813 VisitFloat64Binop(node);
1814 if (lower()) NodeProperties::ChangeOp(node, Float64Op(node));
1815 }
1816 return;
1817 }
1766 case IrOpcode::kNumberAtan2: 1818 case IrOpcode::kNumberAtan2:
1767 case IrOpcode::kNumberPow: { 1819 case IrOpcode::kNumberPow: {
1768 VisitBinop(node, UseInfo::TruncatingFloat64(), 1820 VisitBinop(node, UseInfo::TruncatingFloat64(),
1769 MachineRepresentation::kFloat64); 1821 MachineRepresentation::kFloat64);
1770 if (lower()) NodeProperties::ChangeOp(node, Float64Op(node)); 1822 if (lower()) NodeProperties::ChangeOp(node, Float64Op(node));
1771 return; 1823 return;
1772 } 1824 }
1773 case IrOpcode::kNumberAcos: 1825 case IrOpcode::kNumberAcos:
1774 case IrOpcode::kNumberAcosh: 1826 case IrOpcode::kNumberAcosh:
1775 case IrOpcode::kNumberAsin: 1827 case IrOpcode::kNumberAsin:
(...skipping 1610 matching lines...) Expand 10 before | Expand all | Expand 10 after
3386 true0 = graph()->NewNode(phi_op, true1, false1, if_true0); 3438 true0 = graph()->NewNode(phi_op, true1, false1, if_true0);
3387 } 3439 }
3388 3440
3389 Node* if_false0 = graph()->NewNode(common()->IfFalse(), branch0); 3441 Node* if_false0 = graph()->NewNode(common()->IfFalse(), branch0);
3390 Node* false0 = zero; 3442 Node* false0 = zero;
3391 3443
3392 Node* merge0 = graph()->NewNode(merge_op, if_true0, if_false0); 3444 Node* merge0 = graph()->NewNode(merge_op, if_true0, if_false0);
3393 return graph()->NewNode(phi_op, true0, false0, merge0); 3445 return graph()->NewNode(phi_op, true0, false0, merge0);
3394 } 3446 }
3395 3447
3448 void SimplifiedLowering::DoMax(Node* node, Operator const* op,
3449 MachineRepresentation rep) {
3450 Node* const lhs = node->InputAt(0);
3451 Node* const rhs = node->InputAt(1);
3452
3453 node->ReplaceInput(0, graph()->NewNode(op, lhs, rhs));
3454 DCHECK_EQ(rhs, node->InputAt(1));
3455 node->AppendInput(graph()->zone(), lhs);
3456 NodeProperties::ChangeOp(node, common()->Select(rep));
3457 }
3458
3459 void SimplifiedLowering::DoMin(Node* node, Operator const* op,
3460 MachineRepresentation rep) {
3461 Node* const lhs = node->InputAt(0);
3462 Node* const rhs = node->InputAt(1);
3463
3464 node->InsertInput(graph()->zone(), 0, graph()->NewNode(op, lhs, rhs));
3465 DCHECK_EQ(lhs, node->InputAt(1));
3466 DCHECK_EQ(rhs, node->InputAt(2));
3467 NodeProperties::ChangeOp(node, common()->Select(rep));
3468 }
3396 3469
3397 void SimplifiedLowering::DoShift(Node* node, Operator const* op, 3470 void SimplifiedLowering::DoShift(Node* node, Operator const* op,
3398 Type* rhs_type) { 3471 Type* rhs_type) {
3399 Node* const rhs = NodeProperties::GetValueInput(node, 1); 3472 Node* const rhs = NodeProperties::GetValueInput(node, 1);
3400 if (!rhs_type->Is(type_cache_.kZeroToThirtyOne)) { 3473 if (!rhs_type->Is(type_cache_.kZeroToThirtyOne)) {
3401 node->ReplaceInput(1, graph()->NewNode(machine()->Word32And(), rhs, 3474 node->ReplaceInput(1, graph()->NewNode(machine()->Word32And(), rhs,
3402 jsgraph()->Int32Constant(0x1f))); 3475 jsgraph()->Int32Constant(0x1f)));
3403 } 3476 }
3404 DCHECK(op->HasProperty(Operator::kPure)); 3477 DCHECK(op->HasProperty(Operator::kPure));
3405 ChangeToPureOp(node, op); 3478 ChangeToPureOp(node, op);
(...skipping 28 matching lines...) Expand all
3434 isolate(), graph()->zone(), callable.descriptor(), 0, flags, 3507 isolate(), graph()->zone(), callable.descriptor(), 0, flags,
3435 Operator::kNoProperties); 3508 Operator::kNoProperties);
3436 to_number_operator_.set(common()->Call(desc)); 3509 to_number_operator_.set(common()->Call(desc));
3437 } 3510 }
3438 return to_number_operator_.get(); 3511 return to_number_operator_.get();
3439 } 3512 }
3440 3513
3441 } // namespace compiler 3514 } // namespace compiler
3442 } // namespace internal 3515 } // namespace internal
3443 } // namespace v8 3516 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/simplified-lowering.h ('k') | src/compiler/simplified-operator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698