OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 <limits.h> // For LONG_MIN, LONG_MAX. | 5 #include <limits.h> // For LONG_MIN, LONG_MAX. |
6 | 6 |
7 #if V8_TARGET_ARCH_MIPS64 | 7 #if V8_TARGET_ARCH_MIPS64 |
8 | 8 |
9 #include "src/base/division-by-constant.h" | 9 #include "src/base/division-by-constant.h" |
10 #include "src/bootstrapper.h" | 10 #include "src/bootstrapper.h" |
11 #include "src/codegen.h" | 11 #include "src/codegen.h" |
12 #include "src/debug/debug.h" | 12 #include "src/debug/debug.h" |
13 #include "src/mips64/macro-assembler-mips64.h" | 13 #include "src/mips64/macro-assembler-mips64.h" |
14 #include "src/register-configuration.h" | |
15 #include "src/runtime/runtime.h" | 14 #include "src/runtime/runtime.h" |
16 | 15 |
17 namespace v8 { | 16 namespace v8 { |
18 namespace internal { | 17 namespace internal { |
19 | 18 |
20 MacroAssembler::MacroAssembler(Isolate* arg_isolate, void* buffer, int size) | 19 MacroAssembler::MacroAssembler(Isolate* arg_isolate, void* buffer, int size) |
21 : Assembler(arg_isolate, buffer, size), | 20 : Assembler(arg_isolate, buffer, size), |
22 generating_stub_(false), | 21 generating_stub_(false), |
23 has_frame_(false), | 22 has_frame_(false), |
24 has_double_zero_reg_set_(false) { | 23 has_double_zero_reg_set_(false) { |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
142 | 141 |
143 | 142 |
144 MemOperand MacroAssembler::SafepointRegisterSlot(Register reg) { | 143 MemOperand MacroAssembler::SafepointRegisterSlot(Register reg) { |
145 return MemOperand(sp, SafepointRegisterStackIndex(reg.code()) * kPointerSize); | 144 return MemOperand(sp, SafepointRegisterStackIndex(reg.code()) * kPointerSize); |
146 } | 145 } |
147 | 146 |
148 | 147 |
149 MemOperand MacroAssembler::SafepointRegistersAndDoublesSlot(Register reg) { | 148 MemOperand MacroAssembler::SafepointRegistersAndDoublesSlot(Register reg) { |
150 UNIMPLEMENTED_MIPS(); | 149 UNIMPLEMENTED_MIPS(); |
151 // General purpose registers are pushed last on the stack. | 150 // General purpose registers are pushed last on the stack. |
152 int doubles_size = DoubleRegister::kMaxNumRegisters * kDoubleSize; | 151 int doubles_size = FPURegister::NumAllocatableRegisters() * kDoubleSize; |
153 int register_offset = SafepointRegisterStackIndex(reg.code()) * kPointerSize; | 152 int register_offset = SafepointRegisterStackIndex(reg.code()) * kPointerSize; |
154 return MemOperand(sp, doubles_size + register_offset); | 153 return MemOperand(sp, doubles_size + register_offset); |
155 } | 154 } |
156 | 155 |
157 | 156 |
158 void MacroAssembler::InNewSpace(Register object, | 157 void MacroAssembler::InNewSpace(Register object, |
159 Register scratch, | 158 Register scratch, |
160 Condition cc, | 159 Condition cc, |
161 Label* branch) { | 160 Label* branch) { |
162 DCHECK(cc == eq || cc == ne); | 161 DCHECK(cc == eq || cc == ne); |
(...skipping 3592 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3755 RegList temps, | 3754 RegList temps, |
3756 int field_count) { | 3755 int field_count) { |
3757 DCHECK((temps & dst.bit()) == 0); | 3756 DCHECK((temps & dst.bit()) == 0); |
3758 DCHECK((temps & src.bit()) == 0); | 3757 DCHECK((temps & src.bit()) == 0); |
3759 // Primitive implementation using only one temporary register. | 3758 // Primitive implementation using only one temporary register. |
3760 | 3759 |
3761 Register tmp = no_reg; | 3760 Register tmp = no_reg; |
3762 // Find a temp register in temps list. | 3761 // Find a temp register in temps list. |
3763 for (int i = 0; i < kNumRegisters; i++) { | 3762 for (int i = 0; i < kNumRegisters; i++) { |
3764 if ((temps & (1 << i)) != 0) { | 3763 if ((temps & (1 << i)) != 0) { |
3765 tmp.reg_code = i; | 3764 tmp.code_ = i; |
3766 break; | 3765 break; |
3767 } | 3766 } |
3768 } | 3767 } |
3769 DCHECK(!tmp.is(no_reg)); | 3768 DCHECK(!tmp.is(no_reg)); |
3770 | 3769 |
3771 for (int i = 0; i < field_count; i++) { | 3770 for (int i = 0; i < field_count; i++) { |
3772 ld(tmp, FieldMemOperand(src, i * kPointerSize)); | 3771 ld(tmp, FieldMemOperand(src, i * kPointerSize)); |
3773 sd(tmp, FieldMemOperand(dst, i * kPointerSize)); | 3772 sd(tmp, FieldMemOperand(dst, i * kPointerSize)); |
3774 } | 3773 } |
3775 } | 3774 } |
(...skipping 2260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6036 Register reg5, | 6035 Register reg5, |
6037 Register reg6) { | 6036 Register reg6) { |
6038 RegList regs = 0; | 6037 RegList regs = 0; |
6039 if (reg1.is_valid()) regs |= reg1.bit(); | 6038 if (reg1.is_valid()) regs |= reg1.bit(); |
6040 if (reg2.is_valid()) regs |= reg2.bit(); | 6039 if (reg2.is_valid()) regs |= reg2.bit(); |
6041 if (reg3.is_valid()) regs |= reg3.bit(); | 6040 if (reg3.is_valid()) regs |= reg3.bit(); |
6042 if (reg4.is_valid()) regs |= reg4.bit(); | 6041 if (reg4.is_valid()) regs |= reg4.bit(); |
6043 if (reg5.is_valid()) regs |= reg5.bit(); | 6042 if (reg5.is_valid()) regs |= reg5.bit(); |
6044 if (reg6.is_valid()) regs |= reg6.bit(); | 6043 if (reg6.is_valid()) regs |= reg6.bit(); |
6045 | 6044 |
6046 const RegisterConfiguration* config = RegisterConfiguration::ArchDefault(); | 6045 for (int i = 0; i < Register::NumAllocatableRegisters(); i++) { |
6047 for (int i = 0; i < config->num_allocatable_general_registers(); ++i) { | 6046 Register candidate = Register::FromAllocationIndex(i); |
6048 int code = config->GetAllocatableGeneralCode(i); | |
6049 Register candidate = Register::from_code(code); | |
6050 if (regs & candidate.bit()) continue; | 6047 if (regs & candidate.bit()) continue; |
6051 return candidate; | 6048 return candidate; |
6052 } | 6049 } |
6053 UNREACHABLE(); | 6050 UNREACHABLE(); |
6054 return no_reg; | 6051 return no_reg; |
6055 } | 6052 } |
6056 | 6053 |
6057 | 6054 |
6058 void MacroAssembler::JumpIfDictionaryInPrototypeChain( | 6055 void MacroAssembler::JumpIfDictionaryInPrototypeChain( |
6059 Register object, | 6056 Register object, |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6192 if (mag.shift > 0) sra(result, result, mag.shift); | 6189 if (mag.shift > 0) sra(result, result, mag.shift); |
6193 srl(at, dividend, 31); | 6190 srl(at, dividend, 31); |
6194 Addu(result, result, Operand(at)); | 6191 Addu(result, result, Operand(at)); |
6195 } | 6192 } |
6196 | 6193 |
6197 | 6194 |
6198 } // namespace internal | 6195 } // namespace internal |
6199 } // namespace v8 | 6196 } // namespace v8 |
6200 | 6197 |
6201 #endif // V8_TARGET_ARCH_MIPS64 | 6198 #endif // V8_TARGET_ARCH_MIPS64 |
OLD | NEW |