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

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

Issue 2732273003: Disentangle assembler from isolate. (Closed)
Patch Set: Address feedback. Created 3 years, 9 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
« no previous file with comments | « src/arm64/instructions-arm64.h ('k') | src/arm64/macro-assembler-arm64.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 200 matching lines...) Expand 10 before | Expand all | Expand 10 after
211 bool Instruction::IsValidImmPCOffset(ImmBranchType branch_type, 211 bool Instruction::IsValidImmPCOffset(ImmBranchType branch_type,
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 void Instruction::SetImmPCOffsetTarget(Assembler::IsolateData isolate_data,
222 void Instruction::SetImmPCOffsetTarget(Isolate* isolate, Instruction* target) { 222 Instruction* target) {
223 if (IsPCRelAddressing()) { 223 if (IsPCRelAddressing()) {
224 SetPCRelImmTarget(isolate, target); 224 SetPCRelImmTarget(isolate_data, 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(isolate, target); 228 SetUnresolvedInternalReferenceImmTarget(isolate_data, 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 void Instruction::SetPCRelImmTarget(Assembler::IsolateData isolate_data,
236 void Instruction::SetPCRelImmTarget(Isolate* isolate, Instruction* target) { 236 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(isolate, this, 246 PatchingAssembler patcher(isolate_data, reinterpret_cast<byte*>(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 19 matching lines...) Expand all
276 case TestBranchType: { 276 case TestBranchType: {
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 void Instruction::SetUnresolvedInternalReferenceImmTarget(
287 void Instruction::SetUnresolvedInternalReferenceImmTarget(Isolate* isolate, 287 Assembler::IsolateData isolate_data, Instruction* target) {
288 Instruction* target) {
289 DCHECK(IsUnresolvedInternalReference()); 288 DCHECK(IsUnresolvedInternalReference());
290 DCHECK(IsAligned(DistanceTo(target), kInstructionSize)); 289 DCHECK(IsAligned(DistanceTo(target), kInstructionSize));
291 DCHECK(is_int32(DistanceTo(target) >> kInstructionSizeLog2)); 290 DCHECK(is_int32(DistanceTo(target) >> kInstructionSizeLog2));
292 int32_t target_offset = 291 int32_t target_offset =
293 static_cast<int32_t>(DistanceTo(target) >> kInstructionSizeLog2); 292 static_cast<int32_t>(DistanceTo(target) >> kInstructionSizeLog2);
294 uint32_t high16 = unsigned_bitextract_32(31, 16, target_offset); 293 uint32_t high16 = unsigned_bitextract_32(31, 16, target_offset);
295 uint32_t low16 = unsigned_bitextract_32(15, 0, target_offset); 294 uint32_t low16 = unsigned_bitextract_32(15, 0, target_offset);
296 295
297 PatchingAssembler patcher(isolate, this, 2); 296 PatchingAssembler patcher(isolate_data, reinterpret_cast<byte*>(this), 2);
298 patcher.brk(high16); 297 patcher.brk(high16);
299 patcher.brk(low16); 298 patcher.brk(low16);
300 } 299 }
301 300
302 301
303 void Instruction::SetImmLLiteral(Instruction* source) { 302 void Instruction::SetImmLLiteral(Instruction* source) {
304 DCHECK(IsLdrLiteral()); 303 DCHECK(IsLdrLiteral());
305 DCHECK(IsAligned(DistanceTo(source), kInstructionSize)); 304 DCHECK(IsAligned(DistanceTo(source), kInstructionSize));
306 DCHECK(Assembler::IsImmLLiteral(DistanceTo(source))); 305 DCHECK(Assembler::IsImmLLiteral(DistanceTo(source)));
307 Instr imm = Assembler::ImmLLiteral( 306 Instr imm = Assembler::ImmLLiteral(
(...skipping 25 matching lines...) Expand all
333 // 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
334 // to update this method too. 333 // to update this method too.
335 return payload; 334 return payload;
336 } 335 }
337 336
338 337
339 } // namespace internal 338 } // namespace internal
340 } // namespace v8 339 } // namespace v8
341 340
342 #endif // V8_TARGET_ARCH_ARM64 341 #endif // V8_TARGET_ARCH_ARM64
OLDNEW
« no previous file with comments | « src/arm64/instructions-arm64.h ('k') | src/arm64/macro-assembler-arm64.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698