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" |
(...skipping 4021 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4032 } | 4032 } |
4033 | 4033 |
4034 | 4034 |
4035 void MacroAssembler::StoreNumberToDoubleElements(Register value_reg, | 4035 void MacroAssembler::StoreNumberToDoubleElements(Register value_reg, |
4036 Register key_reg, | 4036 Register key_reg, |
4037 Register elements_reg, | 4037 Register elements_reg, |
4038 Register scratch1, | 4038 Register scratch1, |
4039 Register scratch2, | 4039 Register scratch2, |
4040 Label* fail, | 4040 Label* fail, |
4041 int elements_offset) { | 4041 int elements_offset) { |
| 4042 DCHECK(!AreAliased(value_reg, key_reg, elements_reg, scratch1, scratch2)); |
4042 Label smi_value, done; | 4043 Label smi_value, done; |
4043 | 4044 |
4044 // Handle smi values specially. | 4045 // Handle smi values specially. |
4045 JumpIfSmi(value_reg, &smi_value); | 4046 JumpIfSmi(value_reg, &smi_value); |
4046 | 4047 |
4047 // Ensure that the object is a heap number. | 4048 // Ensure that the object is a heap number. |
4048 CheckMap(value_reg, | 4049 CheckMap(value_reg, |
4049 scratch1, | 4050 scratch1, |
4050 Heap::kHeapNumberMapRootIndex, | 4051 Heap::kHeapNumberMapRootIndex, |
4051 fail, | 4052 fail, |
4052 DONT_DO_SMI_CHECK); | 4053 DONT_DO_SMI_CHECK); |
4053 | 4054 |
4054 // Double value, turn potential sNaN into qNan. | 4055 // Double value, turn potential sNaN into qNan. |
4055 DoubleRegister double_result = f0; | 4056 DoubleRegister double_result = f0; |
4056 DoubleRegister double_scratch = f2; | 4057 DoubleRegister double_scratch = f2; |
4057 | 4058 |
4058 ldc1(double_result, FieldMemOperand(value_reg, HeapNumber::kValueOffset)); | 4059 ldc1(double_result, FieldMemOperand(value_reg, HeapNumber::kValueOffset)); |
4059 Branch(USE_DELAY_SLOT, &done); // Canonicalization is one instruction. | 4060 Branch(USE_DELAY_SLOT, &done); // Canonicalization is one instruction. |
4060 FPUCanonicalizeNaN(double_result, double_result); | 4061 FPUCanonicalizeNaN(double_result, double_result); |
4061 | 4062 |
4062 bind(&smi_value); | 4063 bind(&smi_value); |
4063 // scratch1 is now effective address of the double element. | |
4064 // Untag and transfer. | 4064 // Untag and transfer. |
4065 dsrl32(at, value_reg, 0); | 4065 dsrl32(scratch1, value_reg, 0); |
4066 mtc1(at, double_scratch); | 4066 mtc1(scratch1, double_scratch); |
4067 cvt_d_w(double_result, double_scratch); | 4067 cvt_d_w(double_result, double_scratch); |
4068 | 4068 |
4069 bind(&done); | 4069 bind(&done); |
4070 Daddu(scratch1, elements_reg, | 4070 Daddu(scratch1, elements_reg, |
4071 Operand(FixedDoubleArray::kHeaderSize - kHeapObjectTag - | 4071 Operand(FixedDoubleArray::kHeaderSize - kHeapObjectTag - |
4072 elements_offset)); | 4072 elements_offset)); |
4073 dsra(scratch2, key_reg, 32 - kDoubleSizeLog2); | 4073 dsra(scratch2, key_reg, 32 - kDoubleSizeLog2); |
4074 Daddu(scratch1, scratch1, scratch2); | 4074 Daddu(scratch1, scratch1, scratch2); |
| 4075 // scratch1 is now effective address of the double element. |
4075 sdc1(double_result, MemOperand(scratch1, 0)); | 4076 sdc1(double_result, MemOperand(scratch1, 0)); |
4076 } | 4077 } |
4077 | 4078 |
4078 | 4079 |
4079 void MacroAssembler::CompareMapAndBranch(Register obj, | 4080 void MacroAssembler::CompareMapAndBranch(Register obj, |
4080 Register scratch, | 4081 Register scratch, |
4081 Handle<Map> map, | 4082 Handle<Map> map, |
4082 Label* early_success, | 4083 Label* early_success, |
4083 Condition cond, | 4084 Condition cond, |
4084 Label* branch_to) { | 4085 Label* branch_to) { |
(...skipping 2126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6211 lb(scratch1, FieldMemOperand(current, Map::kBitField2Offset)); | 6212 lb(scratch1, FieldMemOperand(current, Map::kBitField2Offset)); |
6212 DecodeField<Map::ElementsKindBits>(scratch1); | 6213 DecodeField<Map::ElementsKindBits>(scratch1); |
6213 Branch(found, eq, scratch1, Operand(DICTIONARY_ELEMENTS)); | 6214 Branch(found, eq, scratch1, Operand(DICTIONARY_ELEMENTS)); |
6214 ld(current, FieldMemOperand(current, Map::kPrototypeOffset)); | 6215 ld(current, FieldMemOperand(current, Map::kPrototypeOffset)); |
6215 Branch(&loop_again, ne, current, Operand(factory->null_value())); | 6216 Branch(&loop_again, ne, current, Operand(factory->null_value())); |
6216 | 6217 |
6217 bind(&end); | 6218 bind(&end); |
6218 } | 6219 } |
6219 | 6220 |
6220 | 6221 |
6221 bool AreAliased(Register reg1, | 6222 bool AreAliased(Register reg1, Register reg2, Register reg3, Register reg4, |
6222 Register reg2, | 6223 Register reg5, Register reg6, Register reg7, Register reg8, |
6223 Register reg3, | 6224 Register reg9, Register reg10) { |
6224 Register reg4, | 6225 int n_of_valid_regs = reg1.is_valid() + reg2.is_valid() + reg3.is_valid() + |
6225 Register reg5, | 6226 reg4.is_valid() + reg5.is_valid() + reg6.is_valid() + |
6226 Register reg6, | 6227 reg7.is_valid() + reg8.is_valid() + reg9.is_valid() + |
6227 Register reg7, | 6228 reg10.is_valid(); |
6228 Register reg8) { | |
6229 int n_of_valid_regs = reg1.is_valid() + reg2.is_valid() + | |
6230 reg3.is_valid() + reg4.is_valid() + reg5.is_valid() + reg6.is_valid() + | |
6231 reg7.is_valid() + reg8.is_valid(); | |
6232 | 6229 |
6233 RegList regs = 0; | 6230 RegList regs = 0; |
6234 if (reg1.is_valid()) regs |= reg1.bit(); | 6231 if (reg1.is_valid()) regs |= reg1.bit(); |
6235 if (reg2.is_valid()) regs |= reg2.bit(); | 6232 if (reg2.is_valid()) regs |= reg2.bit(); |
6236 if (reg3.is_valid()) regs |= reg3.bit(); | 6233 if (reg3.is_valid()) regs |= reg3.bit(); |
6237 if (reg4.is_valid()) regs |= reg4.bit(); | 6234 if (reg4.is_valid()) regs |= reg4.bit(); |
6238 if (reg5.is_valid()) regs |= reg5.bit(); | 6235 if (reg5.is_valid()) regs |= reg5.bit(); |
6239 if (reg6.is_valid()) regs |= reg6.bit(); | 6236 if (reg6.is_valid()) regs |= reg6.bit(); |
6240 if (reg7.is_valid()) regs |= reg7.bit(); | 6237 if (reg7.is_valid()) regs |= reg7.bit(); |
6241 if (reg8.is_valid()) regs |= reg8.bit(); | 6238 if (reg8.is_valid()) regs |= reg8.bit(); |
| 6239 if (reg9.is_valid()) regs |= reg9.bit(); |
| 6240 if (reg10.is_valid()) regs |= reg10.bit(); |
6242 int n_of_non_aliasing_regs = NumRegs(regs); | 6241 int n_of_non_aliasing_regs = NumRegs(regs); |
6243 | 6242 |
6244 return n_of_valid_regs != n_of_non_aliasing_regs; | 6243 return n_of_valid_regs != n_of_non_aliasing_regs; |
6245 } | 6244 } |
6246 | 6245 |
6247 | 6246 |
6248 CodePatcher::CodePatcher(Isolate* isolate, byte* address, int instructions, | 6247 CodePatcher::CodePatcher(Isolate* isolate, byte* address, int instructions, |
6249 FlushICache flush_cache) | 6248 FlushICache flush_cache) |
6250 : address_(address), | 6249 : address_(address), |
6251 size_(instructions * Assembler::kInstrSize), | 6250 size_(instructions * Assembler::kInstrSize), |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6321 if (mag.shift > 0) sra(result, result, mag.shift); | 6320 if (mag.shift > 0) sra(result, result, mag.shift); |
6322 srl(at, dividend, 31); | 6321 srl(at, dividend, 31); |
6323 Addu(result, result, Operand(at)); | 6322 Addu(result, result, Operand(at)); |
6324 } | 6323 } |
6325 | 6324 |
6326 | 6325 |
6327 } // namespace internal | 6326 } // namespace internal |
6328 } // namespace v8 | 6327 } // namespace v8 |
6329 | 6328 |
6330 #endif // V8_TARGET_ARCH_MIPS64 | 6329 #endif // V8_TARGET_ARCH_MIPS64 |
OLD | NEW |