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 #include "platform/heap/StackFrameDepth.h" | 5 #include "platform/heap/StackFrameDepth.h" |
6 | 6 |
7 #include "public/platform/Platform.h" | 7 #include "public/platform/Platform.h" |
8 | 8 |
9 #if OS(WIN) | 9 #if OS(WIN) |
10 #include <stddef.h> | 10 #include <stddef.h> |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 return; | 64 return; |
65 } | 65 } |
66 | 66 |
67 static const int kStackRoomSize = 1024; | 67 static const int kStackRoomSize = 1024; |
68 | 68 |
69 Address stackBase = reinterpret_cast<Address>(getStackStart()); | 69 Address stackBase = reinterpret_cast<Address>(getStackStart()); |
70 RELEASE_ASSERT(stackSize > static_cast<const size_t>(kStackRoomSize)); | 70 RELEASE_ASSERT(stackSize > static_cast<const size_t>(kStackRoomSize)); |
71 size_t stackRoom = stackSize - kStackRoomSize; | 71 size_t stackRoom = stackSize - kStackRoomSize; |
72 RELEASE_ASSERT(stackBase > reinterpret_cast<Address>(stackRoom)); | 72 RELEASE_ASSERT(stackBase > reinterpret_cast<Address>(stackRoom)); |
73 s_stackFrameLimit = reinterpret_cast<uintptr_t>(stackBase - stackRoom); | 73 s_stackFrameLimit = reinterpret_cast<uintptr_t>(stackBase - stackRoom); |
| 74 |
| 75 #if ENABLE(ASSERT) |
| 76 // If current stack use is already exceeding estimated limit, mark as disabl
ed. |
| 77 if (!isSafeToRecurse()) |
| 78 s_isEnabled = false; |
| 79 #endif |
74 } | 80 } |
75 | 81 |
76 size_t StackFrameDepth::getUnderestimatedStackSize() | 82 size_t StackFrameDepth::getUnderestimatedStackSize() |
77 { | 83 { |
78 // FIXME: ASAN bot uses a fake stack as a thread stack frame, | 84 // FIXME: ASAN bot uses a fake stack as a thread stack frame, |
79 // and its size is different from the value which APIs tells us. | 85 // and its size is different from the value which APIs tells us. |
80 #if defined(ADDRESS_SANITIZER) | 86 #if defined(ADDRESS_SANITIZER) |
81 return 0; | 87 return 0; |
82 #endif | 88 #endif |
83 | 89 |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
186 return reinterpret_cast<void*>(__readgsqword(offsetof(NT_TIB64, StackBase)))
; | 192 return reinterpret_cast<void*>(__readgsqword(offsetof(NT_TIB64, StackBase)))
; |
187 #else | 193 #else |
188 return reinterpret_cast<void*>(__readfsdword(offsetof(NT_TIB, StackBase))); | 194 return reinterpret_cast<void*>(__readfsdword(offsetof(NT_TIB, StackBase))); |
189 #endif | 195 #endif |
190 #else | 196 #else |
191 #error Unsupported getStackStart on this platform. | 197 #error Unsupported getStackStart on this platform. |
192 #endif | 198 #endif |
193 } | 199 } |
194 | 200 |
195 } // namespace blink | 201 } // namespace blink |
OLD | NEW |