| OLD | NEW |
| 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 #ifndef V8_ARM64_INSTRUCTIONS_ARM64_H_ | 5 #ifndef V8_ARM64_INSTRUCTIONS_ARM64_H_ |
| 6 #define V8_ARM64_INSTRUCTIONS_ARM64_H_ | 6 #define V8_ARM64_INSTRUCTIONS_ARM64_H_ |
| 7 | 7 |
| 8 #include "src/arm64/constants-arm64.h" | 8 #include "src/arm64/constants-arm64.h" |
| 9 #include "src/arm64/utils-arm64.h" | 9 #include "src/arm64/utils-arm64.h" |
| 10 #include "src/assembler.h" |
| 10 #include "src/globals.h" | 11 #include "src/globals.h" |
| 11 #include "src/utils.h" | 12 #include "src/utils.h" |
| 12 | 13 |
| 13 namespace v8 { | 14 namespace v8 { |
| 14 namespace internal { | 15 namespace internal { |
| 15 | 16 |
| 16 | |
| 17 // ISA constants. -------------------------------------------------------------- | 17 // ISA constants. -------------------------------------------------------------- |
| 18 | 18 |
| 19 typedef uint32_t Instr; | 19 typedef uint32_t Instr; |
| 20 | 20 |
| 21 // The following macros initialize a float/double variable with a bit pattern | 21 // The following macros initialize a float/double variable with a bit pattern |
| 22 // without using static initializers: If ARM64_DEFINE_FP_STATICS is defined, the | 22 // without using static initializers: If ARM64_DEFINE_FP_STATICS is defined, the |
| 23 // symbol is defined as uint32_t/uint64_t initialized with the desired bit | 23 // symbol is defined as uint32_t/uint64_t initialized with the desired bit |
| 24 // pattern. Otherwise, the same symbol is declared as an external float/double. | 24 // pattern. Otherwise, the same symbol is declared as an external float/double. |
| 25 #if defined(ARM64_DEFINE_FP_STATICS) | 25 #if defined(ARM64_DEFINE_FP_STATICS) |
| 26 #define DEFINE_FLOAT(name, value) extern const uint32_t name = value | 26 #define DEFINE_FLOAT(name, value) extern const uint32_t name = value |
| (...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 366 int64_t ImmPCOffset(); | 366 int64_t ImmPCOffset(); |
| 367 | 367 |
| 368 // Find the target of this instruction. 'this' may be a branch or a | 368 // Find the target of this instruction. 'this' may be a branch or a |
| 369 // PC-relative addressing instruction. | 369 // PC-relative addressing instruction. |
| 370 Instruction* ImmPCOffsetTarget(); | 370 Instruction* ImmPCOffsetTarget(); |
| 371 | 371 |
| 372 static bool IsValidImmPCOffset(ImmBranchType branch_type, ptrdiff_t offset); | 372 static bool IsValidImmPCOffset(ImmBranchType branch_type, ptrdiff_t offset); |
| 373 bool IsTargetInImmPCOffsetRange(Instruction* target); | 373 bool IsTargetInImmPCOffsetRange(Instruction* target); |
| 374 // Patch a PC-relative offset to refer to 'target'. 'this' may be a branch or | 374 // Patch a PC-relative offset to refer to 'target'. 'this' may be a branch or |
| 375 // a PC-relative addressing instruction. | 375 // a PC-relative addressing instruction. |
| 376 void SetImmPCOffsetTarget(Isolate* isolate, Instruction* target); | 376 void SetImmPCOffsetTarget(AssemblerBase::IsolateData isolate_data, |
| 377 void SetUnresolvedInternalReferenceImmTarget(Isolate* isolate, | 377 Instruction* target); |
| 378 void SetUnresolvedInternalReferenceImmTarget(AssemblerBase::IsolateData, |
| 378 Instruction* target); | 379 Instruction* target); |
| 379 // Patch a literal load instruction to load from 'source'. | 380 // Patch a literal load instruction to load from 'source'. |
| 380 void SetImmLLiteral(Instruction* source); | 381 void SetImmLLiteral(Instruction* source); |
| 381 | 382 |
| 382 uintptr_t LiteralAddress() { | 383 uintptr_t LiteralAddress() { |
| 383 int offset = ImmLLiteral() << kLoadLiteralScaleLog2; | 384 int offset = ImmLLiteral() << kLoadLiteralScaleLog2; |
| 384 return reinterpret_cast<uintptr_t>(this) + offset; | 385 return reinterpret_cast<uintptr_t>(this) + offset; |
| 385 } | 386 } |
| 386 | 387 |
| 387 enum CheckAlignment { NO_CHECK, CHECK_ALIGNMENT }; | 388 enum CheckAlignment { NO_CHECK, CHECK_ALIGNMENT }; |
| (...skipping 16 matching lines...) Expand all Loading... |
| 404 return reinterpret_cast<Instruction*>(src); | 405 return reinterpret_cast<Instruction*>(src); |
| 405 } | 406 } |
| 406 | 407 |
| 407 V8_INLINE ptrdiff_t DistanceTo(Instruction* target) { | 408 V8_INLINE ptrdiff_t DistanceTo(Instruction* target) { |
| 408 return reinterpret_cast<Address>(target) - reinterpret_cast<Address>(this); | 409 return reinterpret_cast<Address>(target) - reinterpret_cast<Address>(this); |
| 409 } | 410 } |
| 410 | 411 |
| 411 | 412 |
| 412 static const int ImmPCRelRangeBitwidth = 21; | 413 static const int ImmPCRelRangeBitwidth = 21; |
| 413 static bool IsValidPCRelOffset(ptrdiff_t offset) { return is_int21(offset); } | 414 static bool IsValidPCRelOffset(ptrdiff_t offset) { return is_int21(offset); } |
| 414 void SetPCRelImmTarget(Isolate* isolate, Instruction* target); | 415 void SetPCRelImmTarget(AssemblerBase::IsolateData isolate_data, |
| 416 Instruction* target); |
| 415 void SetBranchImmTarget(Instruction* target); | 417 void SetBranchImmTarget(Instruction* target); |
| 416 }; | 418 }; |
| 417 | 419 |
| 418 | 420 |
| 419 // Where Instruction looks at instructions generated by the Assembler, | 421 // Where Instruction looks at instructions generated by the Assembler, |
| 420 // InstructionSequence looks at instructions sequences generated by the | 422 // InstructionSequence looks at instructions sequences generated by the |
| 421 // MacroAssembler. | 423 // MacroAssembler. |
| 422 class InstructionSequence : public Instruction { | 424 class InstructionSequence : public Instruction { |
| 423 public: | 425 public: |
| 424 static InstructionSequence* At(Address address) { | 426 static InstructionSequence* At(Address address) { |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 531 TRACE_DISABLE = 2 << 6, | 533 TRACE_DISABLE = 2 << 6, |
| 532 TRACE_OVERRIDE = 3 << 6 | 534 TRACE_OVERRIDE = 3 << 6 |
| 533 }; | 535 }; |
| 534 | 536 |
| 535 | 537 |
| 536 } // namespace internal | 538 } // namespace internal |
| 537 } // namespace v8 | 539 } // namespace v8 |
| 538 | 540 |
| 539 | 541 |
| 540 #endif // V8_ARM64_INSTRUCTIONS_ARM64_H_ | 542 #endif // V8_ARM64_INSTRUCTIONS_ARM64_H_ |
| OLD | NEW |