| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium 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 StackFrameDepth_h | 5 #ifndef StackFrameDepth_h |
| 6 #define StackFrameDepth_h | 6 #define StackFrameDepth_h |
| 7 | 7 |
| 8 #include "platform/PlatformExport.h" | 8 #include "platform/PlatformExport.h" |
| 9 #include "wtf/Allocator.h" | 9 #include "wtf/Allocator.h" |
| 10 #include "wtf/Assertions.h" | 10 #include "wtf/Assertions.h" |
| (...skipping 28 matching lines...) Expand all Loading... |
| 39 bool isEnabled() { return m_stackFrameLimit != kMinimumStackLimit; } | 39 bool isEnabled() { return m_stackFrameLimit != kMinimumStackLimit; } |
| 40 bool isAcceptableStackUse() { | 40 bool isAcceptableStackUse() { |
| 41 #if defined(ADDRESS_SANITIZER) | 41 #if defined(ADDRESS_SANITIZER) |
| 42 // ASan adds extra stack usage leading to too noisy asserts. | 42 // ASan adds extra stack usage leading to too noisy asserts. |
| 43 return true; | 43 return true; |
| 44 #else | 44 #else |
| 45 return !isEnabled() || isSafeToRecurse(); | 45 return !isEnabled() || isSafeToRecurse(); |
| 46 #endif | 46 #endif |
| 47 } | 47 } |
| 48 | 48 |
| 49 static size_t getUnderestimatedStackSize(); | |
| 50 static void* getStackStart(); | |
| 51 | |
| 52 #if COMPILER(MSVC) | 49 #if COMPILER(MSVC) |
| 53 // Ignore C4172: returning address of local variable or temporary: dummy. This | 50 // Ignore C4172: returning address of local variable or temporary: dummy. This |
| 54 // warning suppression has to go outside of the function to take effect. | 51 // warning suppression has to go outside of the function to take effect. |
| 55 #pragma warning(push) | 52 #pragma warning(push) |
| 56 #pragma warning(disable : 4172) | 53 #pragma warning(disable : 4172) |
| 57 #endif | 54 #endif |
| 58 static uintptr_t currentStackFrame(const char* dummy = nullptr) { | 55 static uintptr_t currentStackFrame(const char* dummy = nullptr) { |
| 59 #if COMPILER(GCC) | 56 #if COMPILER(GCC) |
| 60 return reinterpret_cast<uintptr_t>(__builtin_frame_address(0)); | 57 return reinterpret_cast<uintptr_t>(__builtin_frame_address(0)); |
| 61 #elif COMPILER(MSVC) | 58 #elif COMPILER(MSVC) |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 | 96 |
| 100 ~StackFrameDepthScope() { m_depth->disableStackLimit(); } | 97 ~StackFrameDepthScope() { m_depth->disableStackLimit(); } |
| 101 | 98 |
| 102 private: | 99 private: |
| 103 StackFrameDepth* m_depth; | 100 StackFrameDepth* m_depth; |
| 104 }; | 101 }; |
| 105 | 102 |
| 106 } // namespace blink | 103 } // namespace blink |
| 107 | 104 |
| 108 #endif // StackFrameDepth_h | 105 #endif // StackFrameDepth_h |
| OLD | NEW |