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 "globals.h" | 8 #include "globals.h" |
9 #include "utils.h" | 9 #include "utils.h" |
10 #include "arm64/constants-arm64.h" | 10 #include "arm64/constants-arm64.h" |
(...skipping 398 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
409 // Indicate to the Debugger that the instruction is a redirected call. | 409 // Indicate to the Debugger that the instruction is a redirected call. |
410 const Instr kImmExceptionIsRedirectedCall = 0xca11; | 410 const Instr kImmExceptionIsRedirectedCall = 0xca11; |
411 | 411 |
412 // Represent unreachable code. This is used as a guard in parts of the code that | 412 // Represent unreachable code. This is used as a guard in parts of the code that |
413 // should not be reachable, such as in data encoded inline in the instructions. | 413 // should not be reachable, such as in data encoded inline in the instructions. |
414 const Instr kImmExceptionIsUnreachable = 0xdebf; | 414 const Instr kImmExceptionIsUnreachable = 0xdebf; |
415 | 415 |
416 // A pseudo 'printf' instruction. The arguments will be passed to the platform | 416 // A pseudo 'printf' instruction. The arguments will be passed to the platform |
417 // printf method. | 417 // printf method. |
418 const Instr kImmExceptionIsPrintf = 0xdeb1; | 418 const Instr kImmExceptionIsPrintf = 0xdeb1; |
419 // Parameters are stored in ARM64 registers as if the printf pseudo-instruction | 419 // Most parameters are stored in ARM64 registers as if the printf |
420 // was a call to the real printf method: | 420 // pseudo-instruction was a call to the real printf method: |
421 // | 421 // x0: The format string. |
422 // x0: The format string, then either of: | |
423 // x1-x7: Optional arguments. | 422 // x1-x7: Optional arguments. |
424 // d0-d7: Optional arguments. | 423 // d0-d7: Optional arguments. |
425 // | 424 // |
426 // Floating-point and integer arguments are passed in separate sets of | 425 // Also, the argument layout is described inline in the instructions: |
427 // registers in AAPCS64 (even for varargs functions), so it is not possible to | 426 // - arg_count: The number of arguments. |
428 // determine the type of location of each arguments without some information | 427 // - arg_pattern: A set of PrintfArgPattern values, packed into two-bit fields. |
429 // about the values that were passed in. This information could be retrieved | 428 // |
430 // from the printf format string, but the format string is not trivial to | 429 // Floating-point and integer arguments are passed in separate sets of registers |
431 // parse so we encode the relevant information with the HLT instruction. | 430 // in AAPCS64 (even for varargs functions), so it is not possible to determine |
432 // - Type | 431 // the type of each argument without some information about the values that were |
433 // Either kRegister or kFPRegister, but stored as a uint32_t because there's | 432 // passed in. This information could be retrieved from the printf format string, |
434 // no way to guarantee the size of the CPURegister::RegisterType enum. | 433 // but the format string is not trivial to parse so we encode the relevant |
435 const unsigned kPrintfTypeOffset = 1 * kInstructionSize; | 434 // information with the HLT instruction. |
436 const unsigned kPrintfLength = 2 * kInstructionSize; | 435 const unsigned kPrintfArgCountOffset = 1 * kInstructionSize; |
| 436 const unsigned kPrintfArgPatternListOffset = 2 * kInstructionSize; |
| 437 const unsigned kPrintfLength = 3 * kInstructionSize; |
| 438 |
| 439 const unsigned kPrintfMaxArgCount = 4; |
| 440 |
| 441 // The argument pattern is a set of two-bit-fields, each with one of the |
| 442 // following values: |
| 443 enum PrintfArgPattern { |
| 444 kPrintfArgW = 1, |
| 445 kPrintfArgX = 2, |
| 446 // There is no kPrintfArgS because floats are always converted to doubles in C |
| 447 // varargs calls. |
| 448 kPrintfArgD = 3 |
| 449 }; |
| 450 static const unsigned kPrintfArgPatternBits = 2; |
437 | 451 |
438 // A pseudo 'debug' instruction. | 452 // A pseudo 'debug' instruction. |
439 const Instr kImmExceptionIsDebug = 0xdeb0; | 453 const Instr kImmExceptionIsDebug = 0xdeb0; |
440 // Parameters are inlined in the code after a debug pseudo-instruction: | 454 // Parameters are inlined in the code after a debug pseudo-instruction: |
441 // - Debug code. | 455 // - Debug code. |
442 // - Debug parameters. | 456 // - Debug parameters. |
443 // - Debug message string. This is a NULL-terminated ASCII string, padded to | 457 // - Debug message string. This is a NULL-terminated ASCII string, padded to |
444 // kInstructionSize so that subsequent instructions are correctly aligned. | 458 // kInstructionSize so that subsequent instructions are correctly aligned. |
445 // - A kImmExceptionIsUnreachable marker, to catch accidental execution of the | 459 // - A kImmExceptionIsUnreachable marker, to catch accidental execution of the |
446 // string data. | 460 // string data. |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
486 TRACE_ENABLE = 1 << 6, | 500 TRACE_ENABLE = 1 << 6, |
487 TRACE_DISABLE = 2 << 6, | 501 TRACE_DISABLE = 2 << 6, |
488 TRACE_OVERRIDE = 3 << 6 | 502 TRACE_OVERRIDE = 3 << 6 |
489 }; | 503 }; |
490 | 504 |
491 | 505 |
492 } } // namespace v8::internal | 506 } } // namespace v8::internal |
493 | 507 |
494 | 508 |
495 #endif // V8_ARM64_INSTRUCTIONS_ARM64_H_ | 509 #endif // V8_ARM64_INSTRUCTIONS_ARM64_H_ |
OLD | NEW |