Commit 12c81480 authored by Vlad Tsyrklevich's avatar Vlad Tsyrklevich Committed by Commit Bot

Update GetCurrentStackPosition to use built-in

By using a built-in this functions works with SafeStack and doesn't
require an attribute disabling ASan.

BUG=chromium:864705

Change-Id: I20cc818f1a0724a017a4f7f9ae3cd8fedb6245ee
Reviewed-on: https://chromium-review.googlesource.com/1141045
Commit-Queue: Clemens Hammacher <clemensh@chromium.org>
Reviewed-by: 's avatarClemens Hammacher <clemensh@chromium.org>
Cr-Commit-Position: refs/heads/master@{#54884}
parent 5d411aef
...@@ -1562,13 +1562,14 @@ bool DoubleToBoolean(double d); ...@@ -1562,13 +1562,14 @@ bool DoubleToBoolean(double d);
template <typename Stream> template <typename Stream>
bool StringToArrayIndex(Stream* stream, uint32_t* index); bool StringToArrayIndex(Stream* stream, uint32_t* index);
// Returns current value of top of the stack. Works correctly with ASAN. // Returns current value of top of the stack. Works correctly with ASAN and
DISABLE_ASAN // SafeStack.
inline uintptr_t GetCurrentStackPosition() { inline uintptr_t GetCurrentStackPosition() {
// Takes the address of the limit variable in order to find out where #if V8_CC_MSVC
// the top of stack is right now. return reinterpret_cast<uintptr_t>(_AddressOfReturnAddress());
uintptr_t limit = reinterpret_cast<uintptr_t>(&limit); #else
return limit; return reinterpret_cast<uintptr_t>(__builtin_frame_address(0));
#endif
} }
template <typename V> template <typename V>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment