Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 1681 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1692 } | 1692 } |
| 1693 } | 1693 } |
| 1694 } | 1694 } |
| 1695 | 1695 |
| 1696 | 1696 |
| 1697 void LCodeGen::DoMathMinMax(LMathMinMax* instr) { | 1697 void LCodeGen::DoMathMinMax(LMathMinMax* instr) { |
| 1698 LOperand* left = instr->left(); | 1698 LOperand* left = instr->left(); |
| 1699 LOperand* right = instr->right(); | 1699 LOperand* right = instr->right(); |
| 1700 ASSERT(left->Equals(instr->result())); | 1700 ASSERT(left->Equals(instr->result())); |
| 1701 HMathMinMax::Operation operation = instr->hydrogen()->operation(); | 1701 HMathMinMax::Operation operation = instr->hydrogen()->operation(); |
| 1702 if (instr->hydrogen()->representation().IsInteger32()) { | 1702 if (instr->hydrogen()->representation().IsSmiOrInteger32()) { |
| 1703 Label return_left; | 1703 Label return_left; |
| 1704 Condition condition = (operation == HMathMinMax::kMathMin) | 1704 Condition condition = (operation == HMathMinMax::kMathMin) |
| 1705 ? less_equal | 1705 ? less_equal |
| 1706 : greater_equal; | 1706 : greater_equal; |
| 1707 Register left_reg = ToRegister(left); | 1707 Register left_reg = ToRegister(left); |
| 1708 if (right->IsConstantOperand()) { | 1708 if (right->IsConstantOperand()) { |
| 1709 Immediate right_imm = | 1709 Immediate right_imm = |
| 1710 Immediate(ToInteger32(LConstantOperand::cast(right))); | 1710 Immediate(ToInteger32(LConstantOperand::cast(right))); |
| 1711 __ cmpl(left_reg, right_imm); | 1711 __ cmpl(left_reg, right_imm); |
|
Jakob Kummerow
2013/07/26 11:26:14
This seems brittle. Please add an ASSERT(!instr->h
| |
| 1712 __ j(condition, &return_left, Label::kNear); | 1712 __ j(condition, &return_left, Label::kNear); |
| 1713 __ movq(left_reg, right_imm); | 1713 __ movq(left_reg, right_imm); |
| 1714 } else if (right->IsRegister()) { | 1714 } else if (right->IsRegister()) { |
| 1715 Register right_reg = ToRegister(right); | 1715 Register right_reg = ToRegister(right); |
| 1716 __ cmpl(left_reg, right_reg); | 1716 if (instr->hydrogen_value()->representation().IsSmi()) { |
| 1717 __ cmpq(left_reg, right_reg); | |
| 1718 } else { | |
| 1719 __ cmpl(left_reg, right_reg); | |
| 1720 } | |
| 1717 __ j(condition, &return_left, Label::kNear); | 1721 __ j(condition, &return_left, Label::kNear); |
| 1718 __ movq(left_reg, right_reg); | 1722 __ movq(left_reg, right_reg); |
| 1719 } else { | 1723 } else { |
| 1720 Operand right_op = ToOperand(right); | 1724 Operand right_op = ToOperand(right); |
| 1721 __ cmpl(left_reg, right_op); | 1725 if (instr->hydrogen_value()->representation().IsSmi()) { |
| 1726 __ cmpq(left_reg, right_op); | |
| 1727 } else { | |
| 1728 __ cmpl(left_reg, right_op); | |
| 1729 } | |
| 1722 __ j(condition, &return_left, Label::kNear); | 1730 __ j(condition, &return_left, Label::kNear); |
| 1723 __ movq(left_reg, right_op); | 1731 __ movq(left_reg, right_op); |
| 1724 } | 1732 } |
| 1725 __ bind(&return_left); | 1733 __ bind(&return_left); |
| 1726 } else { | 1734 } else { |
| 1727 ASSERT(instr->hydrogen()->representation().IsDouble()); | 1735 ASSERT(instr->hydrogen()->representation().IsDouble()); |
| 1728 Label check_nan_left, check_zero, return_left, return_right; | 1736 Label check_nan_left, check_zero, return_left, return_right; |
| 1729 Condition condition = (operation == HMathMinMax::kMathMin) ? below : above; | 1737 Condition condition = (operation == HMathMinMax::kMathMin) ? below : above; |
| 1730 XMMRegister left_reg = ToDoubleRegister(left); | 1738 XMMRegister left_reg = ToDoubleRegister(left); |
| 1731 XMMRegister right_reg = ToDoubleRegister(right); | 1739 XMMRegister right_reg = ToDoubleRegister(right); |
| (...skipping 3814 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5546 FixedArray::kHeaderSize - kPointerSize)); | 5554 FixedArray::kHeaderSize - kPointerSize)); |
| 5547 __ bind(&done); | 5555 __ bind(&done); |
| 5548 } | 5556 } |
| 5549 | 5557 |
| 5550 | 5558 |
| 5551 #undef __ | 5559 #undef __ |
| 5552 | 5560 |
| 5553 } } // namespace v8::internal | 5561 } } // namespace v8::internal |
| 5554 | 5562 |
| 5555 #endif // V8_TARGET_ARCH_X64 | 5563 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |