| OLD | NEW |
| 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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 | 60 |
| 61 // This value is a signalling NaN as both a double and as a float (taking the | 61 // This value is a signalling NaN as both a double and as a float (taking the |
| 62 // least-significant word). | 62 // least-significant word). |
| 63 DEFINE_DOUBLE(kFP64SignallingNaN, 0x7ff000007f800001); | 63 DEFINE_DOUBLE(kFP64SignallingNaN, 0x7ff000007f800001); |
| 64 DEFINE_FLOAT(kFP32SignallingNaN, 0x7f800001); | 64 DEFINE_FLOAT(kFP32SignallingNaN, 0x7f800001); |
| 65 | 65 |
| 66 // A similar value, but as a quiet NaN. | 66 // A similar value, but as a quiet NaN. |
| 67 DEFINE_DOUBLE(kFP64QuietNaN, 0x7ff800007fc00001); | 67 DEFINE_DOUBLE(kFP64QuietNaN, 0x7ff800007fc00001); |
| 68 DEFINE_FLOAT(kFP32QuietNaN, 0x7fc00001); | 68 DEFINE_FLOAT(kFP32QuietNaN, 0x7fc00001); |
| 69 | 69 |
| 70 // The default NaN values (for FPCR.DN=1). |
| 71 DEFINE_DOUBLE(kFP64DefaultNaN, 0x7ff8000000000000UL); |
| 72 DEFINE_FLOAT(kFP32DefaultNaN, 0x7fc00000); |
| 73 |
| 70 #undef DEFINE_FLOAT | 74 #undef DEFINE_FLOAT |
| 71 #undef DEFINE_DOUBLE | 75 #undef DEFINE_DOUBLE |
| 72 | 76 |
| 73 | 77 |
| 74 enum LSDataSize { | 78 enum LSDataSize { |
| 75 LSByte = 0, | 79 LSByte = 0, |
| 76 LSHalfword = 1, | 80 LSHalfword = 1, |
| 77 LSWord = 2, | 81 LSWord = 2, |
| 78 LSDoubleWord = 3 | 82 LSDoubleWord = 3 |
| 79 }; | 83 }; |
| (...skipping 28 matching lines...) Expand all Loading... |
| 108 | 112 |
| 109 enum Reg31Mode { | 113 enum Reg31Mode { |
| 110 Reg31IsStackPointer, | 114 Reg31IsStackPointer, |
| 111 Reg31IsZeroRegister | 115 Reg31IsZeroRegister |
| 112 }; | 116 }; |
| 113 | 117 |
| 114 // Instructions. --------------------------------------------------------------- | 118 // Instructions. --------------------------------------------------------------- |
| 115 | 119 |
| 116 class Instruction { | 120 class Instruction { |
| 117 public: | 121 public: |
| 118 Instr InstructionBits() const { | 122 V8_INLINE Instr InstructionBits() const { |
| 119 Instr bits; | 123 return *reinterpret_cast<const Instr*>(this); |
| 120 memcpy(&bits, this, sizeof(bits)); | |
| 121 return bits; | |
| 122 } | 124 } |
| 123 | 125 |
| 124 void SetInstructionBits(Instr new_instr) { | 126 V8_INLINE void SetInstructionBits(Instr new_instr) { |
| 125 memcpy(this, &new_instr, sizeof(new_instr)); | 127 *reinterpret_cast<Instr*>(this) = new_instr; |
| 126 } | 128 } |
| 127 | 129 |
| 128 int Bit(int pos) const { | 130 int Bit(int pos) const { |
| 129 return (InstructionBits() >> pos) & 1; | 131 return (InstructionBits() >> pos) & 1; |
| 130 } | 132 } |
| 131 | 133 |
| 132 uint32_t Bits(int msb, int lsb) const { | 134 uint32_t Bits(int msb, int lsb) const { |
| 133 return unsigned_bitextract_32(msb, lsb, InstructionBits()); | 135 return unsigned_bitextract_32(msb, lsb, InstructionBits()); |
| 134 } | 136 } |
| 135 | 137 |
| (...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 358 // a PC-relative addressing instruction. | 360 // a PC-relative addressing instruction. |
| 359 void SetImmPCOffsetTarget(Instruction* target); | 361 void SetImmPCOffsetTarget(Instruction* target); |
| 360 // Patch a literal load instruction to load from 'source'. | 362 // Patch a literal load instruction to load from 'source'. |
| 361 void SetImmLLiteral(Instruction* source); | 363 void SetImmLLiteral(Instruction* source); |
| 362 | 364 |
| 363 uint8_t* LiteralAddress() { | 365 uint8_t* LiteralAddress() { |
| 364 int offset = ImmLLiteral() << kLiteralEntrySizeLog2; | 366 int offset = ImmLLiteral() << kLiteralEntrySizeLog2; |
| 365 return reinterpret_cast<uint8_t*>(this) + offset; | 367 return reinterpret_cast<uint8_t*>(this) + offset; |
| 366 } | 368 } |
| 367 | 369 |
| 368 uint32_t Literal32() { | |
| 369 uint32_t literal; | |
| 370 memcpy(&literal, LiteralAddress(), sizeof(literal)); | |
| 371 | |
| 372 return literal; | |
| 373 } | |
| 374 | |
| 375 uint64_t Literal64() { | |
| 376 uint64_t literal; | |
| 377 memcpy(&literal, LiteralAddress(), sizeof(literal)); | |
| 378 | |
| 379 return literal; | |
| 380 } | |
| 381 | |
| 382 float LiteralFP32() { | |
| 383 return rawbits_to_float(Literal32()); | |
| 384 } | |
| 385 | |
| 386 double LiteralFP64() { | |
| 387 return rawbits_to_double(Literal64()); | |
| 388 } | |
| 389 | |
| 390 Instruction* NextInstruction() { | 370 Instruction* NextInstruction() { |
| 391 return this + kInstructionSize; | 371 return this + kInstructionSize; |
| 392 } | 372 } |
| 393 | 373 |
| 394 Instruction* InstructionAtOffset(int64_t offset) { | 374 Instruction* InstructionAtOffset(int64_t offset) { |
| 395 ASSERT(IsAligned(reinterpret_cast<uintptr_t>(this) + offset, | 375 ASSERT(IsAligned(reinterpret_cast<uintptr_t>(this) + offset, |
| 396 kInstructionSize)); | 376 kInstructionSize)); |
| 397 return this + offset; | 377 return this + offset; |
| 398 } | 378 } |
| 399 | 379 |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 507 TRACE_ENABLE = 1 << 6, | 487 TRACE_ENABLE = 1 << 6, |
| 508 TRACE_DISABLE = 2 << 6, | 488 TRACE_DISABLE = 2 << 6, |
| 509 TRACE_OVERRIDE = 3 << 6 | 489 TRACE_OVERRIDE = 3 << 6 |
| 510 }; | 490 }; |
| 511 | 491 |
| 512 | 492 |
| 513 } } // namespace v8::internal | 493 } } // namespace v8::internal |
| 514 | 494 |
| 515 | 495 |
| 516 #endif // V8_A64_INSTRUCTIONS_A64_H_ | 496 #endif // V8_A64_INSTRUCTIONS_A64_H_ |
| OLD | NEW |