OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 the V8 project authors. All rights reserved. |
2 // | 2 // |
3 // Redistribution and use in source and binary forms, with or without | 3 // Redistribution and use in source and binary forms, with or without |
4 // modification, are permitted provided that the following conditions are | 4 // modification, are permitted provided that the following conditions are |
5 // met: | 5 // met: |
6 // | 6 // |
7 // * Redistributions of source code must retain the above copyright | 7 // * Redistributions of source code must retain the above copyright |
8 // notice, this list of conditions and the following disclaimer. | 8 // notice, this list of conditions and the following disclaimer. |
9 // * Redistributions in binary form must reproduce the above | 9 // * Redistributions in binary form must reproduce the above |
10 // copyright notice, this list of conditions and the following | 10 // copyright notice, this list of conditions and the following |
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
181 return false; | 181 return false; |
182 } | 182 } |
183 | 183 |
184 | 184 |
185 bool RelocInfo::IsInConstantPool() { | 185 bool RelocInfo::IsInConstantPool() { |
186 Instruction* instr = reinterpret_cast<Instruction*>(pc_); | 186 Instruction* instr = reinterpret_cast<Instruction*>(pc_); |
187 return instr->IsLdrLiteralX(); | 187 return instr->IsLdrLiteralX(); |
188 } | 188 } |
189 | 189 |
190 | 190 |
191 void RelocInfo::PatchCode(byte* instructions, int instruction_count) { | |
192 // Patch the code at the current address with the supplied instructions. | |
193 Instr* pc = reinterpret_cast<Instr*>(pc_); | |
194 Instr* instr = reinterpret_cast<Instr*>(instructions); | |
195 for (int i = 0; i < instruction_count; i++) { | |
196 *(pc + i) = *(instr + i); | |
197 } | |
198 | |
199 // Indicate that code has changed. | |
200 CpuFeatures::FlushICache(pc_, instruction_count * kInstructionSize); | |
201 } | |
202 | |
203 | |
204 // Patch the code at the current PC with a call to the target address. | |
205 // Additional guard instructions can be added if required. | |
206 void RelocInfo::PatchCodeWithCall(Address target, int guard_bytes) { | |
207 UNIMPLEMENTED(); | |
208 } | |
209 | |
210 | |
211 Register GetAllocatableRegisterThatIsNotOneOf(Register reg1, Register reg2, | 191 Register GetAllocatableRegisterThatIsNotOneOf(Register reg1, Register reg2, |
212 Register reg3, Register reg4) { | 192 Register reg3, Register reg4) { |
213 CPURegList regs(reg1, reg2, reg3, reg4); | 193 CPURegList regs(reg1, reg2, reg3, reg4); |
214 for (int i = 0; i < Register::NumAllocatableRegisters(); i++) { | 194 for (int i = 0; i < Register::NumAllocatableRegisters(); i++) { |
215 Register candidate = Register::FromAllocationIndex(i); | 195 Register candidate = Register::FromAllocationIndex(i); |
216 if (regs.IncludesAliasOf(candidate)) continue; | 196 if (regs.IncludesAliasOf(candidate)) continue; |
217 return candidate; | 197 return candidate; |
218 } | 198 } |
219 UNREACHABLE(); | 199 UNREACHABLE(); |
220 return NoReg; | 200 return NoReg; |
(...skipping 2906 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3127 movz(scratch, (target_offset >> 16) & 0xFFFF, 16); | 3107 movz(scratch, (target_offset >> 16) & 0xFFFF, 16); |
3128 movk(scratch, (target_offset >> 32) & 0xFFFF, 32); | 3108 movk(scratch, (target_offset >> 32) & 0xFFFF, 32); |
3129 DCHECK((target_offset >> 48) == 0); | 3109 DCHECK((target_offset >> 48) == 0); |
3130 add(rd, rd, scratch); | 3110 add(rd, rd, scratch); |
3131 } | 3111 } |
3132 | 3112 |
3133 | 3113 |
3134 } } // namespace v8::internal | 3114 } } // namespace v8::internal |
3135 | 3115 |
3136 #endif // V8_TARGET_ARCH_ARM64 | 3116 #endif // V8_TARGET_ARCH_ARM64 |
OLD | NEW |