OLD | NEW |
1 // Copyright (c) 1994-2006 Sun Microsystems Inc. | 1 // Copyright (c) 1994-2006 Sun Microsystems Inc. |
2 // All Rights Reserved. | 2 // All Rights Reserved. |
3 // | 3 // |
4 // Redistribution and use in source and binary forms, with or without | 4 // Redistribution and use in source and binary forms, with or without |
5 // modification, are permitted provided that the following conditions | 5 // modification, are permitted provided that the following conditions |
6 // are met: | 6 // are met: |
7 // | 7 // |
8 // - Redistributions of source code must retain the above copyright notice, | 8 // - Redistributions of source code must retain the above copyright notice, |
9 // this list of conditions and the following disclaimer. | 9 // this list of conditions and the following disclaimer. |
10 // | 10 // |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 | 57 |
58 // Display target use when compiling. | 58 // Display target use when compiling. |
59 static void PrintTarget(); | 59 static void PrintTarget(); |
60 | 60 |
61 // Display features. | 61 // Display features. |
62 static void PrintFeatures(); | 62 static void PrintFeatures(); |
63 | 63 |
64 // Check whether a feature is supported by the target CPU. | 64 // Check whether a feature is supported by the target CPU. |
65 static bool IsSupported(CpuFeature f) { | 65 static bool IsSupported(CpuFeature f) { |
66 ASSERT(initialized_); | 66 ASSERT(initialized_); |
67 return (supported_ & (1u << f)) != 0; | 67 return Check(f, supported_); |
68 } | 68 } |
69 | 69 |
70 static bool IsFoundByRuntimeProbingOnly(CpuFeature f) { | 70 static bool IsFoundByRuntimeProbingOnly(CpuFeature f) { |
71 ASSERT(initialized_); | 71 ASSERT(initialized_); |
72 return (found_by_runtime_probing_only_ & | 72 return Check(f, found_by_runtime_probing_only_); |
73 (static_cast<uint64_t>(1) << f)) != 0; | |
74 } | 73 } |
75 | 74 |
76 static bool IsSafeForSnapshot(CpuFeature f) { | 75 static bool IsSafeForSnapshot(CpuFeature f) { |
77 return (IsSupported(f) && | 76 return Check(f, cross_compile_) || |
| 77 (IsSupported(f) && |
78 (!Serializer::enabled() || !IsFoundByRuntimeProbingOnly(f))); | 78 (!Serializer::enabled() || !IsFoundByRuntimeProbingOnly(f))); |
79 } | 79 } |
80 | 80 |
81 static unsigned cache_line_size() { return cache_line_size_; } | 81 static unsigned cache_line_size() { return cache_line_size_; } |
82 | 82 |
| 83 static bool VerifyCrossCompiling() { |
| 84 return cross_compile_ == 0; |
| 85 } |
| 86 |
| 87 static bool VerifyCrossCompiling(CpuFeature f) { |
| 88 unsigned mask = flag2set(f); |
| 89 return cross_compile_ == 0 || |
| 90 (cross_compile_ & mask) == mask; |
| 91 } |
| 92 |
83 private: | 93 private: |
| 94 static bool Check(CpuFeature f, unsigned set) { |
| 95 return (set & flag2set(f)) != 0; |
| 96 } |
| 97 |
| 98 static unsigned flag2set(CpuFeature f) { |
| 99 return 1u << f; |
| 100 } |
| 101 |
84 #ifdef DEBUG | 102 #ifdef DEBUG |
85 static bool initialized_; | 103 static bool initialized_; |
86 #endif | 104 #endif |
87 static unsigned supported_; | 105 static unsigned supported_; |
88 static unsigned found_by_runtime_probing_only_; | 106 static unsigned found_by_runtime_probing_only_; |
89 static unsigned cache_line_size_; | 107 static unsigned cache_line_size_; |
90 | 108 |
| 109 static unsigned cross_compile_; |
| 110 |
91 friend class ExternalReference; | 111 friend class ExternalReference; |
92 friend class PlatformFeatureScope; | 112 friend class PlatformFeatureScope; |
93 DISALLOW_COPY_AND_ASSIGN(CpuFeatures); | 113 DISALLOW_COPY_AND_ASSIGN(CpuFeatures); |
94 }; | 114 }; |
95 | 115 |
96 | 116 |
97 // CPU Registers. | 117 // CPU Registers. |
98 // | 118 // |
99 // 1) We would prefer to use an enum, but enum values are assignment- | 119 // 1) We would prefer to use an enum, but enum values are assignment- |
100 // compatible with int, which has caused code-generation bugs. | 120 // compatible with int, which has caused code-generation bugs. |
(...skipping 1487 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1588 public: | 1608 public: |
1589 explicit EnsureSpace(Assembler* assembler) { | 1609 explicit EnsureSpace(Assembler* assembler) { |
1590 assembler->CheckBuffer(); | 1610 assembler->CheckBuffer(); |
1591 } | 1611 } |
1592 }; | 1612 }; |
1593 | 1613 |
1594 | 1614 |
1595 } } // namespace v8::internal | 1615 } } // namespace v8::internal |
1596 | 1616 |
1597 #endif // V8_ARM_ASSEMBLER_ARM_H_ | 1617 #endif // V8_ARM_ASSEMBLER_ARM_H_ |
OLD | NEW |