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

Side by Side Diff: test/cctest/test-atomicops.cc

Issue 1393023003: Reland: Introduce a V8_NORETURN macro and use it to make GCC 4.9.2 happy again. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: avoid gcc 4.8 arm compiler bug on release and debug by moving checks to the bottom Created 5 years, 2 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 | « test/cctest/test-assembler-arm.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 150
151 value = k_test_val; 151 value = k_test_val;
152 new_value = NoBarrier_AtomicExchange(&value, 5); 152 new_value = NoBarrier_AtomicExchange(&value, 5);
153 CHECK_EQU(5, value); 153 CHECK_EQU(5, value);
154 CHECK_EQU(k_test_val, new_value); 154 CHECK_EQU(k_test_val, new_value);
155 } 155 }
156 156
157 157
158 template <class AtomicType> 158 template <class AtomicType>
159 static void TestAtomicIncrementBounds() { 159 static void TestAtomicIncrementBounds() {
160 // Test at rollover boundary between int_max and int_min. 160 // Test at 32-bit boundary for 64-bit atomic type.
161 AtomicType test_val = 161 AtomicType test_val = static_cast<AtomicType>(1)
162 static_cast<AtomicType>(1) << (NUM_BITS(AtomicType) - 1); 162 << (NUM_BITS(AtomicType) / 2);
163 AtomicType value = -1 ^ test_val; 163 AtomicType value = test_val - 1;
164 AtomicType new_value = NoBarrier_AtomicIncrement(&value, 1); 164 AtomicType new_value = NoBarrier_AtomicIncrement(&value, 1);
165 CHECK_EQU(test_val, value); 165 CHECK_EQU(test_val, value);
166 CHECK_EQU(value, new_value); 166 CHECK_EQU(value, new_value);
167 167
168 NoBarrier_AtomicIncrement(&value, -1);
169 CHECK_EQU(-1 ^ test_val, value);
170
171 // Test at 32-bit boundary for 64-bit atomic type.
172 test_val = static_cast<AtomicType>(1) << (NUM_BITS(AtomicType) / 2);
173 value = test_val - 1;
174 new_value = NoBarrier_AtomicIncrement(&value, 1);
175 CHECK_EQU(test_val, value);
176 CHECK_EQU(value, new_value);
177
178 NoBarrier_AtomicIncrement(&value, -1); 168 NoBarrier_AtomicIncrement(&value, -1);
179 CHECK_EQU(test_val - 1, value); 169 CHECK_EQU(test_val - 1, value);
180 } 170 }
181 171
182 172
183 // Return an AtomicType with the value 0xa5a5a5.. 173 // Return an AtomicType with the value 0xa5a5a5..
184 template <class AtomicType> 174 template <class AtomicType>
185 static AtomicType TestFillValue() { 175 static AtomicType TestFillValue() {
186 AtomicType val = 0; 176 AtomicType val = 0;
187 memset(&val, 0xa5, sizeof(AtomicType)); 177 memset(&val, 0xa5, sizeof(AtomicType));
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
300 TestStore<Atomic32>(); 290 TestStore<Atomic32>();
301 TestStore<AtomicWord>(); 291 TestStore<AtomicWord>();
302 } 292 }
303 293
304 294
305 TEST(Load) { 295 TEST(Load) {
306 TestLoadAtomic8(); 296 TestLoadAtomic8();
307 TestLoad<Atomic32>(); 297 TestLoad<Atomic32>();
308 TestLoad<AtomicWord>(); 298 TestLoad<AtomicWord>();
309 } 299 }
OLDNEW
« no previous file with comments | « test/cctest/test-assembler-arm.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698