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

Unified Diff: src/utils.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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/base/platform/platform-win32.cc ('k') | test/cctest/test-parsing.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/utils.h
diff --git a/src/utils.h b/src/utils.h
index ebc33ba2651f425caa9e96b0c030f478660bee6b..fcc80b9e14e5979865622626ad8ab6a52d2fc0dc 100644
--- a/src/utils.h
+++ b/src/utils.h
@@ -112,6 +112,12 @@ int HandleObjectPointerCompare(const Handle<T>* a, const Handle<T>* b) {
}
+template <typename T, typename U>
+inline bool IsAligned(T value, U alignment) {
+ return (value & (alignment - 1)) == 0;
+}
+
+
// Returns true if (addr + offset) is aligned.
inline bool IsAddressAligned(Address addr,
intptr_t alignment,
@@ -1536,6 +1542,16 @@ bool StringToArrayIndex(Stream* stream, uint32_t* index) {
}
-} } // namespace v8::internal
+// Returns current value of top of the stack. Works correctly with ASAN.
+DISABLE_ASAN
+inline uintptr_t GetCurrentStackPosition() {
+ // Takes the address of the limit variable in order to find out where
+ // the top of stack is right now.
+ uintptr_t limit = reinterpret_cast<uintptr_t>(&limit);
+ return limit;
+}
+
+} // namespace internal
+} // namespace v8
#endif // V8_UTILS_H_
« no previous file with comments | « src/base/platform/platform-win32.cc ('k') | test/cctest/test-parsing.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698