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_ |