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

Side by Side Diff: src/atomicops.h

Issue 129813008: Atomic ops: sync with Chromium. (Closed) Base URL: git://github.com/v8/v8.git@master
Patch Set: Resolve a conflict with the new ARM64 code Created 6 years, 10 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
« no previous file with comments | « no previous file | src/atomicops_internals_arm_gcc.h » ('j') | 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 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 // Although there are currently no compiler enforcement, you are encouraged 44 // Although there are currently no compiler enforcement, you are encouraged
45 // to use these. 45 // to use these.
46 // 46 //
47 47
48 #ifndef V8_ATOMICOPS_H_ 48 #ifndef V8_ATOMICOPS_H_
49 #define V8_ATOMICOPS_H_ 49 #define V8_ATOMICOPS_H_
50 50
51 #include "../include/v8.h" 51 #include "../include/v8.h"
52 #include "globals.h" 52 #include "globals.h"
53 53
54 #if defined(_WIN32) && defined(V8_HOST_ARCH_64_BIT)
55 // windows.h #defines this (only on x64). This causes problems because the
56 // public API also uses MemoryBarrier at the public name for this fence. So, on
57 // X64, undef it, and call its documented
58 // (http://msdn.microsoft.com/en-us/library/windows/desktop/ms684208.aspx)
59 // implementation directly.
60 #undef MemoryBarrier
61 #endif
62
54 namespace v8 { 63 namespace v8 {
55 namespace internal { 64 namespace internal {
56 65
57 typedef int32_t Atomic32; 66 typedef int32_t Atomic32;
58 #ifdef V8_HOST_ARCH_64_BIT 67 #ifdef V8_HOST_ARCH_64_BIT
59 // We need to be able to go between Atomic64 and AtomicWord implicitly. This 68 // We need to be able to go between Atomic64 and AtomicWord implicitly. This
60 // means Atomic64 and AtomicWord should be the same type on 64-bit. 69 // means Atomic64 and AtomicWord should be the same type on 64-bit.
61 #if defined(__ILP32__) || defined(__APPLE__) 70 #if defined(__ILP32__)
62 // MacOS is an exception to the implicit conversion rule above,
63 // because it uses long for intptr_t.
64 typedef int64_t Atomic64; 71 typedef int64_t Atomic64;
65 #else 72 #else
66 typedef intptr_t Atomic64; 73 typedef intptr_t Atomic64;
67 #endif 74 #endif
68 #endif 75 #endif
69 76
70 // Use AtomicWord for a machine-sized pointer. It will use the Atomic32 or 77 // Use AtomicWord for a machine-sized pointer. It will use the Atomic32 or
71 // Atomic64 routines below, depending on your architecture. 78 // Atomic64 routines below, depending on your architecture.
72 #if defined(__OpenBSD__) && defined(__i386__)
73 typedef Atomic32 AtomicWord;
74 #else
75 typedef intptr_t AtomicWord; 79 typedef intptr_t AtomicWord;
76 #endif
77 80
78 // Atomically execute: 81 // Atomically execute:
79 // result = *ptr; 82 // result = *ptr;
80 // if (*ptr == old_value) 83 // if (*ptr == old_value)
81 // *ptr = new_value; 84 // *ptr = new_value;
82 // return result; 85 // return result;
83 // 86 //
84 // I.e., replace "*ptr" with "new_value" if "*ptr" used to be "old_value". 87 // I.e., replace "*ptr" with "new_value" if "*ptr" used to be "old_value".
85 // Always return the old value of "*ptr" 88 // Always return the old value of "*ptr"
86 // 89 //
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 Atomic64 Release_Load(volatile const Atomic64* ptr); 151 Atomic64 Release_Load(volatile const Atomic64* ptr);
149 #endif // V8_HOST_ARCH_64_BIT 152 #endif // V8_HOST_ARCH_64_BIT
150 153
151 } } // namespace v8::internal 154 } } // namespace v8::internal
152 155
153 // Include our platform specific implementation. 156 // Include our platform specific implementation.
154 #if defined(THREAD_SANITIZER) 157 #if defined(THREAD_SANITIZER)
155 #include "atomicops_internals_tsan.h" 158 #include "atomicops_internals_tsan.h"
156 #elif defined(_MSC_VER) && (V8_HOST_ARCH_IA32 || V8_HOST_ARCH_X64) 159 #elif defined(_MSC_VER) && (V8_HOST_ARCH_IA32 || V8_HOST_ARCH_X64)
157 #include "atomicops_internals_x86_msvc.h" 160 #include "atomicops_internals_x86_msvc.h"
158 #elif defined(__APPLE__) && (V8_HOST_ARCH_IA32 || V8_HOST_ARCH_X64) 161 #elif defined(__APPLE__)
159 #include "atomicops_internals_x86_macosx.h" 162 #include "atomicops_internals_mac.h"
160 #elif defined(__GNUC__) && (V8_HOST_ARCH_IA32 || V8_HOST_ARCH_X64)
161 #include "atomicops_internals_x86_gcc.h"
162 #elif defined(__GNUC__) && V8_HOST_ARCH_A64 163 #elif defined(__GNUC__) && V8_HOST_ARCH_A64
163 #include "atomicops_internals_a64_gcc.h" 164 #include "atomicops_internals_a64_gcc.h"
164 #elif defined(__GNUC__) && V8_HOST_ARCH_ARM 165 #elif defined(__GNUC__) && V8_HOST_ARCH_ARM
165 #include "atomicops_internals_arm_gcc.h" 166 #include "atomicops_internals_arm_gcc.h"
167 #elif defined(__GNUC__) && (V8_HOST_ARCH_IA32 || V8_HOST_ARCH_X64)
168 #include "atomicops_internals_x86_gcc.h"
166 #elif defined(__GNUC__) && V8_HOST_ARCH_MIPS 169 #elif defined(__GNUC__) && V8_HOST_ARCH_MIPS
167 #include "atomicops_internals_mips_gcc.h" 170 #include "atomicops_internals_mips_gcc.h"
168 #else 171 #else
169 #error "Atomic operations are not supported on your platform" 172 #error "Atomic operations are not supported on your platform"
170 #endif 173 #endif
171 174
175 // On some platforms we need additional declarations to make
176 // AtomicWord compatible with our other Atomic* types.
177 #if defined(__APPLE__) || defined(__OpenBSD__)
178 #include "atomicops_internals_atomicword_compat.h"
179 #endif
180
172 #endif // V8_ATOMICOPS_H_ 181 #endif // V8_ATOMICOPS_H_
OLDNEW
« no previous file with comments | « no previous file | src/atomicops_internals_arm_gcc.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698