| 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 #include <assert.h> // For assert | 5 #include <assert.h> // For assert |
| 6 #include <limits.h> // For LONG_MIN, LONG_MAX. | 6 #include <limits.h> // For LONG_MIN, LONG_MAX. |
| 7 | 7 |
| 8 #if V8_TARGET_ARCH_S390 | 8 #if V8_TARGET_ARCH_S390 |
| 9 | 9 |
| 10 #include "src/base/bits.h" | 10 #include "src/base/bits.h" |
| (...skipping 1911 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1922 } | 1922 } |
| 1923 | 1923 |
| 1924 void MacroAssembler::AllocateTwoByteString(Register result, Register length, | 1924 void MacroAssembler::AllocateTwoByteString(Register result, Register length, |
| 1925 Register scratch1, Register scratch2, | 1925 Register scratch1, Register scratch2, |
| 1926 Register scratch3, | 1926 Register scratch3, |
| 1927 Label* gc_required) { | 1927 Label* gc_required) { |
| 1928 // Calculate the number of bytes needed for the characters in the string while | 1928 // Calculate the number of bytes needed for the characters in the string while |
| 1929 // observing object alignment. | 1929 // observing object alignment. |
| 1930 DCHECK((SeqTwoByteString::kHeaderSize & kObjectAlignmentMask) == 0); | 1930 DCHECK((SeqTwoByteString::kHeaderSize & kObjectAlignmentMask) == 0); |
| 1931 | 1931 |
| 1932 ShiftLeft(scratch1, length, Operand(1)); // Length in bytes, not chars. | 1932 ShiftLeftP(scratch1, length, Operand(1)); // Length in bytes, not chars. |
| 1933 AddP(scratch1, Operand(kObjectAlignmentMask + SeqTwoByteString::kHeaderSize)); | 1933 AddP(scratch1, Operand(kObjectAlignmentMask + SeqTwoByteString::kHeaderSize)); |
| 1934 | 1934 |
| 1935 AndP(scratch1, Operand(~kObjectAlignmentMask)); | 1935 AndP(scratch1, Operand(~kObjectAlignmentMask)); |
| 1936 | 1936 |
| 1937 // Allocate two-byte string in new space. | 1937 // Allocate two-byte string in new space. |
| 1938 Allocate(scratch1, result, scratch2, scratch3, gc_required, TAG_OBJECT); | 1938 Allocate(scratch1, result, scratch2, scratch3, gc_required, TAG_OBJECT); |
| 1939 | 1939 |
| 1940 // Set the map, length and hash field. | 1940 // Set the map, length and hash field. |
| 1941 InitializeNewString(result, length, Heap::kStringMapRootIndex, scratch1, | 1941 InitializeNewString(result, length, Heap::kStringMapRootIndex, scratch1, |
| 1942 scratch2); | 1942 scratch2); |
| (...skipping 2939 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4882 const MemOperand& mem) { | 4882 const MemOperand& mem) { |
| 4883 if (is_uint12(mem.offset())) { | 4883 if (is_uint12(mem.offset())) { |
| 4884 stm(src1, src2, mem); | 4884 stm(src1, src2, mem); |
| 4885 } else { | 4885 } else { |
| 4886 DCHECK(is_int20(mem.offset())); | 4886 DCHECK(is_int20(mem.offset())); |
| 4887 stmy(src1, src2, mem); | 4887 stmy(src1, src2, mem); |
| 4888 } | 4888 } |
| 4889 } | 4889 } |
| 4890 | 4890 |
| 4891 // Load 32-bits and sign extend if necessary. | 4891 // Load 32-bits and sign extend if necessary. |
| 4892 void MacroAssembler::LoadW(Register dst, Register src) { |
| 4893 #if V8_TARGET_ARCH_S390X |
| 4894 lgfr(dst, src); |
| 4895 #else |
| 4896 if (!dst.is(src)) lr(dst, src); |
| 4897 #endif |
| 4898 } |
| 4899 |
| 4900 // Load 32-bits and sign extend if necessary. |
| 4892 void MacroAssembler::LoadW(Register dst, const MemOperand& mem, | 4901 void MacroAssembler::LoadW(Register dst, const MemOperand& mem, |
| 4893 Register scratch) { | 4902 Register scratch) { |
| 4894 int offset = mem.offset(); | 4903 int offset = mem.offset(); |
| 4895 | 4904 |
| 4896 if (!is_int20(offset)) { | 4905 if (!is_int20(offset)) { |
| 4897 DCHECK(!scratch.is(no_reg)); | 4906 DCHECK(!scratch.is(no_reg)); |
| 4898 LoadIntLiteral(scratch, offset); | 4907 LoadIntLiteral(scratch, offset); |
| 4899 #if V8_TARGET_ARCH_S390X | 4908 #if V8_TARGET_ARCH_S390X |
| 4900 lgf(dst, MemOperand(mem.rb(), scratch)); | 4909 lgf(dst, MemOperand(mem.rb(), scratch)); |
| 4901 #else | 4910 #else |
| 4902 l(dst, MemOperand(mem.rb(), scratch)); | 4911 l(dst, MemOperand(mem.rb(), scratch)); |
| 4903 #endif | 4912 #endif |
| 4904 } else { | 4913 } else { |
| 4905 #if V8_TARGET_ARCH_S390X | 4914 #if V8_TARGET_ARCH_S390X |
| 4906 lgf(dst, mem); | 4915 lgf(dst, mem); |
| 4907 #else | 4916 #else |
| 4908 if (is_uint12(offset)) { | 4917 if (is_uint12(offset)) { |
| 4909 l(dst, mem); | 4918 l(dst, mem); |
| 4910 } else { | 4919 } else { |
| 4911 ly(dst, mem); | 4920 ly(dst, mem); |
| 4912 } | 4921 } |
| 4913 #endif | 4922 #endif |
| 4914 } | 4923 } |
| 4915 } | 4924 } |
| 4916 | 4925 |
| 4926 // Load 32-bits and zero extend if necessary. |
| 4927 void MacroAssembler::LoadlW(Register dst, Register src) { |
| 4928 #if V8_TARGET_ARCH_S390X |
| 4929 llgfr(dst, src); |
| 4930 #else |
| 4931 if (!dst.is(src)) lr(dst, src); |
| 4932 #endif |
| 4933 } |
| 4934 |
| 4917 // Variable length depending on whether offset fits into immediate field | 4935 // Variable length depending on whether offset fits into immediate field |
| 4918 // MemOperand of RX or RXY format | 4936 // MemOperand of RX or RXY format |
| 4919 void MacroAssembler::LoadlW(Register dst, const MemOperand& mem, | 4937 void MacroAssembler::LoadlW(Register dst, const MemOperand& mem, |
| 4920 Register scratch) { | 4938 Register scratch) { |
| 4921 Register base = mem.rb(); | 4939 Register base = mem.rb(); |
| 4922 int offset = mem.offset(); | 4940 int offset = mem.offset(); |
| 4923 | 4941 |
| 4924 #if V8_TARGET_ARCH_S390X | 4942 #if V8_TARGET_ARCH_S390X |
| 4925 if (is_int20(offset)) { | 4943 if (is_int20(offset)) { |
| 4926 llgf(dst, mem); | 4944 llgf(dst, mem); |
| (...skipping 477 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5404 } | 5422 } |
| 5405 if (mag.shift > 0) ShiftRightArith(result, result, Operand(mag.shift)); | 5423 if (mag.shift > 0) ShiftRightArith(result, result, Operand(mag.shift)); |
| 5406 ExtractBit(r0, dividend, 31); | 5424 ExtractBit(r0, dividend, 31); |
| 5407 AddP(result, r0); | 5425 AddP(result, r0); |
| 5408 } | 5426 } |
| 5409 | 5427 |
| 5410 } // namespace internal | 5428 } // namespace internal |
| 5411 } // namespace v8 | 5429 } // namespace v8 |
| 5412 | 5430 |
| 5413 #endif // V8_TARGET_ARCH_S390 | 5431 #endif // V8_TARGET_ARCH_S390 |
| OLD | NEW |