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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 if (f == VFP32DREGS && !FLAG_enable_32dregs) return false; | 67 if (f == VFP32DREGS && !FLAG_enable_32dregs) return false; |
68 return (supported_ & (1u << f)) != 0; | 68 return (supported_ & (1u << f)) != 0; |
69 } | 69 } |
70 | 70 |
71 static bool IsFoundByRuntimeProbingOnly(CpuFeature f) { | 71 static bool IsFoundByRuntimeProbingOnly(CpuFeature f) { |
72 ASSERT(initialized_); | 72 ASSERT(initialized_); |
73 return (found_by_runtime_probing_only_ & | 73 return (found_by_runtime_probing_only_ & |
74 (static_cast<uint64_t>(1) << f)) != 0; | 74 (static_cast<uint64_t>(1) << f)) != 0; |
75 } | 75 } |
76 | 76 |
77 class TryForceFeatureScope BASE_EMBEDDED { | 77 static bool IsSafeForSnapshot(CpuFeature f) { |
78 public: | 78 return (IsSupported(f) && |
79 explicit TryForceFeatureScope(CpuFeature f) | 79 (!Serializer::enabled() || !IsFoundByRuntimeProbingOnly(f))); |
80 : old_supported_(CpuFeatures::supported_) { | 80 } |
81 if (CanForce()) { | |
82 CpuFeatures::supported_ |= (1u << f); | |
83 } | |
84 } | |
85 | |
86 ~TryForceFeatureScope() { | |
87 if (CanForce()) { | |
88 CpuFeatures::supported_ = old_supported_; | |
89 } | |
90 } | |
91 | |
92 private: | |
93 static bool CanForce() { | |
94 // It's only safe to temporarily force support of CPU features | |
95 // when there's only a single isolate, which is guaranteed when | |
96 // the serializer is enabled. | |
97 return Serializer::enabled(); | |
98 } | |
99 | |
100 const unsigned old_supported_; | |
101 }; | |
102 | 81 |
103 private: | 82 private: |
104 #ifdef DEBUG | 83 #ifdef DEBUG |
105 static bool initialized_; | 84 static bool initialized_; |
106 #endif | 85 #endif |
107 static unsigned supported_; | 86 static unsigned supported_; |
108 static unsigned found_by_runtime_probing_only_; | 87 static unsigned found_by_runtime_probing_only_; |
109 | 88 |
110 friend class ExternalReference; | 89 friend class ExternalReference; |
111 DISALLOW_COPY_AND_ASSIGN(CpuFeatures); | 90 DISALLOW_COPY_AND_ASSIGN(CpuFeatures); |
(...skipping 1352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1464 public: | 1443 public: |
1465 explicit EnsureSpace(Assembler* assembler) { | 1444 explicit EnsureSpace(Assembler* assembler) { |
1466 assembler->CheckBuffer(); | 1445 assembler->CheckBuffer(); |
1467 } | 1446 } |
1468 }; | 1447 }; |
1469 | 1448 |
1470 | 1449 |
1471 } } // namespace v8::internal | 1450 } } // namespace v8::internal |
1472 | 1451 |
1473 #endif // V8_ARM_ASSEMBLER_ARM_H_ | 1452 #endif // V8_ARM_ASSEMBLER_ARM_H_ |
OLD | NEW |