| OLD | NEW |
| 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 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 129 return res; | 129 return res; |
| 130 } | 130 } |
| 131 | 131 |
| 132 inline Atomic32 Release_CompareAndSwap(volatile Atomic32* ptr, | 132 inline Atomic32 Release_CompareAndSwap(volatile Atomic32* ptr, |
| 133 Atomic32 old_value, | 133 Atomic32 old_value, |
| 134 Atomic32 new_value) { | 134 Atomic32 new_value) { |
| 135 MemoryBarrier(); | 135 MemoryBarrier(); |
| 136 return NoBarrier_CompareAndSwap(ptr, old_value, new_value); | 136 return NoBarrier_CompareAndSwap(ptr, old_value, new_value); |
| 137 } | 137 } |
| 138 | 138 |
| 139 inline void NoBarrier_Store(volatile Atomic8* ptr, Atomic8 value) { |
| 140 *ptr = value; |
| 141 } |
| 142 |
| 139 inline void NoBarrier_Store(volatile Atomic32* ptr, Atomic32 value) { | 143 inline void NoBarrier_Store(volatile Atomic32* ptr, Atomic32 value) { |
| 140 *ptr = value; | 144 *ptr = value; |
| 141 } | 145 } |
| 142 | 146 |
| 143 inline void MemoryBarrier() { | 147 inline void MemoryBarrier() { |
| 144 __asm__ __volatile__("sync" : : : "memory"); | 148 __asm__ __volatile__("sync" : : : "memory"); |
| 145 } | 149 } |
| 146 | 150 |
| 147 inline void Acquire_Store(volatile Atomic32* ptr, Atomic32 value) { | 151 inline void Acquire_Store(volatile Atomic32* ptr, Atomic32 value) { |
| 148 *ptr = value; | 152 *ptr = value; |
| 149 MemoryBarrier(); | 153 MemoryBarrier(); |
| 150 } | 154 } |
| 151 | 155 |
| 152 inline void Release_Store(volatile Atomic32* ptr, Atomic32 value) { | 156 inline void Release_Store(volatile Atomic32* ptr, Atomic32 value) { |
| 153 MemoryBarrier(); | 157 MemoryBarrier(); |
| 154 *ptr = value; | 158 *ptr = value; |
| 155 } | 159 } |
| 156 | 160 |
| 161 inline Atomic8 NoBarrier_Load(volatile const Atomic8* ptr) { |
| 162 return *ptr; |
| 163 } |
| 164 |
| 157 inline Atomic32 NoBarrier_Load(volatile const Atomic32* ptr) { | 165 inline Atomic32 NoBarrier_Load(volatile const Atomic32* ptr) { |
| 158 return *ptr; | 166 return *ptr; |
| 159 } | 167 } |
| 160 | 168 |
| 161 inline Atomic32 Acquire_Load(volatile const Atomic32* ptr) { | 169 inline Atomic32 Acquire_Load(volatile const Atomic32* ptr) { |
| 162 Atomic32 value = *ptr; | 170 Atomic32 value = *ptr; |
| 163 MemoryBarrier(); | 171 MemoryBarrier(); |
| 164 return value; | 172 return value; |
| 165 } | 173 } |
| 166 | 174 |
| 167 inline Atomic32 Release_Load(volatile const Atomic32* ptr) { | 175 inline Atomic32 Release_Load(volatile const Atomic32* ptr) { |
| 168 MemoryBarrier(); | 176 MemoryBarrier(); |
| 169 return *ptr; | 177 return *ptr; |
| 170 } | 178 } |
| 171 | 179 |
| 172 } } // namespace v8::internal | 180 } } // namespace v8::internal |
| 173 | 181 |
| 174 #endif // V8_ATOMICOPS_INTERNALS_MIPS_GCC_H_ | 182 #endif // V8_ATOMICOPS_INTERNALS_MIPS_GCC_H_ |
| OLD | NEW |