Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(538)

Side by Side Diff: src/arm64/instructions-arm64.cc

Issue 222433002: ARM64: Introduce a version of ADR handling distant targets. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Fix loop offset Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 236 matching lines...) Expand 10 before | Expand all | Expand 10 after
247 } else if (BranchType() != UnknownBranchType) { 247 } else if (BranchType() != UnknownBranchType) {
248 SetBranchImmTarget(target); 248 SetBranchImmTarget(target);
249 } else { 249 } else {
250 SetImmLLiteral(target); 250 SetImmLLiteral(target);
251 } 251 }
252 } 252 }
253 253
254 254
255 void Instruction::SetPCRelImmTarget(Instruction* target) { 255 void Instruction::SetPCRelImmTarget(Instruction* target) {
256 // ADRP is not supported, so 'this' must point to an ADR instruction. 256 // ADRP is not supported, so 'this' must point to an ADR instruction.
257 ASSERT(Mask(PCRelAddressingMask) == ADR); 257 ASSERT(IsAdr());
258 258
259 Instr imm = Assembler::ImmPCRelAddress(DistanceTo(target)); 259 int target_offset = DistanceTo(target);
260 260 Instr imm;
261 SetInstructionBits(Mask(~ImmPCRel_mask) | imm); 261 if (Instruction::IsValidPCRelOffset(target_offset)) {
262 imm = Assembler::ImmPCRelAddress(target_offset);
263 SetInstructionBits(Mask(~ImmPCRel_mask) | imm);
264 } else {
265 PatchingAssembler patcher(this,
266 PatchingAssembler::kAdrFarPatchableNInstrs);
267 patcher.PatchAdrFar(target);
268 }
262 } 269 }
263 270
264 271
265 void Instruction::SetBranchImmTarget(Instruction* target) { 272 void Instruction::SetBranchImmTarget(Instruction* target) {
266 ASSERT(IsAligned(DistanceTo(target), kInstructionSize)); 273 ASSERT(IsAligned(DistanceTo(target), kInstructionSize));
267 Instr branch_imm = 0; 274 Instr branch_imm = 0;
268 uint32_t imm_mask = 0; 275 uint32_t imm_mask = 0;
269 ptrdiff_t offset = DistanceTo(target) >> kInstructionSizeLog2; 276 ptrdiff_t offset = DistanceTo(target) >> kInstructionSizeLog2;
270 switch (BranchType()) { 277 switch (BranchType()) {
271 case CondBranchType: { 278 case CondBranchType: {
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
324 uint64_t payload = ImmMoveWide(); 331 uint64_t payload = ImmMoveWide();
325 // TODO(all): If we extend ::InlineData() to support bigger data, we need 332 // TODO(all): If we extend ::InlineData() to support bigger data, we need
326 // to update this method too. 333 // to update this method too.
327 return payload; 334 return payload;
328 } 335 }
329 336
330 337
331 } } // namespace v8::internal 338 } } // namespace v8::internal
332 339
333 #endif // V8_TARGET_ARCH_ARM64 340 #endif // V8_TARGET_ARCH_ARM64
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698