| OLD | NEW |
| 1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 the V8 project authors. All rights reserved. |
| 2 // | 2 // |
| 3 // Use of this source code is governed by a BSD-style license that can be | 3 // Use of this source code is governed by a BSD-style license that can be |
| 4 // found in the LICENSE file. | 4 // found in the LICENSE file. |
| 5 | 5 |
| 6 #include "src/crankshaft/s390/lithium-codegen-s390.h" | 6 #include "src/crankshaft/s390/lithium-codegen-s390.h" |
| 7 | 7 |
| 8 #include "src/base/bits.h" | 8 #include "src/base/bits.h" |
| 9 #include "src/code-factory.h" | 9 #include "src/code-factory.h" |
| 10 #include "src/code-stubs.h" | 10 #include "src/code-stubs.h" |
| (...skipping 1703 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1714 | 1714 |
| 1715 #if V8_TARGET_ARCH_S390X | 1715 #if V8_TARGET_ARCH_S390X |
| 1716 if (isInteger && checkOverflow) | 1716 if (isInteger && checkOverflow) |
| 1717 __ lgfr(ToRegister(result), ToRegister(result)); | 1717 __ lgfr(ToRegister(result), ToRegister(result)); |
| 1718 #endif | 1718 #endif |
| 1719 if (instr->hydrogen()->CheckFlag(HValue::kCanOverflow)) { | 1719 if (instr->hydrogen()->CheckFlag(HValue::kCanOverflow)) { |
| 1720 DeoptimizeIf(overflow, instr, DeoptimizeReason::kOverflow); | 1720 DeoptimizeIf(overflow, instr, DeoptimizeReason::kOverflow); |
| 1721 } | 1721 } |
| 1722 } | 1722 } |
| 1723 | 1723 |
| 1724 void LCodeGen::DoRSubI(LRSubI* instr) { | |
| 1725 LOperand* left = instr->left(); | |
| 1726 LOperand* right = instr->right(); | |
| 1727 LOperand* result = instr->result(); | |
| 1728 | |
| 1729 DCHECK(!instr->hydrogen()->CheckFlag(HValue::kCanOverflow) && | |
| 1730 right->IsConstantOperand()); | |
| 1731 | |
| 1732 #if V8_TARGET_ARCH_S390X | |
| 1733 // The overflow detection needs to be tested on the lower 32-bits. | |
| 1734 // As a result, on 64-bit, we need to force 32-bit arithmetic operations | |
| 1735 // to set the CC overflow bit properly. The result is then sign-extended. | |
| 1736 bool checkOverflow = instr->hydrogen()->CheckFlag(HValue::kCanOverflow); | |
| 1737 #else | |
| 1738 bool checkOverflow = true; | |
| 1739 #endif | |
| 1740 | |
| 1741 Operand right_operand = ToOperand(right); | |
| 1742 __ mov(r0, right_operand); | |
| 1743 | |
| 1744 if (!checkOverflow) { | |
| 1745 __ SubP_ExtendSrc(ToRegister(result), r0, ToRegister(left)); | |
| 1746 } else { | |
| 1747 __ Sub32(ToRegister(result), r0, ToRegister(left)); | |
| 1748 } | |
| 1749 } | |
| 1750 | |
| 1751 void LCodeGen::DoConstantI(LConstantI* instr) { | 1724 void LCodeGen::DoConstantI(LConstantI* instr) { |
| 1752 __ mov(ToRegister(instr->result()), Operand(instr->value())); | 1725 Register dst = ToRegister(instr->result()); |
| 1726 if (instr->value() == 0) |
| 1727 __ XorP(dst, dst); |
| 1728 else |
| 1729 __ Load(dst, Operand(instr->value())); |
| 1753 } | 1730 } |
| 1754 | 1731 |
| 1755 void LCodeGen::DoConstantS(LConstantS* instr) { | 1732 void LCodeGen::DoConstantS(LConstantS* instr) { |
| 1756 __ LoadSmiLiteral(ToRegister(instr->result()), instr->value()); | 1733 __ LoadSmiLiteral(ToRegister(instr->result()), instr->value()); |
| 1757 } | 1734 } |
| 1758 | 1735 |
| 1759 void LCodeGen::DoConstantD(LConstantD* instr) { | 1736 void LCodeGen::DoConstantD(LConstantD* instr) { |
| 1760 DCHECK(instr->result()->IsDoubleRegister()); | 1737 DCHECK(instr->result()->IsDoubleRegister()); |
| 1761 DoubleRegister result = ToDoubleRegister(instr->result()); | 1738 DoubleRegister result = ToDoubleRegister(instr->result()); |
| 1762 uint64_t bits = instr->bits(); | 1739 uint64_t bits = instr->bits(); |
| (...skipping 3797 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5560 __ LoadP(result, | 5537 __ LoadP(result, |
| 5561 FieldMemOperand(scratch, FixedArray::kHeaderSize - kPointerSize)); | 5538 FieldMemOperand(scratch, FixedArray::kHeaderSize - kPointerSize)); |
| 5562 __ bind(deferred->exit()); | 5539 __ bind(deferred->exit()); |
| 5563 __ bind(&done); | 5540 __ bind(&done); |
| 5564 } | 5541 } |
| 5565 | 5542 |
| 5566 #undef __ | 5543 #undef __ |
| 5567 | 5544 |
| 5568 } // namespace internal | 5545 } // namespace internal |
| 5569 } // namespace v8 | 5546 } // namespace v8 |
| OLD | NEW |