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

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

Issue 2921473003: PPC/S390: [compiler] Delay allocation of code-embedded heap numbers.
Patch Set: additional changes for s390 Created 3 years, 6 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/codegen-s390.cc ('k') | test/cctest/test-assembler-ppc.cc » ('j') | 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 3091 matching lines...) Expand 10 before | Expand all | Expand 10 after
3102 Register candidate = Register::from_code(code); 3102 Register candidate = Register::from_code(code);
3103 if (regs & candidate.bit()) continue; 3103 if (regs & candidate.bit()) continue;
3104 return candidate; 3104 return candidate;
3105 } 3105 }
3106 UNREACHABLE(); 3106 UNREACHABLE();
3107 } 3107 }
3108 3108
3109 void MacroAssembler::mov(Register dst, const Operand& src) { 3109 void MacroAssembler::mov(Register dst, const Operand& src) {
3110 if (src.rmode_ != kRelocInfo_NONEPTR) { 3110 if (src.rmode_ != kRelocInfo_NONEPTR) {
3111 // some form of relocation needed 3111 // some form of relocation needed
3112 RecordRelocInfo(src.rmode_, src.imm_); 3112 RecordRelocInfo(src.rmode_, src.immediate());
3113 } 3113 }
3114 3114
3115 #if V8_TARGET_ARCH_S390X 3115 #if V8_TARGET_ARCH_S390X
3116 int64_t value = src.immediate(); 3116 int64_t value = src.immediate();
3117 int32_t hi_32 = static_cast<int64_t>(value) >> 32; 3117 int32_t hi_32 = static_cast<int64_t>(value) >> 32;
3118 int32_t lo_32 = static_cast<int32_t>(value); 3118 int32_t lo_32 = static_cast<int32_t>(value);
3119 3119
3120 iihf(dst, Operand(hi_32)); 3120 iihf(dst, Operand(hi_32));
3121 iilf(dst, Operand(lo_32)); 3121 iilf(dst, Operand(lo_32));
3122 #else 3122 #else
(...skipping 633 matching lines...) Expand 10 before | Expand all | Expand 10 after
3756 } else { 3756 } else {
3757 // dst == src2 3757 // dst == src2
3758 DCHECK(dst.is(src2)); 3758 DCHECK(dst.is(src2));
3759 lr(r0, dst); 3759 lr(r0, dst);
3760 SubLogical32(dst, src1, r0); 3760 SubLogical32(dst, src1, r0);
3761 } 3761 }
3762 } 3762 }
3763 3763
3764 // Subtract 32-bit (Register dst = Register dst - Immediate opnd) 3764 // Subtract 32-bit (Register dst = Register dst - Immediate opnd)
3765 void MacroAssembler::Sub32(Register dst, const Operand& imm) { 3765 void MacroAssembler::Sub32(Register dst, const Operand& imm) {
3766 Add32(dst, Operand(-(imm.imm_))); 3766 Add32(dst, Operand(-(imm.immediate())));
3767 } 3767 }
3768 3768
3769 // Subtract Pointer Size (Register dst = Register dst - Immediate opnd) 3769 // Subtract Pointer Size (Register dst = Register dst - Immediate opnd)
3770 void MacroAssembler::SubP(Register dst, const Operand& imm) { 3770 void MacroAssembler::SubP(Register dst, const Operand& imm) {
3771 AddP(dst, Operand(-(imm.imm_))); 3771 AddP(dst, Operand(-(imm.immediate())));
3772 } 3772 }
3773 3773
3774 // Subtract 32-bit (Register dst = Register src - Immediate opnd) 3774 // Subtract 32-bit (Register dst = Register src - Immediate opnd)
3775 void MacroAssembler::Sub32(Register dst, Register src, const Operand& imm) { 3775 void MacroAssembler::Sub32(Register dst, Register src, const Operand& imm) {
3776 Add32(dst, src, Operand(-(imm.imm_))); 3776 Add32(dst, src, Operand(-(imm.immediate())));
3777 } 3777 }
3778 3778
3779 // Subtract Pointer Sized (Register dst = Register src - Immediate opnd) 3779 // Subtract Pointer Sized (Register dst = Register src - Immediate opnd)
3780 void MacroAssembler::SubP(Register dst, Register src, const Operand& imm) { 3780 void MacroAssembler::SubP(Register dst, Register src, const Operand& imm) {
3781 AddP(dst, src, Operand(-(imm.imm_))); 3781 AddP(dst, src, Operand(-(imm.immediate())));
3782 } 3782 }
3783 3783
3784 // Subtract 32-bit (Register dst = Register dst - Register src) 3784 // Subtract 32-bit (Register dst = Register dst - Register src)
3785 void MacroAssembler::Sub32(Register dst, Register src) { sr(dst, src); } 3785 void MacroAssembler::Sub32(Register dst, Register src) { sr(dst, src); }
3786 3786
3787 // Subtract Pointer Size (Register dst = Register dst - Register src) 3787 // Subtract Pointer Size (Register dst = Register dst - Register src)
3788 void MacroAssembler::SubP(Register dst, Register src) { SubRR(dst, src); } 3788 void MacroAssembler::SubP(Register dst, Register src) { SubRR(dst, src); }
3789 3789
3790 // Subtract Pointer Size with src extension 3790 // Subtract Pointer Size with src extension
3791 // (Register dst(ptr) = Register dst (ptr) - Register src (32 | 32->64)) 3791 // (Register dst(ptr) = Register dst (ptr) - Register src (32 | 32->64))
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after
3997 And(dst, opnd); 3997 And(dst, opnd);
3998 #endif 3998 #endif
3999 } 3999 }
4000 4000
4001 // AND 32-bit - dst = dst & imm 4001 // AND 32-bit - dst = dst & imm
4002 void MacroAssembler::And(Register dst, const Operand& opnd) { nilf(dst, opnd); } 4002 void MacroAssembler::And(Register dst, const Operand& opnd) { nilf(dst, opnd); }
4003 4003
4004 // AND Pointer Size - dst = dst & imm 4004 // AND Pointer Size - dst = dst & imm
4005 void MacroAssembler::AndP(Register dst, const Operand& opnd) { 4005 void MacroAssembler::AndP(Register dst, const Operand& opnd) {
4006 #if V8_TARGET_ARCH_S390X 4006 #if V8_TARGET_ARCH_S390X
4007 intptr_t value = opnd.imm_; 4007 intptr_t value = opnd.immediate();
4008 if (value >> 32 != -1) { 4008 if (value >> 32 != -1) {
4009 // this may not work b/c condition code won't be set correctly 4009 // this may not work b/c condition code won't be set correctly
4010 nihf(dst, Operand(value >> 32)); 4010 nihf(dst, Operand(value >> 32));
4011 } 4011 }
4012 nilf(dst, Operand(value & 0xFFFFFFFF)); 4012 nilf(dst, Operand(value & 0xFFFFFFFF));
4013 #else 4013 #else
4014 And(dst, opnd); 4014 And(dst, opnd);
4015 #endif 4015 #endif
4016 } 4016 }
4017 4017
4018 // AND 32-bit - dst = src & imm 4018 // AND 32-bit - dst = src & imm
4019 void MacroAssembler::And(Register dst, Register src, const Operand& opnd) { 4019 void MacroAssembler::And(Register dst, Register src, const Operand& opnd) {
4020 if (!dst.is(src)) lr(dst, src); 4020 if (!dst.is(src)) lr(dst, src);
4021 nilf(dst, opnd); 4021 nilf(dst, opnd);
4022 } 4022 }
4023 4023
4024 // AND Pointer Size - dst = src & imm 4024 // AND Pointer Size - dst = src & imm
4025 void MacroAssembler::AndP(Register dst, Register src, const Operand& opnd) { 4025 void MacroAssembler::AndP(Register dst, Register src, const Operand& opnd) {
4026 // Try to exploit RISBG first 4026 // Try to exploit RISBG first
4027 intptr_t value = opnd.imm_; 4027 intptr_t value = opnd.immediate();
4028 if (CpuFeatures::IsSupported(GENERAL_INSTR_EXT)) { 4028 if (CpuFeatures::IsSupported(GENERAL_INSTR_EXT)) {
4029 intptr_t shifted_value = value; 4029 intptr_t shifted_value = value;
4030 int trailing_zeros = 0; 4030 int trailing_zeros = 0;
4031 4031
4032 // We start checking how many trailing zeros are left at the end. 4032 // We start checking how many trailing zeros are left at the end.
4033 while ((0 != shifted_value) && (0 == (shifted_value & 1))) { 4033 while ((0 != shifted_value) && (0 == (shifted_value & 1))) {
4034 trailing_zeros++; 4034 trailing_zeros++;
4035 shifted_value >>= 1; 4035 shifted_value >>= 1;
4036 } 4036 }
4037 4037
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
4119 Or(dst, opnd); 4119 Or(dst, opnd);
4120 #endif 4120 #endif
4121 } 4121 }
4122 4122
4123 // OR 32-bit - dst = dst & imm 4123 // OR 32-bit - dst = dst & imm
4124 void MacroAssembler::Or(Register dst, const Operand& opnd) { oilf(dst, opnd); } 4124 void MacroAssembler::Or(Register dst, const Operand& opnd) { oilf(dst, opnd); }
4125 4125
4126 // OR Pointer Size - dst = dst & imm 4126 // OR Pointer Size - dst = dst & imm
4127 void MacroAssembler::OrP(Register dst, const Operand& opnd) { 4127 void MacroAssembler::OrP(Register dst, const Operand& opnd) {
4128 #if V8_TARGET_ARCH_S390X 4128 #if V8_TARGET_ARCH_S390X
4129 intptr_t value = opnd.imm_; 4129 intptr_t value = opnd.immediate();
4130 if (value >> 32 != 0) { 4130 if (value >> 32 != 0) {
4131 // this may not work b/c condition code won't be set correctly 4131 // this may not work b/c condition code won't be set correctly
4132 oihf(dst, Operand(value >> 32)); 4132 oihf(dst, Operand(value >> 32));
4133 } 4133 }
4134 oilf(dst, Operand(value & 0xFFFFFFFF)); 4134 oilf(dst, Operand(value & 0xFFFFFFFF));
4135 #else 4135 #else
4136 Or(dst, opnd); 4136 Or(dst, opnd);
4137 #endif 4137 #endif
4138 } 4138 }
4139 4139
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
4207 Xor(dst, opnd); 4207 Xor(dst, opnd);
4208 #endif 4208 #endif
4209 } 4209 }
4210 4210
4211 // XOR 32-bit - dst = dst & imm 4211 // XOR 32-bit - dst = dst & imm
4212 void MacroAssembler::Xor(Register dst, const Operand& opnd) { xilf(dst, opnd); } 4212 void MacroAssembler::Xor(Register dst, const Operand& opnd) { xilf(dst, opnd); }
4213 4213
4214 // XOR Pointer Size - dst = dst & imm 4214 // XOR Pointer Size - dst = dst & imm
4215 void MacroAssembler::XorP(Register dst, const Operand& opnd) { 4215 void MacroAssembler::XorP(Register dst, const Operand& opnd) {
4216 #if V8_TARGET_ARCH_S390X 4216 #if V8_TARGET_ARCH_S390X
4217 intptr_t value = opnd.imm_; 4217 intptr_t value = opnd.immediate();
4218 xihf(dst, Operand(value >> 32)); 4218 xihf(dst, Operand(value >> 32));
4219 xilf(dst, Operand(value & 0xFFFFFFFF)); 4219 xilf(dst, Operand(value & 0xFFFFFFFF));
4220 #else 4220 #else
4221 Xor(dst, opnd); 4221 Xor(dst, opnd);
4222 #endif 4222 #endif
4223 } 4223 }
4224 4224
4225 // XOR 32-bit - dst = src & imm 4225 // XOR 32-bit - dst = src & imm
4226 void MacroAssembler::Xor(Register dst, Register src, const Operand& opnd) { 4226 void MacroAssembler::Xor(Register dst, Register src, const Operand& opnd) {
4227 if (!dst.is(src)) lr(dst, src); 4227 if (!dst.is(src)) lr(dst, src);
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
4329 // This helper will set up proper relocation entries if required. 4329 // This helper will set up proper relocation entries if required.
4330 void MacroAssembler::Cmp32(Register dst, const Operand& opnd) { 4330 void MacroAssembler::Cmp32(Register dst, const Operand& opnd) {
4331 if (opnd.rmode_ == kRelocInfo_NONEPTR) { 4331 if (opnd.rmode_ == kRelocInfo_NONEPTR) {
4332 intptr_t value = opnd.immediate(); 4332 intptr_t value = opnd.immediate();
4333 if (is_int16(value)) 4333 if (is_int16(value))
4334 chi(dst, opnd); 4334 chi(dst, opnd);
4335 else 4335 else
4336 cfi(dst, opnd); 4336 cfi(dst, opnd);
4337 } else { 4337 } else {
4338 // Need to generate relocation record here 4338 // Need to generate relocation record here
4339 RecordRelocInfo(opnd.rmode_, opnd.imm_); 4339 RecordRelocInfo(opnd.rmode_, opnd.immediate());
4340 cfi(dst, opnd); 4340 cfi(dst, opnd);
4341 } 4341 }
4342 } 4342 }
4343 4343
4344 // Compare Pointer Sized Register vs Immediate 4344 // Compare Pointer Sized Register vs Immediate
4345 // This helper will set up proper relocation entries if required. 4345 // This helper will set up proper relocation entries if required.
4346 void MacroAssembler::CmpP(Register dst, const Operand& opnd) { 4346 void MacroAssembler::CmpP(Register dst, const Operand& opnd) {
4347 #if V8_TARGET_ARCH_S390X 4347 #if V8_TARGET_ARCH_S390X
4348 if (opnd.rmode_ == kRelocInfo_NONEPTR) { 4348 if (opnd.rmode_ == kRelocInfo_NONEPTR) {
4349 cgfi(dst, opnd); 4349 cgfi(dst, opnd);
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after
4627 } 4627 }
4628 4628
4629 // Store a "pointer" sized constant to the memory location 4629 // Store a "pointer" sized constant to the memory location
4630 void MacroAssembler::StoreP(const MemOperand& mem, const Operand& opnd, 4630 void MacroAssembler::StoreP(const MemOperand& mem, const Operand& opnd,
4631 Register scratch) { 4631 Register scratch) {
4632 // Relocations not supported 4632 // Relocations not supported
4633 DCHECK(opnd.rmode_ == kRelocInfo_NONEPTR); 4633 DCHECK(opnd.rmode_ == kRelocInfo_NONEPTR);
4634 4634
4635 // Try to use MVGHI/MVHI 4635 // Try to use MVGHI/MVHI
4636 if (CpuFeatures::IsSupported(GENERAL_INSTR_EXT) && is_uint12(mem.offset()) && 4636 if (CpuFeatures::IsSupported(GENERAL_INSTR_EXT) && is_uint12(mem.offset()) &&
4637 mem.getIndexRegister().is(r0) && is_int16(opnd.imm_)) { 4637 mem.getIndexRegister().is(r0) && is_int16(opnd.immediate())) {
4638 #if V8_TARGET_ARCH_S390X 4638 #if V8_TARGET_ARCH_S390X
4639 mvghi(mem, opnd); 4639 mvghi(mem, opnd);
4640 #else 4640 #else
4641 mvhi(mem, opnd); 4641 mvhi(mem, opnd);
4642 #endif 4642 #endif
4643 } else { 4643 } else {
4644 LoadImmP(scratch, opnd); 4644 LoadImmP(scratch, opnd);
4645 StoreP(scratch, mem); 4645 StoreP(scratch, mem);
4646 } 4646 }
4647 } 4647 }
(...skipping 589 matching lines...) Expand 10 before | Expand all | Expand 10 after
5237 } else { 5237 } else {
5238 DCHECK(!dst.is(val)); // The lr/sra path clobbers val. 5238 DCHECK(!dst.is(val)); // The lr/sra path clobbers val.
5239 lr(dst, src); 5239 lr(dst, src);
5240 sra(dst, val); 5240 sra(dst, val);
5241 } 5241 }
5242 } 5242 }
5243 5243
5244 // Clear right most # of bits 5244 // Clear right most # of bits
5245 void MacroAssembler::ClearRightImm(Register dst, Register src, 5245 void MacroAssembler::ClearRightImm(Register dst, Register src,
5246 const Operand& val) { 5246 const Operand& val) {
5247 int numBitsToClear = val.imm_ % (kPointerSize * 8); 5247 int numBitsToClear = val.immediate() % (kPointerSize * 8);
5248 5248
5249 // Try to use RISBG if possible 5249 // Try to use RISBG if possible
5250 if (CpuFeatures::IsSupported(GENERAL_INSTR_EXT)) { 5250 if (CpuFeatures::IsSupported(GENERAL_INSTR_EXT)) {
5251 int endBit = 63 - numBitsToClear; 5251 int endBit = 63 - numBitsToClear;
5252 risbg(dst, src, Operand::Zero(), Operand(endBit), Operand::Zero(), true); 5252 risbg(dst, src, Operand::Zero(), Operand(endBit), Operand::Zero(), true);
5253 return; 5253 return;
5254 } 5254 }
5255 5255
5256 uint64_t hexMask = ~((1L << numBitsToClear) - 1); 5256 uint64_t hexMask = ~((1L << numBitsToClear) - 1);
5257 5257
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
5377 } 5377 }
5378 if (mag.shift > 0) ShiftRightArith(result, result, Operand(mag.shift)); 5378 if (mag.shift > 0) ShiftRightArith(result, result, Operand(mag.shift));
5379 ExtractBit(r0, dividend, 31); 5379 ExtractBit(r0, dividend, 31);
5380 AddP(result, r0); 5380 AddP(result, r0);
5381 } 5381 }
5382 5382
5383 } // namespace internal 5383 } // namespace internal
5384 } // namespace v8 5384 } // namespace v8
5385 5385
5386 #endif // V8_TARGET_ARCH_S390 5386 #endif // V8_TARGET_ARCH_S390
OLDNEW
« no previous file with comments | « src/s390/codegen-s390.cc ('k') | test/cctest/test-assembler-ppc.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698