| OLD | NEW |
| 1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 4939 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4950 // Turn the jump into a nop. | 4950 // Turn the jump into a nop. |
| 4951 Address branch_address = pc - 3 * kInstructionSize; | 4951 Address branch_address = pc - 3 * kInstructionSize; |
| 4952 PatchingAssembler patcher(branch_address, 1); | 4952 PatchingAssembler patcher(branch_address, 1); |
| 4953 | 4953 |
| 4954 switch (target_state) { | 4954 switch (target_state) { |
| 4955 case INTERRUPT: | 4955 case INTERRUPT: |
| 4956 // <decrement profiling counter> | 4956 // <decrement profiling counter> |
| 4957 // .. .. .. .. b.pl ok | 4957 // .. .. .. .. b.pl ok |
| 4958 // .. .. .. .. ldr x16, pc+<interrupt stub address> | 4958 // .. .. .. .. ldr x16, pc+<interrupt stub address> |
| 4959 // .. .. .. .. blr x16 | 4959 // .. .. .. .. blr x16 |
| 4960 // ... more instructions. |
| 4960 // ok-label | 4961 // ok-label |
| 4961 // Jump offset is 4 instructions. | 4962 // Jump offset is 6 instructions. |
| 4962 patcher.b(4 * kInstructionSize, pl); | 4963 ASSERT(Instruction::Cast(branch_address) |
| 4964 ->IsNop(Assembler::INTERRUPT_CODE_NOP)); |
| 4965 patcher.b(6, pl); |
| 4963 break; | 4966 break; |
| 4964 case ON_STACK_REPLACEMENT: | 4967 case ON_STACK_REPLACEMENT: |
| 4965 case OSR_AFTER_STACK_CHECK: | 4968 case OSR_AFTER_STACK_CHECK: |
| 4966 // <decrement profiling counter> | 4969 // <decrement profiling counter> |
| 4967 // .. .. .. .. mov x0, x0 (NOP) | 4970 // .. .. .. .. mov x0, x0 (NOP) |
| 4968 // .. .. .. .. ldr x16, pc+<on-stack replacement address> | 4971 // .. .. .. .. ldr x16, pc+<on-stack replacement address> |
| 4969 // .. .. .. .. blr x16 | 4972 // .. .. .. .. blr x16 |
| 4973 ASSERT(Instruction::Cast(branch_address)->IsCondBranchImm()); |
| 4974 ASSERT(Instruction::Cast(branch_address)->ImmPCOffset() == |
| 4975 6 * kInstructionSize); |
| 4970 patcher.nop(Assembler::INTERRUPT_CODE_NOP); | 4976 patcher.nop(Assembler::INTERRUPT_CODE_NOP); |
| 4971 break; | 4977 break; |
| 4972 } | 4978 } |
| 4973 | 4979 |
| 4974 // Replace the call address. | 4980 // Replace the call address. |
| 4975 Instruction* load = Instruction::Cast(pc)->preceding(2); | 4981 Instruction* load = Instruction::Cast(pc)->preceding(2); |
| 4976 Address interrupt_address_pointer = pc + load->ImmPCOffset(); | 4982 Address interrupt_address_pointer = |
| 4983 reinterpret_cast<Address>(load) + load->ImmPCOffset(); |
| 4984 ASSERT((Memory::uint64_at(interrupt_address_pointer) == |
| 4985 reinterpret_cast<uint64_t>(unoptimized_code->GetIsolate() |
| 4986 ->builtins() |
| 4987 ->OnStackReplacement() |
| 4988 ->entry())) || |
| 4989 (Memory::uint64_at(interrupt_address_pointer) == |
| 4990 reinterpret_cast<uint64_t>(unoptimized_code->GetIsolate() |
| 4991 ->builtins() |
| 4992 ->InterruptCheck() |
| 4993 ->entry())) || |
| 4994 (Memory::uint64_at(interrupt_address_pointer) == |
| 4995 reinterpret_cast<uint64_t>(unoptimized_code->GetIsolate() |
| 4996 ->builtins() |
| 4997 ->OsrAfterStackCheck() |
| 4998 ->entry())) || |
| 4999 (Memory::uint64_at(interrupt_address_pointer) == |
| 5000 reinterpret_cast<uint64_t>(unoptimized_code->GetIsolate() |
| 5001 ->builtins() |
| 5002 ->OnStackReplacement() |
| 5003 ->entry()))); |
| 4977 Memory::uint64_at(interrupt_address_pointer) = | 5004 Memory::uint64_at(interrupt_address_pointer) = |
| 4978 reinterpret_cast<uint64_t>(replacement_code->entry()); | 5005 reinterpret_cast<uint64_t>(replacement_code->entry()); |
| 4979 | 5006 |
| 4980 unoptimized_code->GetHeap()->incremental_marking()->RecordCodeTargetPatch( | 5007 unoptimized_code->GetHeap()->incremental_marking()->RecordCodeTargetPatch( |
| 4981 unoptimized_code, reinterpret_cast<Address>(load), replacement_code); | 5008 unoptimized_code, reinterpret_cast<Address>(load), replacement_code); |
| 4982 } | 5009 } |
| 4983 | 5010 |
| 4984 | 5011 |
| 4985 BackEdgeTable::BackEdgeState BackEdgeTable::GetBackEdgeState( | 5012 BackEdgeTable::BackEdgeState BackEdgeTable::GetBackEdgeState( |
| 4986 Isolate* isolate, | 5013 Isolate* isolate, |
| 4987 Code* unoptimized_code, | 5014 Code* unoptimized_code, |
| 4988 Address pc) { | 5015 Address pc) { |
| 4989 // TODO(jbramley): There should be some extra assertions here (as in the ARM | 5016 // TODO(jbramley): There should be some extra assertions here (as in the ARM |
| 4990 // back-end), but this function is gone in bleeding_edge so it might not | 5017 // back-end), but this function is gone in bleeding_edge so it might not |
| 4991 // matter anyway. | 5018 // matter anyway. |
| 4992 Instruction* jump_or_nop = Instruction::Cast(pc)->preceding(3); | 5019 Instruction* jump_or_nop = Instruction::Cast(pc)->preceding(3); |
| 4993 | 5020 |
| 4994 if (jump_or_nop->IsNop(Assembler::INTERRUPT_CODE_NOP)) { | 5021 if (jump_or_nop->IsNop(Assembler::INTERRUPT_CODE_NOP)) { |
| 4995 Instruction* load = Instruction::Cast(pc)->preceding(2); | 5022 Instruction* load = Instruction::Cast(pc)->preceding(2); |
| 4996 uint64_t entry = Memory::uint64_at(pc + load->ImmPCOffset()); | 5023 uint64_t entry = Memory::uint64_at(reinterpret_cast<Address>(load) + |
| 5024 load->ImmPCOffset()); |
| 4997 if (entry == reinterpret_cast<uint64_t>( | 5025 if (entry == reinterpret_cast<uint64_t>( |
| 4998 isolate->builtins()->OnStackReplacement()->entry())) { | 5026 isolate->builtins()->OnStackReplacement()->entry())) { |
| 4999 return ON_STACK_REPLACEMENT; | 5027 return ON_STACK_REPLACEMENT; |
| 5000 } else if (entry == reinterpret_cast<uint64_t>( | 5028 } else if (entry == reinterpret_cast<uint64_t>( |
| 5001 isolate->builtins()->OsrAfterStackCheck()->entry())) { | 5029 isolate->builtins()->OsrAfterStackCheck()->entry())) { |
| 5002 return OSR_AFTER_STACK_CHECK; | 5030 return OSR_AFTER_STACK_CHECK; |
| 5003 } else { | 5031 } else { |
| 5004 UNREACHABLE(); | 5032 UNREACHABLE(); |
| 5005 } | 5033 } |
| 5006 } | 5034 } |
| (...skipping 29 matching lines...) Expand all Loading... |
| 5036 return previous_; | 5064 return previous_; |
| 5037 } | 5065 } |
| 5038 | 5066 |
| 5039 | 5067 |
| 5040 #undef __ | 5068 #undef __ |
| 5041 | 5069 |
| 5042 | 5070 |
| 5043 } } // namespace v8::internal | 5071 } } // namespace v8::internal |
| 5044 | 5072 |
| 5045 #endif // V8_TARGET_ARCH_A64 | 5073 #endif // V8_TARGET_ARCH_A64 |
| OLD | NEW |