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 4107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4118 // slt at, a3, zero_reg (in case of count based interrupts) | 4118 // slt at, a3, zero_reg (in case of count based interrupts) |
4119 // beq at, zero_reg, ok | 4119 // beq at, zero_reg, ok |
4120 // lui t9, <interrupt stub address> upper | 4120 // lui t9, <interrupt stub address> upper |
4121 // ori t9, <interrupt stub address> lower | 4121 // ori t9, <interrupt stub address> lower |
4122 // jalr t9 | 4122 // jalr t9 |
4123 // nop | 4123 // nop |
4124 // ok-label ----- pc_after points here | 4124 // ok-label ----- pc_after points here |
4125 patcher.masm()->slt(at, a3, zero_reg); | 4125 patcher.masm()->slt(at, a3, zero_reg); |
4126 break; | 4126 break; |
4127 case ON_STACK_REPLACEMENT: | 4127 case ON_STACK_REPLACEMENT: |
4128 case OSR_AFTER_STACK_CHECK: | |
4129 // addiu at, zero_reg, 1 | 4128 // addiu at, zero_reg, 1 |
4130 // beq at, zero_reg, ok ;; Not changed | 4129 // beq at, zero_reg, ok ;; Not changed |
4131 // lui t9, <on-stack replacement address> upper | 4130 // lui t9, <on-stack replacement address> upper |
4132 // ori t9, <on-stack replacement address> lower | 4131 // ori t9, <on-stack replacement address> lower |
4133 // jalr t9 ;; Not changed | 4132 // jalr t9 ;; Not changed |
4134 // nop ;; Not changed | 4133 // nop ;; Not changed |
4135 // ok-label ----- pc_after points here | 4134 // ok-label ----- pc_after points here |
4136 patcher.masm()->addiu(at, zero_reg, 1); | 4135 patcher.masm()->addiu(at, zero_reg, 1); |
4137 break; | 4136 break; |
4138 } | 4137 } |
4139 Address pc_immediate_load_address = pc - 4 * kInstrSize; | 4138 Address pc_immediate_load_address = pc - 4 * kInstrSize; |
4140 // Replace the stack check address in the load-immediate (lui/ori pair) | 4139 // Replace the stack check address in the load-immediate (lui/ori pair) |
4141 // with the entry address of the replacement code. | 4140 // with the entry address of the replacement code. |
4142 Assembler::set_target_address_at(isolate, pc_immediate_load_address, | 4141 Assembler::set_target_address_at(isolate, pc_immediate_load_address, |
4143 replacement_code->entry()); | 4142 replacement_code->entry()); |
4144 | 4143 |
4145 unoptimized_code->GetHeap()->incremental_marking()->RecordCodeTargetPatch( | 4144 unoptimized_code->GetHeap()->incremental_marking()->RecordCodeTargetPatch( |
4146 unoptimized_code, pc_immediate_load_address, replacement_code); | 4145 unoptimized_code, pc_immediate_load_address, replacement_code); |
4147 } | 4146 } |
4148 | 4147 |
4149 | 4148 |
4150 BackEdgeTable::BackEdgeState BackEdgeTable::GetBackEdgeState( | 4149 BackEdgeTable::BackEdgeState BackEdgeTable::GetBackEdgeState( |
4151 Isolate* isolate, | 4150 Isolate* isolate, |
4152 Code* unoptimized_code, | 4151 Code* unoptimized_code, |
4153 Address pc) { | 4152 Address pc) { |
4154 static const int kInstrSize = Assembler::kInstrSize; | 4153 static const int kInstrSize = Assembler::kInstrSize; |
4155 Address branch_address = pc - 6 * kInstrSize; | 4154 Address branch_address = pc - 6 * kInstrSize; |
| 4155 #ifdef DEBUG |
4156 Address pc_immediate_load_address = pc - 4 * kInstrSize; | 4156 Address pc_immediate_load_address = pc - 4 * kInstrSize; |
| 4157 #endif |
4157 | 4158 |
4158 DCHECK(Assembler::IsBeq(Assembler::instr_at(pc - 5 * kInstrSize))); | 4159 DCHECK(Assembler::IsBeq(Assembler::instr_at(pc - 5 * kInstrSize))); |
4159 if (!Assembler::IsAddImmediate(Assembler::instr_at(branch_address))) { | 4160 if (!Assembler::IsAddImmediate(Assembler::instr_at(branch_address))) { |
4160 DCHECK(reinterpret_cast<uint32_t>( | 4161 DCHECK(reinterpret_cast<uint32_t>( |
4161 Assembler::target_address_at(pc_immediate_load_address)) == | 4162 Assembler::target_address_at(pc_immediate_load_address)) == |
4162 reinterpret_cast<uint32_t>( | 4163 reinterpret_cast<uint32_t>( |
4163 isolate->builtins()->InterruptCheck()->entry())); | 4164 isolate->builtins()->InterruptCheck()->entry())); |
4164 return INTERRUPT; | 4165 return INTERRUPT; |
4165 } | 4166 } |
4166 | 4167 |
4167 DCHECK(Assembler::IsAddImmediate(Assembler::instr_at(branch_address))); | 4168 DCHECK(Assembler::IsAddImmediate(Assembler::instr_at(branch_address))); |
4168 | 4169 |
4169 if (reinterpret_cast<uint32_t>( | |
4170 Assembler::target_address_at(pc_immediate_load_address)) == | |
4171 reinterpret_cast<uint32_t>( | |
4172 isolate->builtins()->OnStackReplacement()->entry())) { | |
4173 return ON_STACK_REPLACEMENT; | |
4174 } | |
4175 | |
4176 DCHECK(reinterpret_cast<uint32_t>( | 4170 DCHECK(reinterpret_cast<uint32_t>( |
4177 Assembler::target_address_at(pc_immediate_load_address)) == | 4171 Assembler::target_address_at(pc_immediate_load_address)) == |
4178 reinterpret_cast<uint32_t>( | 4172 reinterpret_cast<uint32_t>( |
4179 isolate->builtins()->OsrAfterStackCheck()->entry())); | 4173 isolate->builtins()->OnStackReplacement()->entry())); |
4180 return OSR_AFTER_STACK_CHECK; | 4174 return ON_STACK_REPLACEMENT; |
4181 } | 4175 } |
4182 | 4176 |
4183 | 4177 |
4184 } // namespace internal | 4178 } // namespace internal |
4185 } // namespace v8 | 4179 } // namespace v8 |
4186 | 4180 |
4187 #endif // V8_TARGET_ARCH_MIPS | 4181 #endif // V8_TARGET_ARCH_MIPS |
OLD | NEW |