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

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

Issue 818253005: Oilpan: Query stack frame register instead of manual bookkeeping (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: move preGC Created 5 years, 11 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
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef StackFrameDepth_h
6 #define StackFrameDepth_h
7
8 #include "platform/PlatformExport.h"
9 #include "wtf/Assertions.h"
10 #include <stdint.h>
11
12 namespace blink {
13
14 // StackFrameDepth keeps track of current call stack frame depth.
15 // Use isSafeToRecurse() to query if there is a room in current
16 // call stack for more recursive call.
17 class PLATFORM_EXPORT StackFrameDepth final {
18 public:
19 inline bool isSafeToRecurse()
20 {
21 ASSERT(m_stackFrameLimit);
22
23 // Below comparison assumes callstack to glow downward,
24 // which is true for all ABI Blink currently supports.
25 return currentStackFrame() > m_stackFrameLimit;
26 }
27
28 static uintptr_t currentStackFrame(const char* dummy = nullptr)
29 {
30 #if COMPILER(GCC)
31 return reinterpret_cast<uintptr_t>(__builtin_frame_address(0));
32 #elif COMPILER(MSVC)
33 return reinterpret_cast<uintptr_t>(&dummy) - sizeof(void*);
34 #else
35 #error "Stack frame pointer estimation not supported on this platform."
36 return 0;
37 #endif
38 }
39
40 void configureLimit();
41
42 private:
43 // The maximum depth of eager, unrolled trace() calls that is
44 // considered safe and allowed.
45 static const int kSafeStackFrameSize = 32 * 1024;
46
47 uintptr_t m_stackFrameLimit;
48 };
49
50 } // namespace blink
51
52 #endif // StackFrameDepth_h
OLDNEW
« no previous file with comments | « Source/platform/heap/InlinedGlobalMarkingVisitor.h ('k') | Source/platform/heap/StackFrameDepth.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698