Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1)

Side by Side Diff: src/s390/macro-assembler-s390.cc

Issue 1939763003: S390X: Prevent upper 32bit corruption in 32bit ops (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Use macroassembler Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/s390/macro-assembler-s390.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 1907 matching lines...) Expand 10 before | Expand all | Expand 10 after
1918 } 1918 }
1919 1919
1920 void MacroAssembler::AllocateTwoByteString(Register result, Register length, 1920 void MacroAssembler::AllocateTwoByteString(Register result, Register length,
1921 Register scratch1, Register scratch2, 1921 Register scratch1, Register scratch2,
1922 Register scratch3, 1922 Register scratch3,
1923 Label* gc_required) { 1923 Label* gc_required) {
1924 // Calculate the number of bytes needed for the characters in the string while 1924 // Calculate the number of bytes needed for the characters in the string while
1925 // observing object alignment. 1925 // observing object alignment.
1926 DCHECK((SeqTwoByteString::kHeaderSize & kObjectAlignmentMask) == 0); 1926 DCHECK((SeqTwoByteString::kHeaderSize & kObjectAlignmentMask) == 0);
1927 1927
1928 ShiftLeft(scratch1, length, Operand(1)); // Length in bytes, not chars. 1928 ShiftLeftP(scratch1, length, Operand(1)); // Length in bytes, not chars.
1929 AddP(scratch1, Operand(kObjectAlignmentMask + SeqTwoByteString::kHeaderSize)); 1929 AddP(scratch1, Operand(kObjectAlignmentMask + SeqTwoByteString::kHeaderSize));
1930 1930
1931 AndP(scratch1, Operand(~kObjectAlignmentMask)); 1931 AndP(scratch1, Operand(~kObjectAlignmentMask));
1932 1932
1933 // Allocate two-byte string in new space. 1933 // Allocate two-byte string in new space.
1934 Allocate(scratch1, result, scratch2, scratch3, gc_required, 1934 Allocate(scratch1, result, scratch2, scratch3, gc_required,
1935 NO_ALLOCATION_FLAGS); 1935 NO_ALLOCATION_FLAGS);
1936 1936
1937 // Set the map, length and hash field. 1937 // Set the map, length and hash field.
1938 InitializeNewString(result, length, Heap::kStringMapRootIndex, scratch1, 1938 InitializeNewString(result, length, Heap::kStringMapRootIndex, scratch1,
(...skipping 2949 matching lines...) Expand 10 before | Expand all | Expand 10 after
4888 const MemOperand& mem) { 4888 const MemOperand& mem) {
4889 if (is_uint12(mem.offset())) { 4889 if (is_uint12(mem.offset())) {
4890 stm(src1, src2, mem); 4890 stm(src1, src2, mem);
4891 } else { 4891 } else {
4892 DCHECK(is_int20(mem.offset())); 4892 DCHECK(is_int20(mem.offset()));
4893 stmy(src1, src2, mem); 4893 stmy(src1, src2, mem);
4894 } 4894 }
4895 } 4895 }
4896 4896
4897 // Load 32-bits and sign extend if necessary. 4897 // Load 32-bits and sign extend if necessary.
4898 void MacroAssembler::LoadW(Register dst, Register src) {
4899 #if V8_TARGET_ARCH_S390X
4900 lgfr(dst, src);
4901 #else
4902 if (!dst.is(src)) lr(dst, src);
4903 #endif
4904 }
4905
4906 // Load 32-bits and sign extend if necessary.
4898 void MacroAssembler::LoadW(Register dst, const MemOperand& mem, 4907 void MacroAssembler::LoadW(Register dst, const MemOperand& mem,
4899 Register scratch) { 4908 Register scratch) {
4900 int offset = mem.offset(); 4909 int offset = mem.offset();
4901 4910
4902 if (!is_int20(offset)) { 4911 if (!is_int20(offset)) {
4903 DCHECK(!scratch.is(no_reg)); 4912 DCHECK(!scratch.is(no_reg));
4904 LoadIntLiteral(scratch, offset); 4913 LoadIntLiteral(scratch, offset);
4905 #if V8_TARGET_ARCH_S390X 4914 #if V8_TARGET_ARCH_S390X
4906 lgf(dst, MemOperand(mem.rb(), scratch)); 4915 lgf(dst, MemOperand(mem.rb(), scratch));
4907 #else 4916 #else
4908 l(dst, MemOperand(mem.rb(), scratch)); 4917 l(dst, MemOperand(mem.rb(), scratch));
4909 #endif 4918 #endif
4910 } else { 4919 } else {
4911 #if V8_TARGET_ARCH_S390X 4920 #if V8_TARGET_ARCH_S390X
4912 lgf(dst, mem); 4921 lgf(dst, mem);
4913 #else 4922 #else
4914 if (is_uint12(offset)) { 4923 if (is_uint12(offset)) {
4915 l(dst, mem); 4924 l(dst, mem);
4916 } else { 4925 } else {
4917 ly(dst, mem); 4926 ly(dst, mem);
4918 } 4927 }
4919 #endif 4928 #endif
4920 } 4929 }
4921 } 4930 }
4922 4931
4932 // Load 32-bits and zero extend if necessary.
4933 void MacroAssembler::LoadlW(Register dst, Register src) {
4934 #if V8_TARGET_ARCH_S390X
4935 llgfr(dst, src);
4936 #else
4937 if (!dst.is(src)) lr(dst, src);
4938 #endif
4939 }
4940
4923 // Variable length depending on whether offset fits into immediate field 4941 // Variable length depending on whether offset fits into immediate field
4924 // MemOperand of RX or RXY format 4942 // MemOperand of RX or RXY format
4925 void MacroAssembler::LoadlW(Register dst, const MemOperand& mem, 4943 void MacroAssembler::LoadlW(Register dst, const MemOperand& mem,
4926 Register scratch) { 4944 Register scratch) {
4927 Register base = mem.rb(); 4945 Register base = mem.rb();
4928 int offset = mem.offset(); 4946 int offset = mem.offset();
4929 4947
4930 #if V8_TARGET_ARCH_S390X 4948 #if V8_TARGET_ARCH_S390X
4931 if (is_int20(offset)) { 4949 if (is_int20(offset)) {
4932 llgf(dst, mem); 4950 llgf(dst, mem);
(...skipping 485 matching lines...) Expand 10 before | Expand all | Expand 10 after
5418 } 5436 }
5419 if (mag.shift > 0) ShiftRightArith(result, result, Operand(mag.shift)); 5437 if (mag.shift > 0) ShiftRightArith(result, result, Operand(mag.shift));
5420 ExtractBit(r0, dividend, 31); 5438 ExtractBit(r0, dividend, 31);
5421 AddP(result, r0); 5439 AddP(result, r0);
5422 } 5440 }
5423 5441
5424 } // namespace internal 5442 } // namespace internal
5425 } // namespace v8 5443 } // namespace v8
5426 5444
5427 #endif // V8_TARGET_ARCH_S390 5445 #endif // V8_TARGET_ARCH_S390
OLDNEW
« no previous file with comments | « src/s390/macro-assembler-s390.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698