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 "platform/wtf/StackUtil.h" | 7 #include "platform/wtf/StackUtil.h" |
8 #include "public/platform/Platform.h" | 8 #include "public/platform/Platform.h" |
9 | 9 |
10 #if OS(WIN) | 10 #if OS(WIN) |
(...skipping 30 matching lines...) Expand all Loading... |
41 // except if ASan is enabled. | 41 // except if ASan is enabled. |
42 size_t stack_size = WTF::GetUnderestimatedStackSize(); | 42 size_t stack_size = WTF::GetUnderestimatedStackSize(); |
43 if (!stack_size) { | 43 if (!stack_size) { |
44 stack_frame_limit_ = GetFallbackStackLimit(); | 44 stack_frame_limit_ = GetFallbackStackLimit(); |
45 return; | 45 return; |
46 } | 46 } |
47 | 47 |
48 static const int kStackRoomSize = 1024; | 48 static const int kStackRoomSize = 1024; |
49 | 49 |
50 Address stack_base = reinterpret_cast<Address>(WTF::GetStackStart()); | 50 Address stack_base = reinterpret_cast<Address>(WTF::GetStackStart()); |
51 RELEASE_ASSERT(stack_size > static_cast<const size_t>(kStackRoomSize)); | 51 CHECK_GT(stack_size, static_cast<const size_t>(kStackRoomSize)); |
52 size_t stack_room = stack_size - kStackRoomSize; | 52 size_t stack_room = stack_size - kStackRoomSize; |
53 RELEASE_ASSERT(stack_base > reinterpret_cast<Address>(stack_room)); | 53 CHECK_GT(stack_base, reinterpret_cast<Address>(stack_room)); |
54 stack_frame_limit_ = reinterpret_cast<uintptr_t>(stack_base - stack_room); | 54 stack_frame_limit_ = reinterpret_cast<uintptr_t>(stack_base - stack_room); |
55 | 55 |
56 // If current stack use is already exceeding estimated limit, mark as | 56 // If current stack use is already exceeding estimated limit, mark as |
57 // disabled. | 57 // disabled. |
58 if (!IsSafeToRecurse()) | 58 if (!IsSafeToRecurse()) |
59 DisableStackLimit(); | 59 DisableStackLimit(); |
60 } | 60 } |
61 | 61 |
62 } // namespace blink | 62 } // namespace blink |
OLD | NEW |