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

Side by Side Diff: src/utils.h

Issue 769263002: Add support for enabling DCHECKs in release mode (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: updates Created 6 years 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 | « src/transitions.h ('k') | src/x64/assembler-x64.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef V8_UTILS_H_ 5 #ifndef V8_UTILS_H_
6 #define V8_UTILS_H_ 6 #define V8_UTILS_H_
7 7
8 #include <limits.h> 8 #include <limits.h>
9 #include <stdlib.h> 9 #include <stdlib.h>
10 #include <string.h> 10 #include <string.h>
(...skipping 19 matching lines...) Expand all
30 // Same as strcmp, but can handle NULL arguments. 30 // Same as strcmp, but can handle NULL arguments.
31 inline bool CStringEquals(const char* s1, const char* s2) { 31 inline bool CStringEquals(const char* s1, const char* s2) {
32 return (s1 == s2) || (s1 != NULL && s2 != NULL && strcmp(s1, s2) == 0); 32 return (s1 == s2) || (s1 != NULL && s2 != NULL && strcmp(s1, s2) == 0);
33 } 33 }
34 34
35 35
36 // X must be a power of 2. Returns the number of trailing zeros. 36 // X must be a power of 2. Returns the number of trailing zeros.
37 inline int WhichPowerOf2(uint32_t x) { 37 inline int WhichPowerOf2(uint32_t x) {
38 DCHECK(base::bits::IsPowerOfTwo32(x)); 38 DCHECK(base::bits::IsPowerOfTwo32(x));
39 int bits = 0; 39 int bits = 0;
40 #ifdef DEBUG 40 #if DCHECK_IS_ON
41 int original_x = x; 41 int original_x = x;
42 #endif 42 #endif
43 if (x >= 0x10000) { 43 if (x >= 0x10000) {
44 bits += 16; 44 bits += 16;
45 x >>= 16; 45 x >>= 16;
46 } 46 }
47 if (x >= 0x100) { 47 if (x >= 0x100) {
48 bits += 8; 48 bits += 8;
49 x >>= 8; 49 x >>= 8;
50 } 50 }
(...skipping 1486 matching lines...) Expand 10 before | Expand all | Expand 10 after
1537 // Takes the address of the limit variable in order to find out where 1537 // Takes the address of the limit variable in order to find out where
1538 // the top of stack is right now. 1538 // the top of stack is right now.
1539 uintptr_t limit = reinterpret_cast<uintptr_t>(&limit); 1539 uintptr_t limit = reinterpret_cast<uintptr_t>(&limit);
1540 return limit; 1540 return limit;
1541 } 1541 }
1542 1542
1543 } // namespace internal 1543 } // namespace internal
1544 } // namespace v8 1544 } // namespace v8
1545 1545
1546 #endif // V8_UTILS_H_ 1546 #endif // V8_UTILS_H_
OLDNEW
« no previous file with comments | « src/transitions.h ('k') | src/x64/assembler-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698