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

Side by Side Diff: src/base/macros.h

Issue 544043002: Next base/macros.h cleanup step. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 3 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/api.cc ('k') | src/base/platform/platform-cygwin.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 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 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_BASE_MACROS_H_ 5 #ifndef V8_BASE_MACROS_H_
6 #define V8_BASE_MACROS_H_ 6 #define V8_BASE_MACROS_H_
7 7
8 #include "include/v8stdint.h" 8 #include "include/v8stdint.h"
9 #include "src/base/build_config.h" 9 #include "src/base/build_config.h"
10 #include "src/base/compiler-specific.h" 10 #include "src/base/compiler-specific.h"
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after
264 return AddressFrom<T>(OffsetFrom(x) & -m); 264 return AddressFrom<T>(OffsetFrom(x) & -m);
265 } 265 }
266 266
267 267
268 // Return the smallest multiple of m which is >= x. 268 // Return the smallest multiple of m which is >= x.
269 template <typename T> 269 template <typename T>
270 inline T RoundUp(T x, intptr_t m) { 270 inline T RoundUp(T x, intptr_t m) {
271 return RoundDown<T>(static_cast<T>(x + m - 1), m); 271 return RoundDown<T>(static_cast<T>(x + m - 1), m);
272 } 272 }
273 273
274
275 template <typename T, typename U>
276 inline bool IsAligned(T value, U alignment) {
277 return (value & (alignment - 1)) == 0;
278 }
279
280
281 // Returns current value of top of the stack. Works correctly with ASAN.
282 DISABLE_ASAN
283 inline uintptr_t GetCurrentStackPosition() {
284 // Takes the address of the limit variable in order to find out where
285 // the top of stack is right now.
286 uintptr_t limit = reinterpret_cast<uintptr_t>(&limit);
287 return limit;
288 }
289
290 #endif // V8_BASE_MACROS_H_ 274 #endif // V8_BASE_MACROS_H_
OLDNEW
« no previous file with comments | « src/api.cc ('k') | src/base/platform/platform-cygwin.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698