| 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 |
| 11 // with the distribution. | 11 // with the distribution. |
| 12 // * Neither the name of Google Inc. nor the names of its | 12 // * Neither the name of Google Inc. nor the names of its |
| 13 // contributors may be used to endorse or promote products derived | 13 // contributors may be used to endorse or promote products derived |
| 14 // from this software without specific prior written permission. | 14 // from this software without specific prior written permission. |
| 15 // | 15 // |
| 16 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | 16 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
| 17 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | 17 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
| 18 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | 18 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
| 19 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | 19 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
| 20 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | 20 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
| 21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | 21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| 22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 27 | 27 |
| 28 #ifndef V8_A64_ASSEMBLER_A64_H_ | 28 #ifndef V8_ARM64_ASSEMBLER_ARM64_H_ |
| 29 #define V8_A64_ASSEMBLER_A64_H_ | 29 #define V8_ARM64_ASSEMBLER_ARM64_H_ |
| 30 | 30 |
| 31 #include <list> | 31 #include <list> |
| 32 #include <map> | 32 #include <map> |
| 33 | 33 |
| 34 #include "globals.h" | 34 #include "globals.h" |
| 35 #include "utils.h" | 35 #include "utils.h" |
| 36 #include "assembler.h" | 36 #include "assembler.h" |
| 37 #include "serialize.h" | 37 #include "serialize.h" |
| 38 #include "a64/instructions-a64.h" | 38 #include "arm64/instructions-arm64.h" |
| 39 #include "a64/cpu-a64.h" | 39 #include "arm64/cpu-arm64.h" |
| 40 | 40 |
| 41 | 41 |
| 42 namespace v8 { | 42 namespace v8 { |
| 43 namespace internal { | 43 namespace internal { |
| 44 | 44 |
| 45 | 45 |
| 46 // ----------------------------------------------------------------------------- | 46 // ----------------------------------------------------------------------------- |
| 47 // Registers. | 47 // Registers. |
| 48 #define REGISTER_CODE_LIST(R) \ | 48 #define REGISTER_CODE_LIST(R) \ |
| 49 R(0) R(1) R(2) R(3) R(4) R(5) R(6) R(7) \ | 49 R(0) R(1) R(2) R(3) R(4) R(5) R(6) R(7) \ |
| (...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 325 return FPRegister::Create(code, kDRegSizeInBits); | 325 return FPRegister::Create(code, kDRegSizeInBits); |
| 326 } | 326 } |
| 327 // End of V8 compatibility section ----------------------- | 327 // End of V8 compatibility section ----------------------- |
| 328 }; | 328 }; |
| 329 | 329 |
| 330 | 330 |
| 331 STATIC_ASSERT(sizeof(CPURegister) == sizeof(Register)); | 331 STATIC_ASSERT(sizeof(CPURegister) == sizeof(Register)); |
| 332 STATIC_ASSERT(sizeof(CPURegister) == sizeof(FPRegister)); | 332 STATIC_ASSERT(sizeof(CPURegister) == sizeof(FPRegister)); |
| 333 | 333 |
| 334 | 334 |
| 335 #if defined(A64_DEFINE_REG_STATICS) | 335 #if defined(ARM64_DEFINE_REG_STATICS) |
| 336 #define INITIALIZE_REGISTER(register_class, name, code, size, type) \ | 336 #define INITIALIZE_REGISTER(register_class, name, code, size, type) \ |
| 337 const CPURegister init_##register_class##_##name = {code, size, type}; \ | 337 const CPURegister init_##register_class##_##name = {code, size, type}; \ |
| 338 const register_class& name = *reinterpret_cast<const register_class*>( \ | 338 const register_class& name = *reinterpret_cast<const register_class*>( \ |
| 339 &init_##register_class##_##name) | 339 &init_##register_class##_##name) |
| 340 #define ALIAS_REGISTER(register_class, alias, name) \ | 340 #define ALIAS_REGISTER(register_class, alias, name) \ |
| 341 const register_class& alias = *reinterpret_cast<const register_class*>( \ | 341 const register_class& alias = *reinterpret_cast<const register_class*>( \ |
| 342 &init_##register_class##_##name) | 342 &init_##register_class##_##name) |
| 343 #else | 343 #else |
| 344 #define INITIALIZE_REGISTER(register_class, name, code, size, type) \ | 344 #define INITIALIZE_REGISTER(register_class, name, code, size, type) \ |
| 345 extern const register_class& name | 345 extern const register_class& name |
| 346 #define ALIAS_REGISTER(register_class, alias, name) \ | 346 #define ALIAS_REGISTER(register_class, alias, name) \ |
| 347 extern const register_class& alias | 347 extern const register_class& alias |
| 348 #endif // defined(A64_DEFINE_REG_STATICS) | 348 #endif // defined(ARM64_DEFINE_REG_STATICS) |
| 349 | 349 |
| 350 // No*Reg is used to indicate an unused argument, or an error case. Note that | 350 // No*Reg is used to indicate an unused argument, or an error case. Note that |
| 351 // these all compare equal (using the Is() method). The Register and FPRegister | 351 // these all compare equal (using the Is() method). The Register and FPRegister |
| 352 // variants are provided for convenience. | 352 // variants are provided for convenience. |
| 353 INITIALIZE_REGISTER(Register, NoReg, 0, 0, CPURegister::kNoRegister); | 353 INITIALIZE_REGISTER(Register, NoReg, 0, 0, CPURegister::kNoRegister); |
| 354 INITIALIZE_REGISTER(FPRegister, NoFPReg, 0, 0, CPURegister::kNoRegister); | 354 INITIALIZE_REGISTER(FPRegister, NoFPReg, 0, 0, CPURegister::kNoRegister); |
| 355 INITIALIZE_REGISTER(CPURegister, NoCPUReg, 0, 0, CPURegister::kNoRegister); | 355 INITIALIZE_REGISTER(CPURegister, NoCPUReg, 0, 0, CPURegister::kNoRegister); |
| 356 | 356 |
| 357 // v8 compatibility. | 357 // v8 compatibility. |
| 358 INITIALIZE_REGISTER(Register, no_reg, 0, 0, CPURegister::kNoRegister); | 358 INITIALIZE_REGISTER(Register, no_reg, 0, 0, CPURegister::kNoRegister); |
| (...skipping 1297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1656 EmitData(string, len); | 1656 EmitData(string, len); |
| 1657 // Pad with NULL characters until pc_ is aligned. | 1657 // Pad with NULL characters until pc_ is aligned. |
| 1658 const char pad[] = {'\0', '\0', '\0', '\0'}; | 1658 const char pad[] = {'\0', '\0', '\0', '\0'}; |
| 1659 STATIC_ASSERT(sizeof(pad) == kInstructionSize); | 1659 STATIC_ASSERT(sizeof(pad) == kInstructionSize); |
| 1660 byte* next_pc = AlignUp(pc_, kInstructionSize); | 1660 byte* next_pc = AlignUp(pc_, kInstructionSize); |
| 1661 EmitData(&pad, next_pc - pc_); | 1661 EmitData(&pad, next_pc - pc_); |
| 1662 } | 1662 } |
| 1663 | 1663 |
| 1664 // Pseudo-instructions ------------------------------------------------------ | 1664 // Pseudo-instructions ------------------------------------------------------ |
| 1665 | 1665 |
| 1666 // Parameters are described in a64/instructions-a64.h. | 1666 // Parameters are described in arm64/instructions-arm64.h. |
| 1667 void debug(const char* message, uint32_t code, Instr params = BREAK); | 1667 void debug(const char* message, uint32_t code, Instr params = BREAK); |
| 1668 | 1668 |
| 1669 // Required by V8. | 1669 // Required by V8. |
| 1670 void dd(uint32_t data) { dc32(data); } | 1670 void dd(uint32_t data) { dc32(data); } |
| 1671 void db(uint8_t data) { dc8(data); } | 1671 void db(uint8_t data) { dc8(data); } |
| 1672 | 1672 |
| 1673 // Code generation helpers -------------------------------------------------- | 1673 // Code generation helpers -------------------------------------------------- |
| 1674 | 1674 |
| 1675 unsigned num_pending_reloc_info() const { return num_pending_reloc_info_; } | 1675 unsigned num_pending_reloc_info() const { return num_pending_reloc_info_; } |
| 1676 | 1676 |
| (...skipping 536 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2213 | 2213 |
| 2214 class EnsureSpace BASE_EMBEDDED { | 2214 class EnsureSpace BASE_EMBEDDED { |
| 2215 public: | 2215 public: |
| 2216 explicit EnsureSpace(Assembler* assembler) { | 2216 explicit EnsureSpace(Assembler* assembler) { |
| 2217 assembler->CheckBuffer(); | 2217 assembler->CheckBuffer(); |
| 2218 } | 2218 } |
| 2219 }; | 2219 }; |
| 2220 | 2220 |
| 2221 } } // namespace v8::internal | 2221 } } // namespace v8::internal |
| 2222 | 2222 |
| 2223 #endif // V8_A64_ASSEMBLER_A64_H_ | 2223 #endif // V8_ARM64_ASSEMBLER_ARM64_H_ |
| OLD | NEW |