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/cpu-profiler.h" | 12 #include "src/cpu-profiler.h" |
13 #include "src/debug/debug.h" | 13 #include "src/debug/debug.h" |
14 #include "src/mips64/macro-assembler-mips64.h" | 14 #include "src/mips64/macro-assembler-mips64.h" |
15 #include "src/register-configuration.h" | |
16 #include "src/runtime/runtime.h" | 15 #include "src/runtime/runtime.h" |
17 | 16 |
18 namespace v8 { | 17 namespace v8 { |
19 namespace internal { | 18 namespace internal { |
20 | 19 |
21 MacroAssembler::MacroAssembler(Isolate* arg_isolate, void* buffer, int size) | 20 MacroAssembler::MacroAssembler(Isolate* arg_isolate, void* buffer, int size) |
22 : Assembler(arg_isolate, buffer, size), | 21 : Assembler(arg_isolate, buffer, size), |
23 generating_stub_(false), | 22 generating_stub_(false), |
24 has_frame_(false), | 23 has_frame_(false), |
25 has_double_zero_reg_set_(false) { | 24 has_double_zero_reg_set_(false) { |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
143 | 142 |
144 | 143 |
145 MemOperand MacroAssembler::SafepointRegisterSlot(Register reg) { | 144 MemOperand MacroAssembler::SafepointRegisterSlot(Register reg) { |
146 return MemOperand(sp, SafepointRegisterStackIndex(reg.code()) * kPointerSize); | 145 return MemOperand(sp, SafepointRegisterStackIndex(reg.code()) * kPointerSize); |
147 } | 146 } |
148 | 147 |
149 | 148 |
150 MemOperand MacroAssembler::SafepointRegistersAndDoublesSlot(Register reg) { | 149 MemOperand MacroAssembler::SafepointRegistersAndDoublesSlot(Register reg) { |
151 UNIMPLEMENTED_MIPS(); | 150 UNIMPLEMENTED_MIPS(); |
152 // General purpose registers are pushed last on the stack. | 151 // General purpose registers are pushed last on the stack. |
153 int doubles_size = DoubleRegister::kMaxNumRegisters * kDoubleSize; | 152 int doubles_size = FPURegister::NumAllocatableRegisters() * kDoubleSize; |
154 int register_offset = SafepointRegisterStackIndex(reg.code()) * kPointerSize; | 153 int register_offset = SafepointRegisterStackIndex(reg.code()) * kPointerSize; |
155 return MemOperand(sp, doubles_size + register_offset); | 154 return MemOperand(sp, doubles_size + register_offset); |
156 } | 155 } |
157 | 156 |
158 | 157 |
159 void MacroAssembler::InNewSpace(Register object, | 158 void MacroAssembler::InNewSpace(Register object, |
160 Register scratch, | 159 Register scratch, |
161 Condition cc, | 160 Condition cc, |
162 Label* branch) { | 161 Label* branch) { |
163 DCHECK(cc == eq || cc == ne); | 162 DCHECK(cc == eq || cc == ne); |
(...skipping 3561 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3725 RegList temps, | 3724 RegList temps, |
3726 int field_count) { | 3725 int field_count) { |
3727 DCHECK((temps & dst.bit()) == 0); | 3726 DCHECK((temps & dst.bit()) == 0); |
3728 DCHECK((temps & src.bit()) == 0); | 3727 DCHECK((temps & src.bit()) == 0); |
3729 // Primitive implementation using only one temporary register. | 3728 // Primitive implementation using only one temporary register. |
3730 | 3729 |
3731 Register tmp = no_reg; | 3730 Register tmp = no_reg; |
3732 // Find a temp register in temps list. | 3731 // Find a temp register in temps list. |
3733 for (int i = 0; i < kNumRegisters; i++) { | 3732 for (int i = 0; i < kNumRegisters; i++) { |
3734 if ((temps & (1 << i)) != 0) { | 3733 if ((temps & (1 << i)) != 0) { |
3735 tmp.reg_code = i; | 3734 tmp.code_ = i; |
3736 break; | 3735 break; |
3737 } | 3736 } |
3738 } | 3737 } |
3739 DCHECK(!tmp.is(no_reg)); | 3738 DCHECK(!tmp.is(no_reg)); |
3740 | 3739 |
3741 for (int i = 0; i < field_count; i++) { | 3740 for (int i = 0; i < field_count; i++) { |
3742 ld(tmp, FieldMemOperand(src, i * kPointerSize)); | 3741 ld(tmp, FieldMemOperand(src, i * kPointerSize)); |
3743 sd(tmp, FieldMemOperand(dst, i * kPointerSize)); | 3742 sd(tmp, FieldMemOperand(dst, i * kPointerSize)); |
3744 } | 3743 } |
3745 } | 3744 } |
(...skipping 2212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5958 Register reg5, | 5957 Register reg5, |
5959 Register reg6) { | 5958 Register reg6) { |
5960 RegList regs = 0; | 5959 RegList regs = 0; |
5961 if (reg1.is_valid()) regs |= reg1.bit(); | 5960 if (reg1.is_valid()) regs |= reg1.bit(); |
5962 if (reg2.is_valid()) regs |= reg2.bit(); | 5961 if (reg2.is_valid()) regs |= reg2.bit(); |
5963 if (reg3.is_valid()) regs |= reg3.bit(); | 5962 if (reg3.is_valid()) regs |= reg3.bit(); |
5964 if (reg4.is_valid()) regs |= reg4.bit(); | 5963 if (reg4.is_valid()) regs |= reg4.bit(); |
5965 if (reg5.is_valid()) regs |= reg5.bit(); | 5964 if (reg5.is_valid()) regs |= reg5.bit(); |
5966 if (reg6.is_valid()) regs |= reg6.bit(); | 5965 if (reg6.is_valid()) regs |= reg6.bit(); |
5967 | 5966 |
5968 const RegisterConfiguration* config = RegisterConfiguration::ArchDefault(); | 5967 for (int i = 0; i < Register::NumAllocatableRegisters(); i++) { |
5969 for (int i = 0; i < config->num_allocatable_general_registers(); ++i) { | 5968 Register candidate = Register::FromAllocationIndex(i); |
5970 int code = config->GetAllocatableGeneralCode(i); | |
5971 Register candidate = Register::from_code(code); | |
5972 if (regs & candidate.bit()) continue; | 5969 if (regs & candidate.bit()) continue; |
5973 return candidate; | 5970 return candidate; |
5974 } | 5971 } |
5975 UNREACHABLE(); | 5972 UNREACHABLE(); |
5976 return no_reg; | 5973 return no_reg; |
5977 } | 5974 } |
5978 | 5975 |
5979 | 5976 |
5980 void MacroAssembler::JumpIfDictionaryInPrototypeChain( | 5977 void MacroAssembler::JumpIfDictionaryInPrototypeChain( |
5981 Register object, | 5978 Register object, |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6114 if (mag.shift > 0) sra(result, result, mag.shift); | 6111 if (mag.shift > 0) sra(result, result, mag.shift); |
6115 srl(at, dividend, 31); | 6112 srl(at, dividend, 31); |
6116 Addu(result, result, Operand(at)); | 6113 Addu(result, result, Operand(at)); |
6117 } | 6114 } |
6118 | 6115 |
6119 | 6116 |
6120 } // namespace internal | 6117 } // namespace internal |
6121 } // namespace v8 | 6118 } // namespace v8 |
6122 | 6119 |
6123 #endif // V8_TARGET_ARCH_MIPS64 | 6120 #endif // V8_TARGET_ARCH_MIPS64 |
OLD | NEW |