Reland "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: I898d42c0b39b07300f1679eba11e7f50cad42120 Reviewed-on: https://chromium-review.googlesource.com/1162669 Reviewed-by: Clemens Hammacher <clemensh@chromium.org> Commit-Queue: Clemens Hammacher <clemensh@chromium.org> Cr-Commit-Position: refs/heads/master@{#54912}
This commit is contained in:
parent
15f8871c15
commit
fa2dc8dbad
@ -421,6 +421,14 @@ bool DoubleToBoolean(double d) {
|
||||
return true;
|
||||
}
|
||||
|
||||
uintptr_t GetCurrentStackPosition() {
|
||||
#if V8_CC_MSVC
|
||||
return reinterpret_cast<uintptr_t>(_AddressOfReturnAddress());
|
||||
#else
|
||||
return reinterpret_cast<uintptr_t>(__builtin_frame_address(0));
|
||||
#endif
|
||||
}
|
||||
|
||||
// The filter is a pattern that matches function names in this way:
|
||||
// "*" all; the default
|
||||
// "-" all but the top-level function
|
||||
|
13
src/utils.h
13
src/utils.h
@ -1562,14 +1562,11 @@ bool DoubleToBoolean(double d);
|
||||
template <typename Stream>
|
||||
bool StringToArrayIndex(Stream* stream, uint32_t* index);
|
||||
|
||||
// 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;
|
||||
}
|
||||
// Returns the current stack top. Works correctly with ASAN and SafeStack.
|
||||
// GetCurrentStackPosition() should not be inlined, because it works on stack
|
||||
// frames if it were inlined into a function with a huge stack frame it would
|
||||
// return an address significantly above the actual current stack position.
|
||||
V8_NOINLINE uintptr_t GetCurrentStackPosition();
|
||||
|
||||
template <typename V>
|
||||
static inline V ByteReverse(V value) {
|
||||
|
Loading…
Reference in New Issue
Block a user