| OLD | NEW |
| 1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 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 // This module gets enough CPU information to optimize the | 5 // This module gets enough CPU information to optimize the |
| 6 // atomicops module on x86. | 6 // atomicops module on x86. |
| 7 | 7 |
| 8 #include <string.h> | 8 #include <string.h> |
| 9 | 9 |
| 10 #include "src/base/atomicops.h" | 10 #include "src/base/atomicops.h" |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 // non-locked read-modify-write instruction. Rev F has this bug in | 81 // non-locked read-modify-write instruction. Rev F has this bug in |
| 82 // pre-release versions, but not in versions released to customers, | 82 // pre-release versions, but not in versions released to customers, |
| 83 // so we test only for Rev E, which is family 15, model 32..63 inclusive. | 83 // so we test only for Rev E, which is family 15, model 32..63 inclusive. |
| 84 if (strcmp(vendor, "AuthenticAMD") == 0 && // AMD | 84 if (strcmp(vendor, "AuthenticAMD") == 0 && // AMD |
| 85 family == 15 && | 85 family == 15 && |
| 86 32 <= model && model <= 63) { | 86 32 <= model && model <= 63) { |
| 87 AtomicOps_Internalx86CPUFeatures.has_amd_lock_mb_bug = true; | 87 AtomicOps_Internalx86CPUFeatures.has_amd_lock_mb_bug = true; |
| 88 } else { | 88 } else { |
| 89 AtomicOps_Internalx86CPUFeatures.has_amd_lock_mb_bug = false; | 89 AtomicOps_Internalx86CPUFeatures.has_amd_lock_mb_bug = false; |
| 90 } | 90 } |
| 91 | 91 #if !defined(__SSE2__) |
| 92 // edx bit 26 is SSE2 which we use to tell use whether we can use mfence | 92 // edx bit 26 is SSE2 which we use to tell use whether we can use mfence |
| 93 AtomicOps_Internalx86CPUFeatures.has_sse2 = ((edx >> 26) & 1); | 93 AtomicOps_Internalx86CPUFeatures.has_sse2 = ((edx >> 26) & 1); |
| 94 #endif |
| 94 } | 95 } |
| 95 | 96 |
| 96 class AtomicOpsx86Initializer { | 97 class AtomicOpsx86Initializer { |
| 97 public: | 98 public: |
| 98 AtomicOpsx86Initializer() { | 99 AtomicOpsx86Initializer() { |
| 99 AtomicOps_Internalx86CPUFeaturesInit(); | 100 AtomicOps_Internalx86CPUFeaturesInit(); |
| 100 } | 101 } |
| 101 }; | 102 }; |
| 102 | 103 |
| 103 | 104 |
| 104 // A global to get use initialized on startup via static initialization :/ | 105 // A global to get use initialized on startup via static initialization :/ |
| 105 AtomicOpsx86Initializer g_initer; | 106 AtomicOpsx86Initializer g_initer; |
| 106 | 107 |
| 107 } // namespace | 108 } // namespace |
| 108 | 109 |
| 109 #endif // if x86 | 110 #endif // if x86 |
| 110 | 111 |
| 111 #endif // ifdef V8_BASE_ATOMICOPS_INTERNALS_X86_GCC_H_ | 112 #endif // ifdef V8_BASE_ATOMICOPS_INTERNALS_X86_GCC_H_ |
| OLD | NEW |