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

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

Issue 1474763008: Always pass an Isolate to AssemblerBase (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: updates Created 5 years 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
« no previous file with comments | « src/arm64/instructions-arm64.h ('k') | src/assembler.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #define ARM64_DEFINE_FP_STATICS 7 #define ARM64_DEFINE_FP_STATICS
8 8
9 #include "src/arm64/assembler-arm64-inl.h" 9 #include "src/arm64/assembler-arm64-inl.h"
10 #include "src/arm64/instructions-arm64.h" 10 #include "src/arm64/instructions-arm64.h"
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after
212 ptrdiff_t offset) { 212 ptrdiff_t offset) {
213 return is_intn(offset, ImmBranchRangeBitwidth(branch_type)); 213 return is_intn(offset, ImmBranchRangeBitwidth(branch_type));
214 } 214 }
215 215
216 216
217 bool Instruction::IsTargetInImmPCOffsetRange(Instruction* target) { 217 bool Instruction::IsTargetInImmPCOffsetRange(Instruction* target) {
218 return IsValidImmPCOffset(BranchType(), DistanceTo(target)); 218 return IsValidImmPCOffset(BranchType(), DistanceTo(target));
219 } 219 }
220 220
221 221
222 void Instruction::SetImmPCOffsetTarget(Instruction* target) { 222 void Instruction::SetImmPCOffsetTarget(Isolate* isolate, Instruction* target) {
223 if (IsPCRelAddressing()) { 223 if (IsPCRelAddressing()) {
224 SetPCRelImmTarget(target); 224 SetPCRelImmTarget(isolate, target);
225 } else if (BranchType() != UnknownBranchType) { 225 } else if (BranchType() != UnknownBranchType) {
226 SetBranchImmTarget(target); 226 SetBranchImmTarget(target);
227 } else if (IsUnresolvedInternalReference()) { 227 } else if (IsUnresolvedInternalReference()) {
228 SetUnresolvedInternalReferenceImmTarget(target); 228 SetUnresolvedInternalReferenceImmTarget(isolate, target);
229 } else { 229 } else {
230 // Load literal (offset from PC). 230 // Load literal (offset from PC).
231 SetImmLLiteral(target); 231 SetImmLLiteral(target);
232 } 232 }
233 } 233 }
234 234
235 235
236 void Instruction::SetPCRelImmTarget(Instruction* target) { 236 void Instruction::SetPCRelImmTarget(Isolate* isolate, Instruction* target) {
237 // ADRP is not supported, so 'this' must point to an ADR instruction. 237 // ADRP is not supported, so 'this' must point to an ADR instruction.
238 DCHECK(IsAdr()); 238 DCHECK(IsAdr());
239 239
240 ptrdiff_t target_offset = DistanceTo(target); 240 ptrdiff_t target_offset = DistanceTo(target);
241 Instr imm; 241 Instr imm;
242 if (Instruction::IsValidPCRelOffset(target_offset)) { 242 if (Instruction::IsValidPCRelOffset(target_offset)) {
243 imm = Assembler::ImmPCRelAddress(static_cast<int>(target_offset)); 243 imm = Assembler::ImmPCRelAddress(static_cast<int>(target_offset));
244 SetInstructionBits(Mask(~ImmPCRel_mask) | imm); 244 SetInstructionBits(Mask(~ImmPCRel_mask) | imm);
245 } else { 245 } else {
246 PatchingAssembler patcher(this, 246 PatchingAssembler patcher(isolate, this,
247 PatchingAssembler::kAdrFarPatchableNInstrs); 247 PatchingAssembler::kAdrFarPatchableNInstrs);
248 patcher.PatchAdrFar(target_offset); 248 patcher.PatchAdrFar(target_offset);
249 } 249 }
250 } 250 }
251 251
252 252
253 void Instruction::SetBranchImmTarget(Instruction* target) { 253 void Instruction::SetBranchImmTarget(Instruction* target) {
254 DCHECK(IsAligned(DistanceTo(target), kInstructionSize)); 254 DCHECK(IsAligned(DistanceTo(target), kInstructionSize));
255 DCHECK(IsValidImmPCOffset(BranchType(), 255 DCHECK(IsValidImmPCOffset(BranchType(),
256 DistanceTo(target) >> kInstructionSizeLog2)); 256 DistanceTo(target) >> kInstructionSizeLog2));
(...skipping 20 matching lines...) Expand all
277 branch_imm = Assembler::ImmTestBranch(offset); 277 branch_imm = Assembler::ImmTestBranch(offset);
278 imm_mask = ImmTestBranch_mask; 278 imm_mask = ImmTestBranch_mask;
279 break; 279 break;
280 } 280 }
281 default: UNREACHABLE(); 281 default: UNREACHABLE();
282 } 282 }
283 SetInstructionBits(Mask(~imm_mask) | branch_imm); 283 SetInstructionBits(Mask(~imm_mask) | branch_imm);
284 } 284 }
285 285
286 286
287 void Instruction::SetUnresolvedInternalReferenceImmTarget(Instruction* target) { 287 void Instruction::SetUnresolvedInternalReferenceImmTarget(Isolate* isolate,
288 Instruction* target) {
288 DCHECK(IsUnresolvedInternalReference()); 289 DCHECK(IsUnresolvedInternalReference());
289 DCHECK(IsAligned(DistanceTo(target), kInstructionSize)); 290 DCHECK(IsAligned(DistanceTo(target), kInstructionSize));
290 DCHECK(is_int32(DistanceTo(target) >> kInstructionSizeLog2)); 291 DCHECK(is_int32(DistanceTo(target) >> kInstructionSizeLog2));
291 int32_t target_offset = 292 int32_t target_offset =
292 static_cast<int32_t>(DistanceTo(target) >> kInstructionSizeLog2); 293 static_cast<int32_t>(DistanceTo(target) >> kInstructionSizeLog2);
293 uint32_t high16 = unsigned_bitextract_32(31, 16, target_offset); 294 uint32_t high16 = unsigned_bitextract_32(31, 16, target_offset);
294 uint32_t low16 = unsigned_bitextract_32(15, 0, target_offset); 295 uint32_t low16 = unsigned_bitextract_32(15, 0, target_offset);
295 296
296 PatchingAssembler patcher(this, 2); 297 PatchingAssembler patcher(isolate, this, 2);
297 patcher.brk(high16); 298 patcher.brk(high16);
298 patcher.brk(low16); 299 patcher.brk(low16);
299 } 300 }
300 301
301 302
302 void Instruction::SetImmLLiteral(Instruction* source) { 303 void Instruction::SetImmLLiteral(Instruction* source) {
303 DCHECK(IsLdrLiteral()); 304 DCHECK(IsLdrLiteral());
304 DCHECK(IsAligned(DistanceTo(source), kInstructionSize)); 305 DCHECK(IsAligned(DistanceTo(source), kInstructionSize));
305 DCHECK(Assembler::IsImmLLiteral(DistanceTo(source))); 306 DCHECK(Assembler::IsImmLLiteral(DistanceTo(source)));
306 Instr imm = Assembler::ImmLLiteral( 307 Instr imm = Assembler::ImmLLiteral(
(...skipping 25 matching lines...) Expand all
332 // TODO(all): If we extend ::InlineData() to support bigger data, we need 333 // TODO(all): If we extend ::InlineData() to support bigger data, we need
333 // to update this method too. 334 // to update this method too.
334 return payload; 335 return payload;
335 } 336 }
336 337
337 338
338 } // namespace internal 339 } // namespace internal
339 } // namespace v8 340 } // namespace v8
340 341
341 #endif // V8_TARGET_ARCH_ARM64 342 #endif // V8_TARGET_ARCH_ARM64
OLDNEW
« no previous file with comments | « src/arm64/instructions-arm64.h ('k') | src/assembler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698