| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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/crankshaft/mips64/lithium-codegen-mips64.h" | 5 #include "src/crankshaft/mips64/lithium-codegen-mips64.h" |
| 6 | 6 |
| 7 #include "src/code-factory.h" | 7 #include "src/code-factory.h" |
| 8 #include "src/code-stubs.h" | 8 #include "src/code-stubs.h" |
| 9 #include "src/crankshaft/hydrogen-osr.h" | 9 #include "src/crankshaft/hydrogen-osr.h" |
| 10 #include "src/crankshaft/mips64/lithium-gap-resolver-mips64.h" | 10 #include "src/crankshaft/mips64/lithium-gap-resolver-mips64.h" |
| (...skipping 1320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1331 | 1331 |
| 1332 if (bailout_on_minus_zero && (constant < 0)) { | 1332 if (bailout_on_minus_zero && (constant < 0)) { |
| 1333 // The case of a null constant will be handled separately. | 1333 // The case of a null constant will be handled separately. |
| 1334 // If constant is negative and left is null, the result should be -0. | 1334 // If constant is negative and left is null, the result should be -0. |
| 1335 DeoptimizeIf(eq, instr, Deoptimizer::kMinusZero, left, Operand(zero_reg)); | 1335 DeoptimizeIf(eq, instr, Deoptimizer::kMinusZero, left, Operand(zero_reg)); |
| 1336 } | 1336 } |
| 1337 | 1337 |
| 1338 switch (constant) { | 1338 switch (constant) { |
| 1339 case -1: | 1339 case -1: |
| 1340 if (overflow) { | 1340 if (overflow) { |
| 1341 __ DsubuAndCheckForOverflow(result, zero_reg, left, scratch); | 1341 Label no_overflow; |
| 1342 DeoptimizeIf(lt, instr, Deoptimizer::kOverflow, scratch, | 1342 __ DsubBranchNoOvf(result, zero_reg, Operand(left), &no_overflow); |
| 1343 Operand(zero_reg)); | 1343 DeoptimizeIf(al, instr); |
| 1344 __ bind(&no_overflow); |
| 1344 } else { | 1345 } else { |
| 1345 __ Dsubu(result, zero_reg, left); | 1346 __ Dsubu(result, zero_reg, left); |
| 1346 } | 1347 } |
| 1347 break; | 1348 break; |
| 1348 case 0: | 1349 case 0: |
| 1349 if (bailout_on_minus_zero) { | 1350 if (bailout_on_minus_zero) { |
| 1350 // If left is strictly negative and the constant is null, the | 1351 // If left is strictly negative and the constant is null, the |
| 1351 // result is -0. Deoptimize if required, otherwise return 0. | 1352 // result is -0. Deoptimize if required, otherwise return 0. |
| 1352 DeoptimizeIf(lt, instr, Deoptimizer::kMinusZero, left, | 1353 DeoptimizeIf(lt, instr, Deoptimizer::kMinusZero, left, |
| 1353 Operand(zero_reg)); | 1354 Operand(zero_reg)); |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1432 | 1433 |
| 1433 if (bailout_on_minus_zero && (constant < 0)) { | 1434 if (bailout_on_minus_zero && (constant < 0)) { |
| 1434 // The case of a null constant will be handled separately. | 1435 // The case of a null constant will be handled separately. |
| 1435 // If constant is negative and left is null, the result should be -0. | 1436 // If constant is negative and left is null, the result should be -0. |
| 1436 DeoptimizeIf(eq, instr, Deoptimizer::kMinusZero, left, Operand(zero_reg)); | 1437 DeoptimizeIf(eq, instr, Deoptimizer::kMinusZero, left, Operand(zero_reg)); |
| 1437 } | 1438 } |
| 1438 | 1439 |
| 1439 switch (constant) { | 1440 switch (constant) { |
| 1440 case -1: | 1441 case -1: |
| 1441 if (overflow) { | 1442 if (overflow) { |
| 1442 __ SubuAndCheckForOverflow(result, zero_reg, left, scratch); | 1443 Label no_overflow; |
| 1443 DeoptimizeIf(lt, instr, Deoptimizer::kOverflow, scratch, | 1444 __ SubBranchNoOvf(result, zero_reg, Operand(left), &no_overflow); |
| 1444 Operand(zero_reg)); | 1445 DeoptimizeIf(al, instr); |
| 1446 __ bind(&no_overflow); |
| 1445 } else { | 1447 } else { |
| 1446 __ Subu(result, zero_reg, left); | 1448 __ Subu(result, zero_reg, left); |
| 1447 } | 1449 } |
| 1448 break; | 1450 break; |
| 1449 case 0: | 1451 case 0: |
| 1450 if (bailout_on_minus_zero) { | 1452 if (bailout_on_minus_zero) { |
| 1451 // If left is strictly negative and the constant is null, the | 1453 // If left is strictly negative and the constant is null, the |
| 1452 // result is -0. Deoptimize if required, otherwise return 0. | 1454 // result is -0. Deoptimize if required, otherwise return 0. |
| 1453 DeoptimizeIf(lt, instr, Deoptimizer::kMinusZero, left, | 1455 DeoptimizeIf(lt, instr, Deoptimizer::kMinusZero, left, |
| 1454 Operand(zero_reg)); | 1456 Operand(zero_reg)); |
| (...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1640 void LCodeGen::DoSubS(LSubS* instr) { | 1642 void LCodeGen::DoSubS(LSubS* instr) { |
| 1641 LOperand* left = instr->left(); | 1643 LOperand* left = instr->left(); |
| 1642 LOperand* right = instr->right(); | 1644 LOperand* right = instr->right(); |
| 1643 LOperand* result = instr->result(); | 1645 LOperand* result = instr->result(); |
| 1644 bool can_overflow = instr->hydrogen()->CheckFlag(HValue::kCanOverflow); | 1646 bool can_overflow = instr->hydrogen()->CheckFlag(HValue::kCanOverflow); |
| 1645 | 1647 |
| 1646 if (!can_overflow) { | 1648 if (!can_overflow) { |
| 1647 DCHECK(right->IsRegister() || right->IsConstantOperand()); | 1649 DCHECK(right->IsRegister() || right->IsConstantOperand()); |
| 1648 __ Dsubu(ToRegister(result), ToRegister(left), ToOperand(right)); | 1650 __ Dsubu(ToRegister(result), ToRegister(left), ToOperand(right)); |
| 1649 } else { // can_overflow. | 1651 } else { // can_overflow. |
| 1650 Register overflow = scratch0(); | 1652 Register scratch = scratch0(); |
| 1651 Register scratch = scratch1(); | 1653 Label no_overflow_label; |
| 1652 DCHECK(right->IsRegister() || right->IsConstantOperand()); | 1654 DCHECK(right->IsRegister() || right->IsConstantOperand()); |
| 1653 __ DsubuAndCheckForOverflow(ToRegister(result), ToRegister(left), | 1655 __ DsubBranchNoOvf(ToRegister(result), ToRegister(left), ToOperand(right), |
| 1654 ToOperand(right), overflow, scratch); | 1656 &no_overflow_label, scratch); |
| 1655 DeoptimizeIf(lt, instr, Deoptimizer::kOverflow, overflow, | 1657 DeoptimizeIf(al, instr); |
| 1656 Operand(zero_reg)); | 1658 __ bind(&no_overflow_label); |
| 1657 } | 1659 } |
| 1658 } | 1660 } |
| 1659 | 1661 |
| 1660 | 1662 |
| 1661 void LCodeGen::DoSubI(LSubI* instr) { | 1663 void LCodeGen::DoSubI(LSubI* instr) { |
| 1662 LOperand* left = instr->left(); | 1664 LOperand* left = instr->left(); |
| 1663 LOperand* right = instr->right(); | 1665 LOperand* right = instr->right(); |
| 1664 LOperand* result = instr->result(); | 1666 LOperand* result = instr->result(); |
| 1665 bool can_overflow = instr->hydrogen()->CheckFlag(HValue::kCanOverflow); | 1667 bool can_overflow = instr->hydrogen()->CheckFlag(HValue::kCanOverflow); |
| 1666 | 1668 |
| 1667 if (!can_overflow) { | 1669 if (!can_overflow) { |
| 1668 DCHECK(right->IsRegister() || right->IsConstantOperand()); | 1670 DCHECK(right->IsRegister() || right->IsConstantOperand()); |
| 1669 __ Subu(ToRegister(result), ToRegister(left), ToOperand(right)); | 1671 __ Subu(ToRegister(result), ToRegister(left), ToOperand(right)); |
| 1670 } else { // can_overflow. | 1672 } else { // can_overflow. |
| 1671 Register overflow = scratch0(); | 1673 Register scratch = scratch0(); |
| 1672 Register scratch = scratch1(); | 1674 Label no_overflow_label; |
| 1673 DCHECK(right->IsRegister() || right->IsConstantOperand()); | 1675 DCHECK(right->IsRegister() || right->IsConstantOperand()); |
| 1674 __ SubuAndCheckForOverflow(ToRegister(result), ToRegister(left), | 1676 __ SubBranchNoOvf(ToRegister(result), ToRegister(left), ToOperand(right), |
| 1675 ToOperand(right), overflow, scratch); | 1677 &no_overflow_label, scratch); |
| 1676 DeoptimizeIf(lt, instr, Deoptimizer::kOverflow, overflow, | 1678 DeoptimizeIf(al, instr); |
| 1677 Operand(zero_reg)); | 1679 __ bind(&no_overflow_label); |
| 1678 } | 1680 } |
| 1679 } | 1681 } |
| 1680 | 1682 |
| 1681 | 1683 |
| 1682 void LCodeGen::DoConstantI(LConstantI* instr) { | 1684 void LCodeGen::DoConstantI(LConstantI* instr) { |
| 1683 __ li(ToRegister(instr->result()), Operand(instr->value())); | 1685 __ li(ToRegister(instr->result()), Operand(instr->value())); |
| 1684 } | 1686 } |
| 1685 | 1687 |
| 1686 | 1688 |
| 1687 void LCodeGen::DoConstantS(LConstantS* instr) { | 1689 void LCodeGen::DoConstantS(LConstantS* instr) { |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1801 void LCodeGen::DoAddS(LAddS* instr) { | 1803 void LCodeGen::DoAddS(LAddS* instr) { |
| 1802 LOperand* left = instr->left(); | 1804 LOperand* left = instr->left(); |
| 1803 LOperand* right = instr->right(); | 1805 LOperand* right = instr->right(); |
| 1804 LOperand* result = instr->result(); | 1806 LOperand* result = instr->result(); |
| 1805 bool can_overflow = instr->hydrogen()->CheckFlag(HValue::kCanOverflow); | 1807 bool can_overflow = instr->hydrogen()->CheckFlag(HValue::kCanOverflow); |
| 1806 | 1808 |
| 1807 if (!can_overflow) { | 1809 if (!can_overflow) { |
| 1808 DCHECK(right->IsRegister() || right->IsConstantOperand()); | 1810 DCHECK(right->IsRegister() || right->IsConstantOperand()); |
| 1809 __ Daddu(ToRegister(result), ToRegister(left), ToOperand(right)); | 1811 __ Daddu(ToRegister(result), ToRegister(left), ToOperand(right)); |
| 1810 } else { // can_overflow. | 1812 } else { // can_overflow. |
| 1811 Register overflow = scratch0(); | 1813 Label no_overflow_label; |
| 1812 Register scratch = scratch1(); | 1814 Register scratch = scratch1(); |
| 1813 DCHECK(right->IsRegister() || right->IsConstantOperand()); | 1815 DCHECK(right->IsRegister() || right->IsConstantOperand()); |
| 1814 __ DadduAndCheckForOverflow(ToRegister(result), ToRegister(left), | 1816 __ DaddBranchNoOvf(ToRegister(result), ToRegister(left), ToOperand(right), |
| 1815 ToOperand(right), overflow, scratch); | 1817 &no_overflow_label, scratch); |
| 1816 DeoptimizeIf(lt, instr, Deoptimizer::kOverflow, overflow, | 1818 DeoptimizeIf(al, instr); |
| 1817 Operand(zero_reg)); | 1819 __ bind(&no_overflow_label); |
| 1818 } | 1820 } |
| 1819 } | 1821 } |
| 1820 | 1822 |
| 1821 | 1823 |
| 1822 void LCodeGen::DoAddI(LAddI* instr) { | 1824 void LCodeGen::DoAddI(LAddI* instr) { |
| 1823 LOperand* left = instr->left(); | 1825 LOperand* left = instr->left(); |
| 1824 LOperand* right = instr->right(); | 1826 LOperand* right = instr->right(); |
| 1825 LOperand* result = instr->result(); | 1827 LOperand* result = instr->result(); |
| 1826 bool can_overflow = instr->hydrogen()->CheckFlag(HValue::kCanOverflow); | 1828 bool can_overflow = instr->hydrogen()->CheckFlag(HValue::kCanOverflow); |
| 1827 | 1829 |
| 1828 if (!can_overflow) { | 1830 if (!can_overflow) { |
| 1829 DCHECK(right->IsRegister() || right->IsConstantOperand()); | 1831 DCHECK(right->IsRegister() || right->IsConstantOperand()); |
| 1830 __ Addu(ToRegister(result), ToRegister(left), ToOperand(right)); | 1832 __ Addu(ToRegister(result), ToRegister(left), ToOperand(right)); |
| 1831 } else { // can_overflow. | 1833 } else { // can_overflow. |
| 1832 Register overflow = scratch0(); | 1834 Label no_overflow_label; |
| 1833 Register scratch = scratch1(); | 1835 Register scratch = scratch1(); |
| 1834 DCHECK(right->IsRegister() || right->IsConstantOperand()); | 1836 DCHECK(right->IsRegister() || right->IsConstantOperand()); |
| 1835 __ AdduAndCheckForOverflow(ToRegister(result), ToRegister(left), | 1837 __ AddBranchNoOvf(ToRegister(result), ToRegister(left), ToOperand(right), |
| 1836 ToOperand(right), overflow, scratch); | 1838 &no_overflow_label, scratch); |
| 1837 DeoptimizeIf(lt, instr, Deoptimizer::kOverflow, overflow, | 1839 DeoptimizeIf(al, instr); |
| 1838 Operand(zero_reg)); | 1840 __ bind(&no_overflow_label); |
| 1839 } | 1841 } |
| 1840 } | 1842 } |
| 1841 | 1843 |
| 1842 | 1844 |
| 1843 void LCodeGen::DoMathMinMax(LMathMinMax* instr) { | 1845 void LCodeGen::DoMathMinMax(LMathMinMax* instr) { |
| 1844 LOperand* left = instr->left(); | 1846 LOperand* left = instr->left(); |
| 1845 LOperand* right = instr->right(); | 1847 LOperand* right = instr->right(); |
| 1846 HMathMinMax::Operation operation = instr->hydrogen()->operation(); | 1848 HMathMinMax::Operation operation = instr->hydrogen()->operation(); |
| 1847 Condition condition = (operation == HMathMinMax::kMathMin) ? le : ge; | 1849 Condition condition = (operation == HMathMinMax::kMathMin) ? le : ge; |
| 1848 if (instr->hydrogen()->representation().IsSmiOrInteger32()) { | 1850 if (instr->hydrogen()->representation().IsSmiOrInteger32()) { |
| (...skipping 3911 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5760 void LCodeGen::DoStoreFrameContext(LStoreFrameContext* instr) { | 5762 void LCodeGen::DoStoreFrameContext(LStoreFrameContext* instr) { |
| 5761 Register context = ToRegister(instr->context()); | 5763 Register context = ToRegister(instr->context()); |
| 5762 __ sd(context, MemOperand(fp, StandardFrameConstants::kContextOffset)); | 5764 __ sd(context, MemOperand(fp, StandardFrameConstants::kContextOffset)); |
| 5763 } | 5765 } |
| 5764 | 5766 |
| 5765 | 5767 |
| 5766 #undef __ | 5768 #undef __ |
| 5767 | 5769 |
| 5768 } // namespace internal | 5770 } // namespace internal |
| 5769 } // namespace v8 | 5771 } // namespace v8 |
| OLD | NEW |