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