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 4841 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4852 | 4852 |
4853 | 4853 |
4854 void BackEdgeTable::PatchAt(Code* unoptimized_code, | 4854 void BackEdgeTable::PatchAt(Code* unoptimized_code, |
4855 Address pc, | 4855 Address pc, |
4856 BackEdgeState target_state, | 4856 BackEdgeState target_state, |
4857 Code* replacement_code) { | 4857 Code* replacement_code) { |
4858 // Turn the jump into a nop. | 4858 // Turn the jump into a nop. |
4859 Address branch_address = pc - 3 * kInstructionSize; | 4859 Address branch_address = pc - 3 * kInstructionSize; |
4860 PatchingAssembler patcher(branch_address, 1); | 4860 PatchingAssembler patcher(branch_address, 1); |
4861 | 4861 |
| 4862 ASSERT(Instruction::Cast(branch_address) |
| 4863 ->IsNop(Assembler::INTERRUPT_CODE_NOP) || |
| 4864 (Instruction::Cast(branch_address)->IsCondBranchImm() && |
| 4865 Instruction::Cast(branch_address)->ImmPCOffset() == |
| 4866 6 * kInstructionSize)); |
| 4867 |
4862 switch (target_state) { | 4868 switch (target_state) { |
4863 case INTERRUPT: | 4869 case INTERRUPT: |
4864 // <decrement profiling counter> | 4870 // <decrement profiling counter> |
4865 // .. .. .. .. b.pl ok | 4871 // .. .. .. .. b.pl ok |
4866 // .. .. .. .. ldr x16, pc+<interrupt stub address> | 4872 // .. .. .. .. ldr x16, pc+<interrupt stub address> |
4867 // .. .. .. .. blr x16 | 4873 // .. .. .. .. blr x16 |
4868 // ... more instructions. | 4874 // ... more instructions. |
4869 // ok-label | 4875 // ok-label |
4870 // Jump offset is 6 instructions. | 4876 // Jump offset is 6 instructions. |
4871 ASSERT(Instruction::Cast(branch_address) | |
4872 ->IsNop(Assembler::INTERRUPT_CODE_NOP)); | |
4873 patcher.b(6, pl); | 4877 patcher.b(6, pl); |
4874 break; | 4878 break; |
4875 case ON_STACK_REPLACEMENT: | 4879 case ON_STACK_REPLACEMENT: |
4876 case OSR_AFTER_STACK_CHECK: | 4880 case OSR_AFTER_STACK_CHECK: |
4877 // <decrement profiling counter> | 4881 // <decrement profiling counter> |
4878 // .. .. .. .. mov x0, x0 (NOP) | 4882 // .. .. .. .. mov x0, x0 (NOP) |
4879 // .. .. .. .. ldr x16, pc+<on-stack replacement address> | 4883 // .. .. .. .. ldr x16, pc+<on-stack replacement address> |
4880 // .. .. .. .. blr x16 | 4884 // .. .. .. .. blr x16 |
4881 ASSERT(Instruction::Cast(branch_address)->IsCondBranchImm()); | |
4882 ASSERT(Instruction::Cast(branch_address)->ImmPCOffset() == | |
4883 6 * kInstructionSize); | |
4884 patcher.nop(Assembler::INTERRUPT_CODE_NOP); | 4885 patcher.nop(Assembler::INTERRUPT_CODE_NOP); |
4885 break; | 4886 break; |
4886 } | 4887 } |
4887 | 4888 |
4888 // Replace the call address. | 4889 // Replace the call address. |
4889 Instruction* load = Instruction::Cast(pc)->preceding(2); | 4890 Instruction* load = Instruction::Cast(pc)->preceding(2); |
4890 Address interrupt_address_pointer = | 4891 Address interrupt_address_pointer = |
4891 reinterpret_cast<Address>(load) + load->ImmPCOffset(); | 4892 reinterpret_cast<Address>(load) + load->ImmPCOffset(); |
4892 ASSERT((Memory::uint64_at(interrupt_address_pointer) == | 4893 ASSERT((Memory::uint64_at(interrupt_address_pointer) == |
4893 reinterpret_cast<uint64_t>(unoptimized_code->GetIsolate() | 4894 reinterpret_cast<uint64_t>(unoptimized_code->GetIsolate() |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4972 return previous_; | 4973 return previous_; |
4973 } | 4974 } |
4974 | 4975 |
4975 | 4976 |
4976 #undef __ | 4977 #undef __ |
4977 | 4978 |
4978 | 4979 |
4979 } } // namespace v8::internal | 4980 } } // namespace v8::internal |
4980 | 4981 |
4981 #endif // V8_TARGET_ARCH_A64 | 4982 #endif // V8_TARGET_ARCH_A64 |
OLD | NEW |