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

Side by Side Diff: src/utils.h

Issue 8256012: Remove some asserts to speed up debug mode. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 9 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 | Annotate | Revision Log
« no previous file with comments | « src/store-buffer-inl.h ('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 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 161
162 static inline uint32_t RoundDownToPowerOf2(uint32_t x) { 162 static inline uint32_t RoundDownToPowerOf2(uint32_t x) {
163 uint32_t rounded_up = RoundUpToPowerOf2(x); 163 uint32_t rounded_up = RoundUpToPowerOf2(x);
164 if (rounded_up > x) return rounded_up >> 1; 164 if (rounded_up > x) return rounded_up >> 1;
165 return rounded_up; 165 return rounded_up;
166 } 166 }
167 167
168 168
169 template <typename T, typename U> 169 template <typename T, typename U>
170 static inline bool IsAligned(T value, U alignment) { 170 static inline bool IsAligned(T value, U alignment) {
171 ASSERT(IsPowerOf2(alignment));
172 return (value & (alignment - 1)) == 0; 171 return (value & (alignment - 1)) == 0;
173 } 172 }
174 173
175 174
176 // Returns true if (addr + offset) is aligned. 175 // Returns true if (addr + offset) is aligned.
177 static inline bool IsAddressAligned(Address addr, 176 static inline bool IsAddressAligned(Address addr,
178 intptr_t alignment, 177 intptr_t alignment,
179 int offset = 0) { 178 int offset = 0) {
180 intptr_t offs = OffsetFrom(addr + offset); 179 intptr_t offs = OffsetFrom(addr + offset);
181 return IsAligned(offs, alignment); 180 return IsAligned(offs, alignment);
(...skipping 735 matching lines...) Expand 10 before | Expand all | Expand 10 after
917 ASSERT(element < static_cast<int>(sizeof(T) * CHAR_BIT)); 916 ASSERT(element < static_cast<int>(sizeof(T) * CHAR_BIT));
918 return 1 << element; 917 return 1 << element;
919 } 918 }
920 919
921 T bits_; 920 T bits_;
922 }; 921 };
923 922
924 } } // namespace v8::internal 923 } } // namespace v8::internal
925 924
926 #endif // V8_UTILS_H_ 925 #endif // V8_UTILS_H_
OLDNEW
« no previous file with comments | « src/store-buffer-inl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698