OLD | NEW |
1 | 1 |
2 // Copyright 2012 the V8 project authors. All rights reserved. | 2 // Copyright 2012 the V8 project authors. All rights reserved. |
3 // Use of this source code is governed by a BSD-style license that can be | 3 // Use of this source code is governed by a BSD-style license that can be |
4 // found in the LICENSE file. | 4 // found in the LICENSE file. |
5 | 5 |
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_MIPS | 8 #if V8_TARGET_ARCH_MIPS |
9 | 9 |
10 #include "src/base/bits.h" | 10 #include "src/base/bits.h" |
11 #include "src/base/division-by-constant.h" | 11 #include "src/base/division-by-constant.h" |
12 #include "src/bootstrapper.h" | 12 #include "src/bootstrapper.h" |
13 #include "src/codegen.h" | 13 #include "src/codegen.h" |
14 #include "src/cpu-profiler.h" | 14 #include "src/cpu-profiler.h" |
15 #include "src/debug/debug.h" | 15 #include "src/debug/debug.h" |
16 #include "src/mips/macro-assembler-mips.h" | 16 #include "src/mips/macro-assembler-mips.h" |
17 #include "src/register-configuration.h" | |
18 #include "src/runtime/runtime.h" | 17 #include "src/runtime/runtime.h" |
19 | 18 |
20 namespace v8 { | 19 namespace v8 { |
21 namespace internal { | 20 namespace internal { |
22 | 21 |
23 MacroAssembler::MacroAssembler(Isolate* arg_isolate, void* buffer, int size) | 22 MacroAssembler::MacroAssembler(Isolate* arg_isolate, void* buffer, int size) |
24 : Assembler(arg_isolate, buffer, size), | 23 : Assembler(arg_isolate, buffer, size), |
25 generating_stub_(false), | 24 generating_stub_(false), |
26 has_frame_(false), | 25 has_frame_(false), |
27 has_double_zero_reg_set_(false) { | 26 has_double_zero_reg_set_(false) { |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
141 | 140 |
142 | 141 |
143 MemOperand MacroAssembler::SafepointRegisterSlot(Register reg) { | 142 MemOperand MacroAssembler::SafepointRegisterSlot(Register reg) { |
144 return MemOperand(sp, SafepointRegisterStackIndex(reg.code()) * kPointerSize); | 143 return MemOperand(sp, SafepointRegisterStackIndex(reg.code()) * kPointerSize); |
145 } | 144 } |
146 | 145 |
147 | 146 |
148 MemOperand MacroAssembler::SafepointRegistersAndDoublesSlot(Register reg) { | 147 MemOperand MacroAssembler::SafepointRegistersAndDoublesSlot(Register reg) { |
149 UNIMPLEMENTED_MIPS(); | 148 UNIMPLEMENTED_MIPS(); |
150 // General purpose registers are pushed last on the stack. | 149 // General purpose registers are pushed last on the stack. |
151 int doubles_size = DoubleRegister::kMaxNumRegisters * kDoubleSize; | 150 int doubles_size = FPURegister::NumAllocatableRegisters() * kDoubleSize; |
152 int register_offset = SafepointRegisterStackIndex(reg.code()) * kPointerSize; | 151 int register_offset = SafepointRegisterStackIndex(reg.code()) * kPointerSize; |
153 return MemOperand(sp, doubles_size + register_offset); | 152 return MemOperand(sp, doubles_size + register_offset); |
154 } | 153 } |
155 | 154 |
156 | 155 |
157 void MacroAssembler::InNewSpace(Register object, | 156 void MacroAssembler::InNewSpace(Register object, |
158 Register scratch, | 157 Register scratch, |
159 Condition cc, | 158 Condition cc, |
160 Label* branch) { | 159 Label* branch) { |
161 DCHECK(cc == eq || cc == ne); | 160 DCHECK(cc == eq || cc == ne); |
(...skipping 3514 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3676 RegList temps, | 3675 RegList temps, |
3677 int field_count) { | 3676 int field_count) { |
3678 DCHECK((temps & dst.bit()) == 0); | 3677 DCHECK((temps & dst.bit()) == 0); |
3679 DCHECK((temps & src.bit()) == 0); | 3678 DCHECK((temps & src.bit()) == 0); |
3680 // Primitive implementation using only one temporary register. | 3679 // Primitive implementation using only one temporary register. |
3681 | 3680 |
3682 Register tmp = no_reg; | 3681 Register tmp = no_reg; |
3683 // Find a temp register in temps list. | 3682 // Find a temp register in temps list. |
3684 for (int i = 0; i < kNumRegisters; i++) { | 3683 for (int i = 0; i < kNumRegisters; i++) { |
3685 if ((temps & (1 << i)) != 0) { | 3684 if ((temps & (1 << i)) != 0) { |
3686 tmp.reg_code = i; | 3685 tmp.code_ = i; |
3687 break; | 3686 break; |
3688 } | 3687 } |
3689 } | 3688 } |
3690 DCHECK(!tmp.is(no_reg)); | 3689 DCHECK(!tmp.is(no_reg)); |
3691 | 3690 |
3692 for (int i = 0; i < field_count; i++) { | 3691 for (int i = 0; i < field_count; i++) { |
3693 lw(tmp, FieldMemOperand(src, i * kPointerSize)); | 3692 lw(tmp, FieldMemOperand(src, i * kPointerSize)); |
3694 sw(tmp, FieldMemOperand(dst, i * kPointerSize)); | 3693 sw(tmp, FieldMemOperand(dst, i * kPointerSize)); |
3695 } | 3694 } |
3696 } | 3695 } |
(...skipping 2068 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5765 Register reg5, | 5764 Register reg5, |
5766 Register reg6) { | 5765 Register reg6) { |
5767 RegList regs = 0; | 5766 RegList regs = 0; |
5768 if (reg1.is_valid()) regs |= reg1.bit(); | 5767 if (reg1.is_valid()) regs |= reg1.bit(); |
5769 if (reg2.is_valid()) regs |= reg2.bit(); | 5768 if (reg2.is_valid()) regs |= reg2.bit(); |
5770 if (reg3.is_valid()) regs |= reg3.bit(); | 5769 if (reg3.is_valid()) regs |= reg3.bit(); |
5771 if (reg4.is_valid()) regs |= reg4.bit(); | 5770 if (reg4.is_valid()) regs |= reg4.bit(); |
5772 if (reg5.is_valid()) regs |= reg5.bit(); | 5771 if (reg5.is_valid()) regs |= reg5.bit(); |
5773 if (reg6.is_valid()) regs |= reg6.bit(); | 5772 if (reg6.is_valid()) regs |= reg6.bit(); |
5774 | 5773 |
5775 const RegisterConfiguration* config = RegisterConfiguration::ArchDefault(); | 5774 for (int i = 0; i < Register::NumAllocatableRegisters(); i++) { |
5776 for (int i = 0; i < config->num_allocatable_general_registers(); ++i) { | 5775 Register candidate = Register::FromAllocationIndex(i); |
5777 int code = config->GetAllocatableGeneralCode(i); | |
5778 Register candidate = Register::from_code(code); | |
5779 if (regs & candidate.bit()) continue; | 5776 if (regs & candidate.bit()) continue; |
5780 return candidate; | 5777 return candidate; |
5781 } | 5778 } |
5782 UNREACHABLE(); | 5779 UNREACHABLE(); |
5783 return no_reg; | 5780 return no_reg; |
5784 } | 5781 } |
5785 | 5782 |
5786 | 5783 |
5787 void MacroAssembler::JumpIfDictionaryInPrototypeChain( | 5784 void MacroAssembler::JumpIfDictionaryInPrototypeChain( |
5788 Register object, | 5785 Register object, |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5922 if (mag.shift > 0) sra(result, result, mag.shift); | 5919 if (mag.shift > 0) sra(result, result, mag.shift); |
5923 srl(at, dividend, 31); | 5920 srl(at, dividend, 31); |
5924 Addu(result, result, Operand(at)); | 5921 Addu(result, result, Operand(at)); |
5925 } | 5922 } |
5926 | 5923 |
5927 | 5924 |
5928 } // namespace internal | 5925 } // namespace internal |
5929 } // namespace v8 | 5926 } // namespace v8 |
5930 | 5927 |
5931 #endif // V8_TARGET_ARCH_MIPS | 5928 #endif // V8_TARGET_ARCH_MIPS |
OLD | NEW |