OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 the V8 project authors. All rights reserved. |
2 // | 2 // |
3 // Redistribution and use in source and binary forms, with or without | 3 // Redistribution and use in source and binary forms, with or without |
4 // modification, are permitted provided that the following conditions are | 4 // modification, are permitted provided that the following conditions are |
5 // met: | 5 // met: |
6 // | 6 // |
7 // * Redistributions of source code must retain the above copyright | 7 // * Redistributions of source code must retain the above copyright |
8 // notice, this list of conditions and the following disclaimer. | 8 // notice, this list of conditions and the following disclaimer. |
9 // * Redistributions in binary form must reproduce the above | 9 // * Redistributions in binary form must reproduce the above |
10 // copyright notice, this list of conditions and the following | 10 // copyright notice, this list of conditions and the following |
(...skipping 10 matching lines...) Expand all Loading... |
21 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | 21 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
22 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | 22 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
23 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 23 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
24 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 24 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
25 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 25 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
26 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 26 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
27 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 27 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
28 | 28 |
29 #include "v8.h" | 29 #include "v8.h" |
30 | 30 |
31 #if V8_TARGET_ARCH_A64 | 31 #if V8_TARGET_ARCH_ARM64 |
32 | 32 |
33 #define A64_DEFINE_REG_STATICS | 33 #define ARM64_DEFINE_REG_STATICS |
34 | 34 |
35 #include "a64/assembler-a64-inl.h" | 35 #include "arm64/assembler-arm64-inl.h" |
36 | 36 |
37 namespace v8 { | 37 namespace v8 { |
38 namespace internal { | 38 namespace internal { |
39 | 39 |
40 | 40 |
41 // ----------------------------------------------------------------------------- | 41 // ----------------------------------------------------------------------------- |
42 // CpuFeatures utilities (for V8 compatibility). | 42 // CpuFeatures utilities (for V8 compatibility). |
43 | 43 |
44 ExternalReference ExternalReference::cpu_features() { | 44 ExternalReference ExternalReference::cpu_features() { |
45 return ExternalReference(&CpuFeatures::supported_); | 45 return ExternalReference(&CpuFeatures::supported_); |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
148 | 148 |
149 | 149 |
150 // ----------------------------------------------------------------------------- | 150 // ----------------------------------------------------------------------------- |
151 // Implementation of RelocInfo | 151 // Implementation of RelocInfo |
152 | 152 |
153 const int RelocInfo::kApplyMask = 0; | 153 const int RelocInfo::kApplyMask = 0; |
154 | 154 |
155 | 155 |
156 bool RelocInfo::IsCodedSpecially() { | 156 bool RelocInfo::IsCodedSpecially() { |
157 // The deserializer needs to know whether a pointer is specially coded. Being | 157 // The deserializer needs to know whether a pointer is specially coded. Being |
158 // specially coded on A64 means that it is a movz/movk sequence. We don't | 158 // specially coded on ARM64 means that it is a movz/movk sequence. We don't |
159 // generate those for relocatable pointers. | 159 // generate those for relocatable pointers. |
160 return false; | 160 return false; |
161 } | 161 } |
162 | 162 |
163 | 163 |
164 bool RelocInfo::IsInConstantPool() { | 164 bool RelocInfo::IsInConstantPool() { |
165 Instruction* instr = reinterpret_cast<Instruction*>(pc_); | 165 Instruction* instr = reinterpret_cast<Instruction*>(pc_); |
166 return instr->IsLdrLiteralX(); | 166 return instr->IsLdrLiteralX(); |
167 } | 167 } |
168 | 168 |
(...skipping 1768 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1937 #ifdef DEBUG | 1937 #ifdef DEBUG |
1938 Serializer::TooLateToEnableNow(); | 1938 Serializer::TooLateToEnableNow(); |
1939 #endif | 1939 #endif |
1940 // The arguments to the debug marker need to be contiguous in memory, so | 1940 // The arguments to the debug marker need to be contiguous in memory, so |
1941 // make sure we don't try to emit pools. | 1941 // make sure we don't try to emit pools. |
1942 BlockPoolsScope scope(this); | 1942 BlockPoolsScope scope(this); |
1943 | 1943 |
1944 Label start; | 1944 Label start; |
1945 bind(&start); | 1945 bind(&start); |
1946 | 1946 |
1947 // Refer to instructions-a64.h for a description of the marker and its | 1947 // Refer to instructions-arm64.h for a description of the marker and its |
1948 // arguments. | 1948 // arguments. |
1949 hlt(kImmExceptionIsDebug); | 1949 hlt(kImmExceptionIsDebug); |
1950 ASSERT(SizeOfCodeGeneratedSince(&start) == kDebugCodeOffset); | 1950 ASSERT(SizeOfCodeGeneratedSince(&start) == kDebugCodeOffset); |
1951 dc32(code); | 1951 dc32(code); |
1952 ASSERT(SizeOfCodeGeneratedSince(&start) == kDebugParamsOffset); | 1952 ASSERT(SizeOfCodeGeneratedSince(&start) == kDebugParamsOffset); |
1953 dc32(params); | 1953 dc32(params); |
1954 ASSERT(SizeOfCodeGeneratedSince(&start) == kDebugMessageOffset); | 1954 ASSERT(SizeOfCodeGeneratedSince(&start) == kDebugMessageOffset); |
1955 EmitStringData(message); | 1955 EmitStringData(message); |
1956 hlt(kImmExceptionIsUnreachable); | 1956 hlt(kImmExceptionIsUnreachable); |
1957 | 1957 |
(...skipping 629 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2587 // Emit jump over constant pool if necessary. | 2587 // Emit jump over constant pool if necessary. |
2588 Label after_pool; | 2588 Label after_pool; |
2589 if (require_jump) { | 2589 if (require_jump) { |
2590 b(&after_pool); | 2590 b(&after_pool); |
2591 } | 2591 } |
2592 | 2592 |
2593 // Emit a constant pool header. The header has two goals: | 2593 // Emit a constant pool header. The header has two goals: |
2594 // 1) Encode the size of the constant pool, for use by the disassembler. | 2594 // 1) Encode the size of the constant pool, for use by the disassembler. |
2595 // 2) Terminate the program, to try to prevent execution from accidentally | 2595 // 2) Terminate the program, to try to prevent execution from accidentally |
2596 // flowing into the constant pool. | 2596 // flowing into the constant pool. |
2597 // The header is therefore made of two a64 instructions: | 2597 // The header is therefore made of two arm64 instructions: |
2598 // ldr xzr, #<size of the constant pool in 32-bit words> | 2598 // ldr xzr, #<size of the constant pool in 32-bit words> |
2599 // blr xzr | 2599 // blr xzr |
2600 // If executed the code will likely segfault and lr will point to the | 2600 // If executed the code will likely segfault and lr will point to the |
2601 // beginning of the constant pool. | 2601 // beginning of the constant pool. |
2602 // TODO(all): currently each relocated constant is 64 bits, consider adding | 2602 // TODO(all): currently each relocated constant is 64 bits, consider adding |
2603 // support for 32-bit entries. | 2603 // support for 32-bit entries. |
2604 ConstantPoolMarker(2 * num_pending_reloc_info_); | 2604 ConstantPoolMarker(2 * num_pending_reloc_info_); |
2605 ConstantPoolGuard(); | 2605 ConstantPoolGuard(); |
2606 | 2606 |
2607 // Emit constant pool entries. | 2607 // Emit constant pool entries. |
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2803 | 2803 |
2804 | 2804 |
2805 void Assembler::PopulateConstantPool(ConstantPoolArray* constant_pool) { | 2805 void Assembler::PopulateConstantPool(ConstantPoolArray* constant_pool) { |
2806 // No out-of-line constant pool support. | 2806 // No out-of-line constant pool support. |
2807 UNREACHABLE(); | 2807 UNREACHABLE(); |
2808 } | 2808 } |
2809 | 2809 |
2810 | 2810 |
2811 } } // namespace v8::internal | 2811 } } // namespace v8::internal |
2812 | 2812 |
2813 #endif // V8_TARGET_ARCH_A64 | 2813 #endif // V8_TARGET_ARCH_ARM64 |
OLD | NEW |