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_CPU_ARM64_H_ | 5 #ifndef V8_ARM64_CPU_ARM64_H_ |
6 #define V8_ARM64_CPU_ARM64_H_ | 6 #define V8_ARM64_CPU_ARM64_H_ |
7 | 7 |
8 #include <stdio.h> | 8 #include <stdio.h> |
9 #include "serialize.h" | 9 #include "serialize.h" |
10 #include "cpu.h" | 10 #include "cpu.h" |
11 | 11 |
12 namespace v8 { | 12 namespace v8 { |
13 namespace internal { | 13 namespace internal { |
14 | 14 |
15 | 15 |
16 // CpuFeatures keeps track of which features are supported by the target CPU. | 16 // CpuFeatures keeps track of which features are supported by the target CPU. |
17 // Supported features must be enabled by a CpuFeatureScope before use. | 17 // Supported features must be enabled by a CpuFeatureScope before use. |
18 class CpuFeatures : public AllStatic { | 18 class CpuFeatures : public AllStatic { |
19 public: | 19 public: |
20 // Detect features of the target CPU. Set safe defaults if the serializer | 20 // Detect features of the target CPU. Set safe defaults if the serializer |
21 // is enabled (snapshots must be portable). | 21 // is enabled (snapshots must be portable). |
22 static void Probe(bool serializer_enabled); | 22 static void Probe(bool serializer_enabled); |
23 | 23 |
24 // Check whether a feature is supported by the target CPU. | 24 // Check whether a feature is supported by the target CPU. |
25 static bool IsSupported(CpuFeature f) { | 25 static bool IsSupported(CpuFeature f) { |
26 ASSERT(initialized_); | 26 ASSERT(initialized_); |
27 return Check(f, supported_); | 27 // There are no optional features for ARM64. |
| 28 return false; |
28 }; | 29 }; |
29 | 30 |
| 31 // There are no optional features for ARM64. |
30 static bool IsSafeForSnapshot(Isolate* isolate, CpuFeature f) { | 32 static bool IsSafeForSnapshot(Isolate* isolate, CpuFeature f) { |
31 return IsSupported(f); | 33 return IsSupported(f); |
32 } | 34 } |
33 | 35 |
34 // I and D cache line size in bytes. | 36 // I and D cache line size in bytes. |
35 static unsigned dcache_line_size(); | 37 static unsigned dcache_line_size(); |
36 static unsigned icache_line_size(); | 38 static unsigned icache_line_size(); |
37 | 39 |
38 static unsigned supported_; | 40 static unsigned supported_; |
39 | 41 |
40 static bool VerifyCrossCompiling() { | 42 static bool VerifyCrossCompiling() { |
41 return cross_compile_ == 0; | 43 // There are no optional features for ARM64. |
| 44 ASSERT(cross_compile_ == 0); |
| 45 return true; |
42 } | 46 } |
43 | 47 |
44 static bool VerifyCrossCompiling(CpuFeature f) { | 48 static bool VerifyCrossCompiling(CpuFeature f) { |
45 unsigned mask = flag2set(f); | 49 // There are no optional features for ARM64. |
46 return cross_compile_ == 0 || | 50 USE(f); |
47 (cross_compile_ & mask) == mask; | 51 ASSERT(cross_compile_ == 0); |
| 52 return true; |
48 } | 53 } |
49 | 54 |
50 static bool SupportsCrankshaft() { return true; } | 55 static bool SupportsCrankshaft() { return true; } |
51 | 56 |
52 private: | 57 private: |
53 #ifdef DEBUG | 58 #ifdef DEBUG |
54 static bool initialized_; | 59 static bool initialized_; |
55 #endif | 60 #endif |
56 | 61 |
57 static unsigned found_by_runtime_probing_only_; | 62 // This isn't used (and is always 0), but it is required by V8. |
58 static unsigned cross_compile_; | 63 static unsigned cross_compile_; |
59 | 64 |
60 static bool Check(CpuFeature f, unsigned set) { | |
61 return (set & flag2set(f)) != 0; | |
62 } | |
63 | |
64 static unsigned flag2set(CpuFeature f) { | |
65 return 1u << f; | |
66 } | |
67 | |
68 friend class PlatformFeatureScope; | 65 friend class PlatformFeatureScope; |
69 DISALLOW_COPY_AND_ASSIGN(CpuFeatures); | 66 DISALLOW_COPY_AND_ASSIGN(CpuFeatures); |
70 }; | 67 }; |
71 | 68 |
72 } } // namespace v8::internal | 69 } } // namespace v8::internal |
73 | 70 |
74 #endif // V8_ARM64_CPU_ARM64_H_ | 71 #endif // V8_ARM64_CPU_ARM64_H_ |
OLD | NEW |