| 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 #ifndef V8_S390_MACRO_ASSEMBLER_S390_H_ | 5 #ifndef V8_S390_MACRO_ASSEMBLER_S390_H_ |
| 6 #define V8_S390_MACRO_ASSEMBLER_S390_H_ | 6 #define V8_S390_MACRO_ASSEMBLER_S390_H_ |
| 7 | 7 |
| 8 #include "src/assembler.h" | 8 #include "src/assembler.h" |
| 9 #include "src/bailout-reason.h" | 9 #include "src/bailout-reason.h" |
| 10 #include "src/frames.h" | 10 #include "src/frames.h" |
| (...skipping 1564 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1575 if (kSmiShift < elementSizeLog2) { | 1575 if (kSmiShift < elementSizeLog2) { |
| 1576 ShiftLeftP(dst, src, Operand(elementSizeLog2 - kSmiShift)); | 1576 ShiftLeftP(dst, src, Operand(elementSizeLog2 - kSmiShift)); |
| 1577 } else if (kSmiShift > elementSizeLog2) { | 1577 } else if (kSmiShift > elementSizeLog2) { |
| 1578 ShiftRightArithP(dst, src, Operand(kSmiShift - elementSizeLog2)); | 1578 ShiftRightArithP(dst, src, Operand(kSmiShift - elementSizeLog2)); |
| 1579 } else if (!dst.is(src)) { | 1579 } else if (!dst.is(src)) { |
| 1580 LoadRR(dst, src); | 1580 LoadRR(dst, src); |
| 1581 } | 1581 } |
| 1582 } | 1582 } |
| 1583 | 1583 |
| 1584 void IndexToArrayOffset(Register dst, Register src, int elementSizeLog2, | 1584 void IndexToArrayOffset(Register dst, Register src, int elementSizeLog2, |
| 1585 bool isSmi) { | 1585 bool isSmi, bool keyMaybeNegative) { |
| 1586 if (isSmi) { | 1586 if (isSmi) { |
| 1587 SmiToArrayOffset(dst, src, elementSizeLog2); | 1587 SmiToArrayOffset(dst, src, elementSizeLog2); |
| 1588 } else { | 1588 } else if (keyMaybeNegative || |
| 1589 !CpuFeatures::IsSupported(GENERAL_INSTR_EXT)) { |
| 1589 #if V8_TARGET_ARCH_S390X | 1590 #if V8_TARGET_ARCH_S390X |
| 1591 // If array access is dehoisted, the key, being an int32, can contain |
| 1592 // a negative value, as needs to be sign-extended to 64-bit for |
| 1593 // memory access. |
| 1594 // |
| 1590 // src (key) is a 32-bit integer. Sign extension ensures | 1595 // src (key) is a 32-bit integer. Sign extension ensures |
| 1591 // upper 32-bit does not contain garbage before being used to | 1596 // upper 32-bit does not contain garbage before being used to |
| 1592 // reference memory. | 1597 // reference memory. |
| 1593 lgfr(src, src); | 1598 lgfr(src, src); |
| 1594 #endif | 1599 #endif |
| 1595 ShiftLeftP(dst, src, Operand(elementSizeLog2)); | 1600 ShiftLeftP(dst, src, Operand(elementSizeLog2)); |
| 1601 } else { |
| 1602 // Small optimization to reduce pathlength. After Bounds Check, |
| 1603 // the key is guaranteed to be non-negative. Leverage RISBG, |
| 1604 // which also performs zero-extension. |
| 1605 risbg(dst, src, Operand(32 - elementSizeLog2), |
| 1606 Operand(63 - elementSizeLog2), Operand(elementSizeLog2), |
| 1607 true); |
| 1596 } | 1608 } |
| 1597 } | 1609 } |
| 1598 | 1610 |
| 1599 // Untag the source value into destination and jump if source is a smi. | 1611 // Untag the source value into destination and jump if source is a smi. |
| 1600 // Souce and destination can be the same register. | 1612 // Souce and destination can be the same register. |
| 1601 void UntagAndJumpIfSmi(Register dst, Register src, Label* smi_case); | 1613 void UntagAndJumpIfSmi(Register dst, Register src, Label* smi_case); |
| 1602 | 1614 |
| 1603 // Untag the source value into destination and jump if source is not a smi. | 1615 // Untag the source value into destination and jump if source is not a smi. |
| 1604 // Souce and destination can be the same register. | 1616 // Souce and destination can be the same register. |
| 1605 void UntagAndJumpIfNotSmi(Register dst, Register src, Label* non_smi_case); | 1617 void UntagAndJumpIfNotSmi(Register dst, Register src, Label* non_smi_case); |
| (...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1897 #define ACCESS_MASM(masm) \ | 1909 #define ACCESS_MASM(masm) \ |
| 1898 masm->stop(__FILE_LINE__); \ | 1910 masm->stop(__FILE_LINE__); \ |
| 1899 masm-> | 1911 masm-> |
| 1900 #else | 1912 #else |
| 1901 #define ACCESS_MASM(masm) masm-> | 1913 #define ACCESS_MASM(masm) masm-> |
| 1902 #endif | 1914 #endif |
| 1903 } // namespace internal | 1915 } // namespace internal |
| 1904 } // namespace v8 | 1916 } // namespace v8 |
| 1905 | 1917 |
| 1906 #endif // V8_S390_MACRO_ASSEMBLER_S390_H_ | 1918 #endif // V8_S390_MACRO_ASSEMBLER_S390_H_ |
| OLD | NEW |