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

Unified Diff: Source/platform/heap/StackFrameDepth.h

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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/platform/heap/HeapTest.cpp ('k') | Source/platform/heap/StackFrameDepth.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/platform/heap/StackFrameDepth.h
diff --git a/Source/platform/heap/StackFrameDepth.h b/Source/platform/heap/StackFrameDepth.h
index 09c41a469fe4548ca13541c6833983a18734da64..17389c1b0f2becf9ba4ebb0eb261f29a2a5213fc 100644
--- a/Source/platform/heap/StackFrameDepth.h
+++ b/Source/platform/heap/StackFrameDepth.h
@@ -18,7 +18,7 @@ class PLATFORM_EXPORT StackFrameDepth final {
public:
inline static bool isSafeToRecurse()
{
- ASSERT(s_stackFrameLimit);
+ ASSERT(s_stackFrameLimit || !s_isEnabled);
// Asssume that the stack grows towards lower addresses, which
// all the ABIs currently supported do.
@@ -27,7 +27,20 @@ public:
// (HeapTest.StackGrowthDirection.)
return currentStackFrame() > s_stackFrameLimit;
}
- static void configureStackLimit();
+
+ static void enableStackLimit();
+ static void disableStackLimit()
+ {
+ s_stackFrameLimit = 0;
+#if ENABLE(ASSERT)
+ s_isEnabled = false;
+#endif
+ }
+
+#if ENABLE(ASSERT)
+ inline static bool isEnabled() { return s_isEnabled; }
+#endif
+
static size_t getUnderestimatedStackSize();
static void* getStackStart();
@@ -58,6 +71,23 @@ private:
static const int kSafeStackFrameSize = 32 * 1024;
static uintptr_t s_stackFrameLimit;
+#if ENABLE(ASSERT)
+ static bool s_isEnabled;
+#endif
+};
+
+class StackFrameDepthScope {
+public:
+ StackFrameDepthScope()
+ {
+ StackFrameDepth::enableStackLimit();
+ ASSERT(StackFrameDepth::isSafeToRecurse());
+ }
+
+ ~StackFrameDepthScope()
+ {
+ StackFrameDepth::disableStackLimit();
+ }
};
} // namespace blink
« no previous file with comments | « Source/platform/heap/HeapTest.cpp ('k') | Source/platform/heap/StackFrameDepth.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698