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 #if V8_TARGET_ARCH_MIPS | 5 #if V8_TARGET_ARCH_MIPS |
6 | 6 |
7 // Note on Mips implementation: | 7 // Note on Mips implementation: |
8 // | 8 // |
9 // The result_register() for mips is the 'v0' register, which is defined | 9 // The result_register() for mips is the 'v0' register, which is defined |
10 // by the ABI to contain function return values. However, the first | 10 // by the ABI to contain function return values. However, the first |
(...skipping 4129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4140 } | 4140 } |
4141 | 4141 |
4142 #undef __ | 4142 #undef __ |
4143 | 4143 |
4144 | 4144 |
4145 void BackEdgeTable::PatchAt(Code* unoptimized_code, | 4145 void BackEdgeTable::PatchAt(Code* unoptimized_code, |
4146 Address pc, | 4146 Address pc, |
4147 BackEdgeState target_state, | 4147 BackEdgeState target_state, |
4148 Code* replacement_code) { | 4148 Code* replacement_code) { |
4149 static const int kInstrSize = Assembler::kInstrSize; | 4149 static const int kInstrSize = Assembler::kInstrSize; |
4150 Address branch_address = pc - 6 * kInstrSize; | 4150 Address branch_address; |
4151 if (IsMipsArchVariant(kMips32r6)) { | |
4152 branch_address = pc - 5 * kInstrSize; | |
ivica.bogosavljevic
2016/03/21 15:30:48
Instead of 5 and 6, is it possible to have here na
balazs.kilvady
2016/03/24 12:12:47
Could kCallTargetAddressOffset and other constants
miran.karic
2016/03/24 15:34:01
Done.
miran.karic
2016/03/24 15:34:01
Done.
| |
4153 } else { | |
4154 branch_address = pc - 6 * kInstrSize; | |
4155 } | |
4151 Isolate* isolate = unoptimized_code->GetIsolate(); | 4156 Isolate* isolate = unoptimized_code->GetIsolate(); |
4152 CodePatcher patcher(isolate, branch_address, 1); | 4157 CodePatcher patcher(isolate, branch_address, 1); |
4153 | 4158 |
4154 switch (target_state) { | 4159 switch (target_state) { |
4155 case INTERRUPT: | 4160 case INTERRUPT: |
4156 // slt at, a3, zero_reg (in case of count based interrupts) | 4161 // slt at, a3, zero_reg (in case of count based interrupts) |
4157 // beq at, zero_reg, ok | 4162 // beq at, zero_reg, ok |
4158 // lui t9, <interrupt stub address> upper | 4163 // lui t9, <interrupt stub address> upper |
4159 // ori t9, <interrupt stub address> lower | 4164 // ori t9, <interrupt stub address> lower |
4160 // jalr t9 | 4165 // jalr t9 |
4161 // nop | 4166 // nop |
4162 // ok-label ----- pc_after points here | 4167 // ok-label ----- pc_after points here |
4163 patcher.masm()->slt(at, a3, zero_reg); | 4168 patcher.masm()->slt(at, a3, zero_reg); |
4164 break; | 4169 break; |
4165 case ON_STACK_REPLACEMENT: | 4170 case ON_STACK_REPLACEMENT: |
4166 case OSR_AFTER_STACK_CHECK: | 4171 case OSR_AFTER_STACK_CHECK: |
4167 // addiu at, zero_reg, 1 | 4172 // addiu at, zero_reg, 1 |
4168 // beq at, zero_reg, ok ;; Not changed | 4173 // beq at, zero_reg, ok ;; Not changed |
4169 // lui t9, <on-stack replacement address> upper | 4174 // lui t9, <on-stack replacement address> upper |
4170 // ori t9, <on-stack replacement address> lower | 4175 // ori t9, <on-stack replacement address> lower |
4171 // jalr t9 ;; Not changed | 4176 // jalr t9 ;; Not changed |
4172 // nop ;; Not changed | 4177 // nop ;; Not changed |
4173 // ok-label ----- pc_after points here | 4178 // ok-label ----- pc_after points here |
4174 patcher.masm()->addiu(at, zero_reg, 1); | 4179 patcher.masm()->addiu(at, zero_reg, 1); |
4175 break; | 4180 break; |
4176 } | 4181 } |
4177 Address pc_immediate_load_address = pc - 4 * kInstrSize; | 4182 Address pc_immediate_load_address; |
4183 if (IsMipsArchVariant(kMips32r6)) { | |
4184 pc_immediate_load_address = pc - 3 * kInstrSize; | |
ivica.bogosavljevic
2016/03/21 15:30:48
Same as above
miran.karic
2016/03/24 15:34:01
Done.
| |
4185 } else { | |
4186 pc_immediate_load_address = pc - 4 * kInstrSize; | |
4187 } | |
4178 // Replace the stack check address in the load-immediate (lui/ori pair) | 4188 // Replace the stack check address in the load-immediate (lui/ori pair) |
4179 // with the entry address of the replacement code. | 4189 // with the entry address of the replacement code. |
4180 Assembler::set_target_address_at(isolate, pc_immediate_load_address, | 4190 Assembler::set_target_address_at(isolate, pc_immediate_load_address, |
4181 replacement_code->entry()); | 4191 replacement_code->entry()); |
4182 | 4192 |
4183 unoptimized_code->GetHeap()->incremental_marking()->RecordCodeTargetPatch( | 4193 unoptimized_code->GetHeap()->incremental_marking()->RecordCodeTargetPatch( |
4184 unoptimized_code, pc_immediate_load_address, replacement_code); | 4194 unoptimized_code, pc_immediate_load_address, replacement_code); |
4185 } | 4195 } |
4186 | 4196 |
4187 | 4197 |
4188 BackEdgeTable::BackEdgeState BackEdgeTable::GetBackEdgeState( | 4198 BackEdgeTable::BackEdgeState BackEdgeTable::GetBackEdgeState( |
4189 Isolate* isolate, | 4199 Isolate* isolate, |
4190 Code* unoptimized_code, | 4200 Code* unoptimized_code, |
4191 Address pc) { | 4201 Address pc) { |
4192 static const int kInstrSize = Assembler::kInstrSize; | 4202 static const int kInstrSize = Assembler::kInstrSize; |
4193 Address branch_address = pc - 6 * kInstrSize; | 4203 Address branch_address; |
4194 Address pc_immediate_load_address = pc - 4 * kInstrSize; | 4204 Address pc_immediate_load_address; |
4205 if (IsMipsArchVariant(kMips32r6)) { | |
4206 branch_address = pc - 5 * kInstrSize; | |
4207 pc_immediate_load_address = pc - 3 * kInstrSize; | |
4208 DCHECK(Assembler::IsBeq(Assembler::instr_at(pc - 4 * kInstrSize))); | |
4209 } else { | |
4210 branch_address = pc - 6 * kInstrSize; | |
4211 pc_immediate_load_address = pc - 4 * kInstrSize; | |
4212 DCHECK(Assembler::IsBeq(Assembler::instr_at(pc - 5 * kInstrSize))); | |
4213 } | |
4195 | 4214 |
4196 DCHECK(Assembler::IsBeq(Assembler::instr_at(pc - 5 * kInstrSize))); | |
4197 if (!Assembler::IsAddImmediate(Assembler::instr_at(branch_address))) { | 4215 if (!Assembler::IsAddImmediate(Assembler::instr_at(branch_address))) { |
4198 DCHECK(reinterpret_cast<uint32_t>( | 4216 DCHECK(reinterpret_cast<uint32_t>( |
4199 Assembler::target_address_at(pc_immediate_load_address)) == | 4217 Assembler::target_address_at(pc_immediate_load_address)) == |
4200 reinterpret_cast<uint32_t>( | 4218 reinterpret_cast<uint32_t>( |
4201 isolate->builtins()->InterruptCheck()->entry())); | 4219 isolate->builtins()->InterruptCheck()->entry())); |
4202 return INTERRUPT; | 4220 return INTERRUPT; |
4203 } | 4221 } |
4204 | 4222 |
4205 DCHECK(Assembler::IsAddImmediate(Assembler::instr_at(branch_address))); | 4223 DCHECK(Assembler::IsAddImmediate(Assembler::instr_at(branch_address))); |
4206 | 4224 |
4207 if (reinterpret_cast<uint32_t>( | 4225 if (reinterpret_cast<uint32_t>( |
4208 Assembler::target_address_at(pc_immediate_load_address)) == | 4226 Assembler::target_address_at(pc_immediate_load_address)) == |
4209 reinterpret_cast<uint32_t>( | 4227 reinterpret_cast<uint32_t>( |
4210 isolate->builtins()->OnStackReplacement()->entry())) { | 4228 isolate->builtins()->OnStackReplacement()->entry())) { |
4211 return ON_STACK_REPLACEMENT; | 4229 return ON_STACK_REPLACEMENT; |
4212 } | 4230 } |
4213 | 4231 |
4214 DCHECK(reinterpret_cast<uint32_t>( | 4232 DCHECK(reinterpret_cast<uint32_t>( |
4215 Assembler::target_address_at(pc_immediate_load_address)) == | 4233 Assembler::target_address_at(pc_immediate_load_address)) == |
4216 reinterpret_cast<uint32_t>( | 4234 reinterpret_cast<uint32_t>( |
4217 isolate->builtins()->OsrAfterStackCheck()->entry())); | 4235 isolate->builtins()->OsrAfterStackCheck()->entry())); |
4218 return OSR_AFTER_STACK_CHECK; | 4236 return OSR_AFTER_STACK_CHECK; |
4219 } | 4237 } |
4220 | 4238 |
4221 | 4239 |
4222 } // namespace internal | 4240 } // namespace internal |
4223 } // namespace v8 | 4241 } // namespace v8 |
4224 | 4242 |
4225 #endif // V8_TARGET_ARCH_MIPS | 4243 #endif // V8_TARGET_ARCH_MIPS |
OLD | NEW |