OLD | NEW |
1 /* Copyright (c) 2006, Google Inc. | 1 /* Copyright (c) 2006, Google 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 are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 22 matching lines...) Expand all Loading... |
33 | 33 |
34 // Implementation of atomic operations using Windows API | 34 // Implementation of atomic operations using Windows API |
35 // functions. This file should not be included directly. Clients | 35 // functions. This file should not be included directly. Clients |
36 // should instead include "base/atomicops.h". | 36 // should instead include "base/atomicops.h". |
37 | 37 |
38 #ifndef BASE_ATOMICOPS_INTERNALS_WINDOWS_H_ | 38 #ifndef BASE_ATOMICOPS_INTERNALS_WINDOWS_H_ |
39 #define BASE_ATOMICOPS_INTERNALS_WINDOWS_H_ | 39 #define BASE_ATOMICOPS_INTERNALS_WINDOWS_H_ |
40 | 40 |
41 #include <stdio.h> | 41 #include <stdio.h> |
42 #include <stdlib.h> | 42 #include <stdlib.h> |
| 43 #include "base/abort.h" |
43 #include "base/basictypes.h" // For COMPILE_ASSERT | 44 #include "base/basictypes.h" // For COMPILE_ASSERT |
44 | 45 |
45 typedef int32 Atomic32; | 46 typedef int32 Atomic32; |
46 | 47 |
47 #if defined(_WIN64) | 48 #if defined(_WIN64) |
48 #define BASE_HAS_ATOMIC64 1 // Use only in tests and base/atomic* | 49 #define BASE_HAS_ATOMIC64 1 // Use only in tests and base/atomic* |
49 #endif | 50 #endif |
50 | 51 |
51 namespace base { | 52 namespace base { |
52 namespace subtle { | 53 namespace subtle { |
(...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
343 #else // defined(_WIN64) || defined(__MINGW64__) | 344 #else // defined(_WIN64) || defined(__MINGW64__) |
344 | 345 |
345 // 64-bit low-level operations on 32-bit platform | 346 // 64-bit low-level operations on 32-bit platform |
346 | 347 |
347 // TODO(vchen): The GNU assembly below must be converted to MSVC inline | 348 // TODO(vchen): The GNU assembly below must be converted to MSVC inline |
348 // assembly. Then the file should be renamed to ...-x86-msvc.h, probably. | 349 // assembly. Then the file should be renamed to ...-x86-msvc.h, probably. |
349 | 350 |
350 inline void NotImplementedFatalError(const char *function_name) { | 351 inline void NotImplementedFatalError(const char *function_name) { |
351 fprintf(stderr, "64-bit %s() not implemented on this platform\n", | 352 fprintf(stderr, "64-bit %s() not implemented on this platform\n", |
352 function_name); | 353 function_name); |
353 abort(); | 354 tcmalloc::Abort(); |
354 } | 355 } |
355 | 356 |
356 inline Atomic64 NoBarrier_CompareAndSwap(volatile Atomic64* ptr, | 357 inline Atomic64 NoBarrier_CompareAndSwap(volatile Atomic64* ptr, |
357 Atomic64 old_value, | 358 Atomic64 old_value, |
358 Atomic64 new_value) { | 359 Atomic64 new_value) { |
359 #if 0 // Not implemented | 360 #if 0 // Not implemented |
360 Atomic64 prev; | 361 Atomic64 prev; |
361 __asm__ __volatile__("movl (%3), %%ebx\n\t" // Move 64-bit new_value into | 362 __asm__ __volatile__("movl (%3), %%ebx\n\t" // Move 64-bit new_value into |
362 "movl 4(%3), %%ecx\n\t" // ecx:ebx | 363 "movl 4(%3), %%ecx\n\t" // ecx:ebx |
363 "lock; cmpxchg8b %1\n\t" // If edx:eax (old_value) same | 364 "lock; cmpxchg8b %1\n\t" // If edx:eax (old_value) same |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
492 inline Atomic64 Release_CompareAndSwap(volatile Atomic64* ptr, | 493 inline Atomic64 Release_CompareAndSwap(volatile Atomic64* ptr, |
493 Atomic64 old_value, | 494 Atomic64 old_value, |
494 Atomic64 new_value) { | 495 Atomic64 new_value) { |
495 return NoBarrier_CompareAndSwap(ptr, old_value, new_value); | 496 return NoBarrier_CompareAndSwap(ptr, old_value, new_value); |
496 } | 497 } |
497 | 498 |
498 } // namespace base::subtle | 499 } // namespace base::subtle |
499 } // namespace base | 500 } // namespace base |
500 | 501 |
501 #endif // BASE_ATOMICOPS_INTERNALS_WINDOWS_H_ | 502 #endif // BASE_ATOMICOPS_INTERNALS_WINDOWS_H_ |
OLD | NEW |