OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
186 const AtomicType kVal1 = TestFillValue<AtomicType>(); | 186 const AtomicType kVal1 = TestFillValue<AtomicType>(); |
187 const AtomicType kVal2 = static_cast<AtomicType>(-1); | 187 const AtomicType kVal2 = static_cast<AtomicType>(-1); |
188 | 188 |
189 AtomicType value; | 189 AtomicType value; |
190 | 190 |
191 NoBarrier_Store(&value, kVal1); | 191 NoBarrier_Store(&value, kVal1); |
192 CHECK_EQU(kVal1, value); | 192 CHECK_EQU(kVal1, value); |
193 NoBarrier_Store(&value, kVal2); | 193 NoBarrier_Store(&value, kVal2); |
194 CHECK_EQU(kVal2, value); | 194 CHECK_EQU(kVal2, value); |
195 | 195 |
| 196 Acquire_Store(&value, kVal1); |
| 197 CHECK_EQU(kVal1, value); |
| 198 Acquire_Store(&value, kVal2); |
| 199 CHECK_EQU(kVal2, value); |
| 200 |
196 Release_Store(&value, kVal1); | 201 Release_Store(&value, kVal1); |
197 CHECK_EQU(kVal1, value); | 202 CHECK_EQU(kVal1, value); |
198 Release_Store(&value, kVal2); | 203 Release_Store(&value, kVal2); |
199 CHECK_EQU(kVal2, value); | 204 CHECK_EQU(kVal2, value); |
200 } | 205 } |
201 | 206 |
202 | 207 |
203 // Merge this test with TestStore as soon as we have Atomic8 acquire | 208 // Merge this test with TestStore as soon as we have Atomic8 acquire |
204 // and release stores. | 209 // and release stores. |
205 static void TestStoreAtomic8() { | 210 static void TestStoreAtomic8() { |
(...skipping 20 matching lines...) Expand all Loading... |
226 | 231 |
227 value = kVal1; | 232 value = kVal1; |
228 CHECK_EQU(kVal1, NoBarrier_Load(&value)); | 233 CHECK_EQU(kVal1, NoBarrier_Load(&value)); |
229 value = kVal2; | 234 value = kVal2; |
230 CHECK_EQU(kVal2, NoBarrier_Load(&value)); | 235 CHECK_EQU(kVal2, NoBarrier_Load(&value)); |
231 | 236 |
232 value = kVal1; | 237 value = kVal1; |
233 CHECK_EQU(kVal1, Acquire_Load(&value)); | 238 CHECK_EQU(kVal1, Acquire_Load(&value)); |
234 value = kVal2; | 239 value = kVal2; |
235 CHECK_EQU(kVal2, Acquire_Load(&value)); | 240 CHECK_EQU(kVal2, Acquire_Load(&value)); |
| 241 |
| 242 value = kVal1; |
| 243 CHECK_EQU(kVal1, Release_Load(&value)); |
| 244 value = kVal2; |
| 245 CHECK_EQU(kVal2, Release_Load(&value)); |
236 } | 246 } |
237 | 247 |
238 | 248 |
239 // Merge this test with TestLoad as soon as we have Atomic8 acquire | 249 // Merge this test with TestLoad as soon as we have Atomic8 acquire |
240 // and release loads. | 250 // and release loads. |
241 static void TestLoadAtomic8() { | 251 static void TestLoadAtomic8() { |
242 const Atomic8 kVal1 = TestFillValue<Atomic8>(); | 252 const Atomic8 kVal1 = TestFillValue<Atomic8>(); |
243 const Atomic8 kVal2 = static_cast<Atomic8>(-1); | 253 const Atomic8 kVal2 = static_cast<Atomic8>(-1); |
244 | 254 |
245 Atomic8 value; | 255 Atomic8 value; |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
280 TestStore<Atomic32>(); | 290 TestStore<Atomic32>(); |
281 TestStore<AtomicWord>(); | 291 TestStore<AtomicWord>(); |
282 } | 292 } |
283 | 293 |
284 | 294 |
285 TEST(Load) { | 295 TEST(Load) { |
286 TestLoadAtomic8(); | 296 TestLoadAtomic8(); |
287 TestLoad<Atomic32>(); | 297 TestLoad<Atomic32>(); |
288 TestLoad<AtomicWord>(); | 298 TestLoad<AtomicWord>(); |
289 } | 299 } |
OLD | NEW |