OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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_ARM64 | 5 #if V8_TARGET_ARCH_ARM64 |
6 | 6 |
7 #include "src/ast/scopes.h" | 7 #include "src/ast/scopes.h" |
8 #include "src/code-factory.h" | 8 #include "src/code-factory.h" |
9 #include "src/code-stubs.h" | 9 #include "src/code-stubs.h" |
10 #include "src/codegen.h" | 10 #include "src/codegen.h" |
(...skipping 4153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4164 // <decrement profiling counter> | 4164 // <decrement profiling counter> |
4165 // .. .. .. .. b.pl ok | 4165 // .. .. .. .. b.pl ok |
4166 // .. .. .. .. ldr x16, pc+<interrupt stub address> | 4166 // .. .. .. .. ldr x16, pc+<interrupt stub address> |
4167 // .. .. .. .. blr x16 | 4167 // .. .. .. .. blr x16 |
4168 // ... more instructions. | 4168 // ... more instructions. |
4169 // ok-label | 4169 // ok-label |
4170 // Jump offset is 6 instructions. | 4170 // Jump offset is 6 instructions. |
4171 patcher.b(6, pl); | 4171 patcher.b(6, pl); |
4172 break; | 4172 break; |
4173 case ON_STACK_REPLACEMENT: | 4173 case ON_STACK_REPLACEMENT: |
4174 case OSR_AFTER_STACK_CHECK: | |
4175 // <decrement profiling counter> | 4174 // <decrement profiling counter> |
4176 // .. .. .. .. mov x0, x0 (NOP) | 4175 // .. .. .. .. mov x0, x0 (NOP) |
4177 // .. .. .. .. ldr x16, pc+<on-stack replacement address> | 4176 // .. .. .. .. ldr x16, pc+<on-stack replacement address> |
4178 // .. .. .. .. blr x16 | 4177 // .. .. .. .. blr x16 |
4179 patcher.nop(Assembler::INTERRUPT_CODE_NOP); | 4178 patcher.nop(Assembler::INTERRUPT_CODE_NOP); |
4180 break; | 4179 break; |
4181 } | 4180 } |
4182 | 4181 |
4183 // Replace the call address. | 4182 // Replace the call address. |
4184 Instruction* load = Instruction::Cast(pc)->preceding(2); | 4183 Instruction* load = Instruction::Cast(pc)->preceding(2); |
4185 Address interrupt_address_pointer = | 4184 Address interrupt_address_pointer = |
4186 reinterpret_cast<Address>(load) + load->ImmPCOffset(); | 4185 reinterpret_cast<Address>(load) + load->ImmPCOffset(); |
4187 DCHECK((Memory::uint64_at(interrupt_address_pointer) == | 4186 DCHECK((Memory::uint64_at(interrupt_address_pointer) == |
4188 reinterpret_cast<uint64_t>( | 4187 reinterpret_cast<uint64_t>( |
4189 isolate->builtins()->OnStackReplacement()->entry())) || | 4188 isolate->builtins()->OnStackReplacement()->entry())) || |
4190 (Memory::uint64_at(interrupt_address_pointer) == | 4189 (Memory::uint64_at(interrupt_address_pointer) == |
4191 reinterpret_cast<uint64_t>( | 4190 reinterpret_cast<uint64_t>( |
4192 isolate->builtins()->InterruptCheck()->entry())) || | 4191 isolate->builtins()->InterruptCheck()->entry())) || |
4193 (Memory::uint64_at(interrupt_address_pointer) == | 4192 (Memory::uint64_at(interrupt_address_pointer) == |
4194 reinterpret_cast<uint64_t>( | 4193 reinterpret_cast<uint64_t>( |
4195 isolate->builtins()->OsrAfterStackCheck()->entry())) || | |
4196 (Memory::uint64_at(interrupt_address_pointer) == | |
4197 reinterpret_cast<uint64_t>( | |
4198 isolate->builtins()->OnStackReplacement()->entry()))); | 4194 isolate->builtins()->OnStackReplacement()->entry()))); |
4199 Memory::uint64_at(interrupt_address_pointer) = | 4195 Memory::uint64_at(interrupt_address_pointer) = |
4200 reinterpret_cast<uint64_t>(replacement_code->entry()); | 4196 reinterpret_cast<uint64_t>(replacement_code->entry()); |
4201 | 4197 |
4202 unoptimized_code->GetHeap()->incremental_marking()->RecordCodeTargetPatch( | 4198 unoptimized_code->GetHeap()->incremental_marking()->RecordCodeTargetPatch( |
4203 unoptimized_code, reinterpret_cast<Address>(load), replacement_code); | 4199 unoptimized_code, reinterpret_cast<Address>(load), replacement_code); |
4204 } | 4200 } |
4205 | 4201 |
4206 | 4202 |
4207 BackEdgeTable::BackEdgeState BackEdgeTable::GetBackEdgeState( | 4203 BackEdgeTable::BackEdgeState BackEdgeTable::GetBackEdgeState( |
4208 Isolate* isolate, | 4204 Isolate* isolate, |
4209 Code* unoptimized_code, | 4205 Code* unoptimized_code, |
4210 Address pc) { | 4206 Address pc) { |
4211 // TODO(jbramley): There should be some extra assertions here (as in the ARM | 4207 // TODO(jbramley): There should be some extra assertions here (as in the ARM |
4212 // back-end), but this function is gone in bleeding_edge so it might not | 4208 // back-end), but this function is gone in bleeding_edge so it might not |
4213 // matter anyway. | 4209 // matter anyway. |
4214 Instruction* jump_or_nop = Instruction::Cast(pc)->preceding(3); | 4210 Instruction* jump_or_nop = Instruction::Cast(pc)->preceding(3); |
4215 | 4211 |
4216 if (jump_or_nop->IsNop(Assembler::INTERRUPT_CODE_NOP)) { | 4212 if (jump_or_nop->IsNop(Assembler::INTERRUPT_CODE_NOP)) { |
4217 Instruction* load = Instruction::Cast(pc)->preceding(2); | 4213 Instruction* load = Instruction::Cast(pc)->preceding(2); |
4218 uint64_t entry = Memory::uint64_at(reinterpret_cast<Address>(load) + | 4214 uint64_t entry = Memory::uint64_at(reinterpret_cast<Address>(load) + |
4219 load->ImmPCOffset()); | 4215 load->ImmPCOffset()); |
4220 if (entry == reinterpret_cast<uint64_t>( | 4216 if (entry == reinterpret_cast<uint64_t>( |
4221 isolate->builtins()->OnStackReplacement()->entry())) { | 4217 isolate->builtins()->OnStackReplacement()->entry())) { |
4222 return ON_STACK_REPLACEMENT; | 4218 return ON_STACK_REPLACEMENT; |
4223 } else if (entry == reinterpret_cast<uint64_t>( | |
4224 isolate->builtins()->OsrAfterStackCheck()->entry())) { | |
4225 return OSR_AFTER_STACK_CHECK; | |
4226 } else { | 4219 } else { |
4227 UNREACHABLE(); | 4220 UNREACHABLE(); |
4228 } | 4221 } |
4229 } | 4222 } |
4230 | 4223 |
4231 return INTERRUPT; | 4224 return INTERRUPT; |
4232 } | 4225 } |
4233 | 4226 |
4234 | 4227 |
4235 } // namespace internal | 4228 } // namespace internal |
4236 } // namespace v8 | 4229 } // namespace v8 |
4237 | 4230 |
4238 #endif // V8_TARGET_ARCH_ARM64 | 4231 #endif // V8_TARGET_ARCH_ARM64 |
OLD | NEW |