Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(167)

Side by Side Diff: Source/platform/heap/StackFrameDepth.cpp

Issue 1125613002: Oilpan: handle thread-local weak tracing slightly better. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: rename some methods Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/platform/heap/StackFrameDepth.h ('k') | Source/platform/heap/TraceTraits.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "config.h" 5 #include "config.h"
6 #include "platform/heap/StackFrameDepth.h" 6 #include "platform/heap/StackFrameDepth.h"
7 7
8 #include "public/platform/Platform.h" 8 #include "public/platform/Platform.h"
9 9
10 #if OS(WIN) 10 #if OS(WIN)
11 #include <stddef.h> 11 #include <stddef.h>
12 #include <windows.h> 12 #include <windows.h>
13 #include <winnt.h> 13 #include <winnt.h>
14 #elif defined(__GLIBC__) 14 #elif defined(__GLIBC__)
15 extern "C" void* __libc_stack_end; // NOLINT 15 extern "C" void* __libc_stack_end; // NOLINT
16 #endif 16 #endif
17 17
18 namespace blink { 18 namespace blink {
19 19
20 static const char* s_avoidOptimization = nullptr; 20 static const char* s_avoidOptimization = nullptr;
21 21
22 uintptr_t StackFrameDepth::s_stackFrameLimit = 0; 22 uintptr_t StackFrameDepth::s_stackFrameLimit = 0;
23 #if ENABLE(ASSERT)
24 bool StackFrameDepth::s_isEnabled = false;
25 #endif
23 26
24 // NEVER_INLINE ensures that |dummy| array on configureLimit() is not optimized away, 27 // NEVER_INLINE ensures that |dummy| array on configureLimit() is not optimized away,
25 // and the stack frame base register is adjusted |kSafeStackFrameSize|. 28 // and the stack frame base register is adjusted |kSafeStackFrameSize|.
26 NEVER_INLINE static uintptr_t currentStackFrameBaseOnCallee(const char* dummy) 29 NEVER_INLINE static uintptr_t currentStackFrameBaseOnCallee(const char* dummy)
27 { 30 {
28 s_avoidOptimization = dummy; 31 s_avoidOptimization = dummy;
29 return StackFrameDepth::currentStackFrame(); 32 return StackFrameDepth::currentStackFrame();
30 } 33 }
31 34
32 void StackFrameDepth::configureStackLimit() 35 void StackFrameDepth::enableStackLimit()
33 { 36 {
37 #if ENABLE(ASSERT)
38 s_isEnabled = true;
39 #endif
40
34 static const int kStackRoomSize = 1024; 41 static const int kStackRoomSize = 1024;
35 42
36 size_t stackSize = getUnderestimatedStackSize(); 43 size_t stackSize = getUnderestimatedStackSize();
37 if (stackSize) { 44 if (stackSize) {
38 size_t stackBase = reinterpret_cast<size_t>(getStackStart()); 45 size_t stackBase = reinterpret_cast<size_t>(getStackStart());
39 s_stackFrameLimit = stackBase - stackSize + kStackRoomSize; 46 s_stackFrameLimit = stackBase - stackSize + kStackRoomSize;
40 return; 47 return;
41 } 48 }
42 49
43 // Fallback version 50 // Fallback version
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 return reinterpret_cast<void*>(__readgsqword(offsetof(NT_TIB64, StackBase))) ; 154 return reinterpret_cast<void*>(__readgsqword(offsetof(NT_TIB64, StackBase))) ;
148 #else 155 #else
149 return reinterpret_cast<void*>(__readfsdword(offsetof(NT_TIB, StackBase))); 156 return reinterpret_cast<void*>(__readfsdword(offsetof(NT_TIB, StackBase)));
150 #endif 157 #endif
151 #else 158 #else
152 #error Unsupported getStackStart on this platform. 159 #error Unsupported getStackStart on this platform.
153 #endif 160 #endif
154 } 161 }
155 162
156 } // namespace blink 163 } // namespace blink
OLDNEW
« no previous file with comments | « Source/platform/heap/StackFrameDepth.h ('k') | Source/platform/heap/TraceTraits.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698