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_MACRO_ASSEMBLER_ARM64_H_ | 5 #ifndef V8_ARM64_MACRO_ASSEMBLER_ARM64_H_ |
6 #define V8_ARM64_MACRO_ASSEMBLER_ARM64_H_ | 6 #define V8_ARM64_MACRO_ASSEMBLER_ARM64_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "v8globals.h" | 10 #include "v8globals.h" |
(...skipping 700 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
711 // it will be encoded in the event marker. | 711 // it will be encoded in the event marker. |
712 inline void AnnotateInstrumentation(const char* marker_name); | 712 inline void AnnotateInstrumentation(const char* marker_name); |
713 | 713 |
714 // If emit_debug_code() is true, emit a run-time check to ensure that | 714 // If emit_debug_code() is true, emit a run-time check to ensure that |
715 // StackPointer() does not point below the system stack pointer. | 715 // StackPointer() does not point below the system stack pointer. |
716 // | 716 // |
717 // Whilst it is architecturally legal for StackPointer() to point below csp, | 717 // Whilst it is architecturally legal for StackPointer() to point below csp, |
718 // it can be evidence of a potential bug because the ABI forbids accesses | 718 // it can be evidence of a potential bug because the ABI forbids accesses |
719 // below csp. | 719 // below csp. |
720 // | 720 // |
721 // If StackPointer() is the system stack pointer (csp), or csp_was_modified is | |
722 // true and ALWAYS_ALIGN_CSP is enabled, then csp will be dereferenced to | |
723 // cause the processor (or simulator) to abort if it is not properly aligned. | |
724 // | |
721 // If emit_debug_code() is false, this emits no code. | 725 // If emit_debug_code() is false, this emits no code. |
722 // | 726 void AssertStackConsistency(bool csp_was_modified); |
ulan
2014/05/08 08:18:43
Nit: we usually pass flags as enums with descripti
| |
723 // If StackPointer() is the system stack pointer, this emits no code. | |
724 void AssertStackConsistency(); | |
725 | 727 |
726 // Preserve the callee-saved registers (as defined by AAPCS64). | 728 // Preserve the callee-saved registers (as defined by AAPCS64). |
727 // | 729 // |
728 // Higher-numbered registers are pushed before lower-numbered registers, and | 730 // Higher-numbered registers are pushed before lower-numbered registers, and |
729 // thus get higher addresses. | 731 // thus get higher addresses. |
730 // Floating-point registers are pushed before general-purpose registers, and | 732 // Floating-point registers are pushed before general-purpose registers, and |
731 // thus get higher addresses. | 733 // thus get higher addresses. |
732 // | 734 // |
733 // Note that registers are not checked for invalid values. Use this method | 735 // Note that registers are not checked for invalid values. Use this method |
734 // only if you know that the GC won't try to examine the values on the stack. | 736 // only if you know that the GC won't try to examine the values on the stack. |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
771 Bic(csp, StackPointer(), sp_alignment - 1); | 773 Bic(csp, StackPointer(), sp_alignment - 1); |
772 SetStackPointer(csp); | 774 SetStackPointer(csp); |
773 } | 775 } |
774 | 776 |
775 // Push the system stack pointer (csp) down to allow the same to be done to | 777 // Push the system stack pointer (csp) down to allow the same to be done to |
776 // the current stack pointer (according to StackPointer()). This must be | 778 // the current stack pointer (according to StackPointer()). This must be |
777 // called _before_ accessing the memory. | 779 // called _before_ accessing the memory. |
778 // | 780 // |
779 // This is necessary when pushing or otherwise adding things to the stack, to | 781 // This is necessary when pushing or otherwise adding things to the stack, to |
780 // satisfy the AAPCS64 constraint that the memory below the system stack | 782 // satisfy the AAPCS64 constraint that the memory below the system stack |
781 // pointer is not accessed. | 783 // pointer is not accessed. The amount pushed will be increased as necessary |
784 // to ensure csp remains aligned to 16 bytes. | |
782 // | 785 // |
783 // This method asserts that StackPointer() is not csp, since the call does | 786 // This method asserts that StackPointer() is not csp, since the call does |
784 // not make sense in that context. | 787 // not make sense in that context. |
785 inline void BumpSystemStackPointer(const Operand& space); | 788 inline void BumpSystemStackPointer(const Operand& space); |
786 | 789 |
790 // Re-synchronizes the system stack pointer (csp) with the current stack | |
791 // pointer (according to StackPointer()). This function will ensure the | |
792 // new value of the system stack pointer is remains aligned to 16 bytes, and | |
793 // is lower than or equal to the value of the current stack pointer. | |
794 // | |
795 // This method asserts that StackPointer() is not csp, since the call does | |
796 // not make sense in that context. | |
797 inline void SyncSystemStackPointer(); | |
798 | |
787 // Helpers ------------------------------------------------------------------ | 799 // Helpers ------------------------------------------------------------------ |
788 // Root register. | 800 // Root register. |
789 inline void InitializeRootRegister(); | 801 inline void InitializeRootRegister(); |
790 | 802 |
791 void AssertFPCRState(Register fpcr = NoReg); | 803 void AssertFPCRState(Register fpcr = NoReg); |
792 void ConfigureFPCR(); | 804 void ConfigureFPCR(); |
793 void CanonicalizeNaN(const FPRegister& dst, const FPRegister& src); | 805 void CanonicalizeNaN(const FPRegister& dst, const FPRegister& src); |
794 void CanonicalizeNaN(const FPRegister& reg) { | 806 void CanonicalizeNaN(const FPRegister& reg) { |
795 CanonicalizeNaN(reg, reg); | 807 CanonicalizeNaN(reg, reg); |
796 } | 808 } |
(...skipping 1216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2013 // block of registers. | 2025 // block of registers. |
2014 // | 2026 // |
2015 // Note that size is per register, and is specified in bytes. | 2027 // Note that size is per register, and is specified in bytes. |
2016 void PushHelper(int count, int size, | 2028 void PushHelper(int count, int size, |
2017 const CPURegister& src0, const CPURegister& src1, | 2029 const CPURegister& src0, const CPURegister& src1, |
2018 const CPURegister& src2, const CPURegister& src3); | 2030 const CPURegister& src2, const CPURegister& src3); |
2019 void PopHelper(int count, int size, | 2031 void PopHelper(int count, int size, |
2020 const CPURegister& dst0, const CPURegister& dst1, | 2032 const CPURegister& dst0, const CPURegister& dst1, |
2021 const CPURegister& dst2, const CPURegister& dst3); | 2033 const CPURegister& dst2, const CPURegister& dst3); |
2022 | 2034 |
2023 // Perform necessary maintenance operations before a push or pop. | 2035 // Perform necessary maintenance operations before a push or after a pop. |
2024 // | 2036 // |
2025 // Note that size is specified in bytes. | 2037 // Note that size is specified in bytes. |
2026 void PrepareForPush(Operand total_size); | 2038 void PushPreamble(Operand total_size); |
2027 void PrepareForPop(Operand total_size); | 2039 void PopPostamble(Operand total_size); |
2028 | 2040 |
2029 void PrepareForPush(int count, int size) { PrepareForPush(count * size); } | 2041 void PushPreamble(int count, int size) { PushPreamble(count * size); } |
2030 void PrepareForPop(int count, int size) { PrepareForPop(count * size); } | 2042 void PopPostamble(int count, int size) { PopPostamble(count * size); } |
2031 | 2043 |
2032 // Call Printf. On a native build, a simple call will be generated, but if the | 2044 // Call Printf. On a native build, a simple call will be generated, but if the |
2033 // simulator is being used then a suitable pseudo-instruction is used. The | 2045 // simulator is being used then a suitable pseudo-instruction is used. The |
2034 // arguments and stack (csp) must be prepared by the caller as for a normal | 2046 // arguments and stack (csp) must be prepared by the caller as for a normal |
2035 // AAPCS64 call to 'printf'. | 2047 // AAPCS64 call to 'printf'. |
2036 // | 2048 // |
2037 // The 'type' argument specifies the type of the optional arguments. | 2049 // The 'type' argument specifies the type of the optional arguments. |
2038 void CallPrintf(CPURegister::RegisterType type = CPURegister::kNoRegister); | 2050 void CallPrintf(CPURegister::RegisterType type = CPURegister::kNoRegister); |
2039 | 2051 |
2040 // Helper for throwing exceptions. Compute a handler address and jump to | 2052 // Helper for throwing exceptions. Compute a handler address and jump to |
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2284 #error "Unsupported option" | 2296 #error "Unsupported option" |
2285 #define CODE_COVERAGE_STRINGIFY(x) #x | 2297 #define CODE_COVERAGE_STRINGIFY(x) #x |
2286 #define CODE_COVERAGE_TOSTRING(x) CODE_COVERAGE_STRINGIFY(x) | 2298 #define CODE_COVERAGE_TOSTRING(x) CODE_COVERAGE_STRINGIFY(x) |
2287 #define __FILE_LINE__ __FILE__ ":" CODE_COVERAGE_TOSTRING(__LINE__) | 2299 #define __FILE_LINE__ __FILE__ ":" CODE_COVERAGE_TOSTRING(__LINE__) |
2288 #define ACCESS_MASM(masm) masm->stop(__FILE_LINE__); masm-> | 2300 #define ACCESS_MASM(masm) masm->stop(__FILE_LINE__); masm-> |
2289 #else | 2301 #else |
2290 #define ACCESS_MASM(masm) masm-> | 2302 #define ACCESS_MASM(masm) masm-> |
2291 #endif | 2303 #endif |
2292 | 2304 |
2293 #endif // V8_ARM64_MACRO_ASSEMBLER_ARM64_H_ | 2305 #endif // V8_ARM64_MACRO_ASSEMBLER_ARM64_H_ |
OLD | NEW |