Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(76)

Side by Side Diff: src/base/atomicops_internals_x86_gcc.cc

Issue 331803006: Partial revert of r21901 (2nd attempt) (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/base/atomicops_internals_x86_gcc.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 24 matching lines...) Expand all
35 #if defined(cpuid) // initialize the struct only on x86 35 #if defined(cpuid) // initialize the struct only on x86
36 36
37 namespace v8 { 37 namespace v8 {
38 namespace base { 38 namespace base {
39 39
40 // Set the flags so that code will run correctly and conservatively, so even 40 // Set the flags so that code will run correctly and conservatively, so even
41 // if we haven't been initialized yet, we're probably single threaded, and our 41 // if we haven't been initialized yet, we're probably single threaded, and our
42 // default values should hopefully be pretty safe. 42 // default values should hopefully be pretty safe.
43 struct AtomicOps_x86CPUFeatureStruct AtomicOps_Internalx86CPUFeatures = { 43 struct AtomicOps_x86CPUFeatureStruct AtomicOps_Internalx86CPUFeatures = {
44 false, // bug can't exist before process spawns multiple threads 44 false, // bug can't exist before process spawns multiple threads
45 #if !defined(__SSE2__)
46 false, // no SSE2
47 #endif
45 }; 48 };
46 49
47 } } // namespace v8::base 50 } } // namespace v8::base
48 51
49 namespace { 52 namespace {
50 53
51 // Initialize the AtomicOps_Internalx86CPUFeatures struct. 54 // Initialize the AtomicOps_Internalx86CPUFeatures struct.
52 void AtomicOps_Internalx86CPUFeaturesInit() { 55 void AtomicOps_Internalx86CPUFeaturesInit() {
53 using v8::base::AtomicOps_Internalx86CPUFeatures; 56 using v8::base::AtomicOps_Internalx86CPUFeatures;
54 57
(...skipping 25 matching lines...) Expand all
80 // non-locked read-modify-write instruction. Rev F has this bug in 83 // non-locked read-modify-write instruction. Rev F has this bug in
81 // pre-release versions, but not in versions released to customers, 84 // pre-release versions, but not in versions released to customers,
82 // so we test only for Rev E, which is family 15, model 32..63 inclusive. 85 // so we test only for Rev E, which is family 15, model 32..63 inclusive.
83 if (strcmp(vendor, "AuthenticAMD") == 0 && // AMD 86 if (strcmp(vendor, "AuthenticAMD") == 0 && // AMD
84 family == 15 && 87 family == 15 &&
85 32 <= model && model <= 63) { 88 32 <= model && model <= 63) {
86 AtomicOps_Internalx86CPUFeatures.has_amd_lock_mb_bug = true; 89 AtomicOps_Internalx86CPUFeatures.has_amd_lock_mb_bug = true;
87 } else { 90 } else {
88 AtomicOps_Internalx86CPUFeatures.has_amd_lock_mb_bug = false; 91 AtomicOps_Internalx86CPUFeatures.has_amd_lock_mb_bug = false;
89 } 92 }
93
94 #if !defined(__SSE2__)
95 // edx bit 26 is SSE2 which we use to tell use whether we can use mfence
96 AtomicOps_Internalx86CPUFeatures.has_sse2 = ((edx >> 26) & 1);
97 #endif
90 } 98 }
91 99
92 class AtomicOpsx86Initializer { 100 class AtomicOpsx86Initializer {
93 public: 101 public:
94 AtomicOpsx86Initializer() { 102 AtomicOpsx86Initializer() {
95 AtomicOps_Internalx86CPUFeaturesInit(); 103 AtomicOps_Internalx86CPUFeaturesInit();
96 } 104 }
97 }; 105 };
98 106
99 107
100 // A global to get use initialized on startup via static initialization :/ 108 // A global to get use initialized on startup via static initialization :/
101 AtomicOpsx86Initializer g_initer; 109 AtomicOpsx86Initializer g_initer;
102 110
103 } // namespace 111 } // namespace
104 112
105 #endif // if x86 113 #endif // if x86
106 114
107 #endif // ifdef V8_BASE_ATOMICOPS_INTERNALS_X86_GCC_H_ 115 #endif // ifdef V8_BASE_ATOMICOPS_INTERNALS_X86_GCC_H_
OLDNEW
« no previous file with comments | « src/base/atomicops_internals_x86_gcc.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698