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

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: compile fix Created 5 years, 8 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..66c6c0266743fa99e6e43f670b2f919b0ebdf2bf 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_isActive);
// Asssume that the stack grows towards lower addresses, which
// all the ABIs currently supported do.
@@ -31,6 +31,18 @@ public:
static size_t getUnderestimatedStackSize();
static void* getStackStart();
+ static void clearStackLimit()
haraken 2015/05/04 23:11:32 configureStackLimit => enableStackLimit clearStack
sof 2015/05/06 10:39:57 Renamed so.
+ {
+ s_stackFrameLimit = 0;
+#if ENABLE(ASSERT)
+ s_isActive = false;
+#endif
+ }
+
+#if ENABLE(ASSERT)
+ inline static bool isActive() { return s_isActive; }
+#endif
+
#if COMPILER(MSVC)
// Ignore C4172: returning address of local variable or temporary: dummy. This
// warning suppression has to go outside of the function to take effect.
@@ -58,6 +70,23 @@ private:
static const int kSafeStackFrameSize = 32 * 1024;
static uintptr_t s_stackFrameLimit;
+#if ENABLE(ASSERT)
+ static bool s_isActive;
+#endif
+};
+
+class StackFrameDepthScope {
haraken 2015/05/04 23:11:32 Add STACK_ALLOCATED.
sof 2015/05/06 10:39:57 Not done, that would be an unnecessary restriction
+public:
+ StackFrameDepthScope()
+ {
+ StackFrameDepth::configureStackLimit();
+ ASSERT(StackFrameDepth::isSafeToRecurse());
+ }
+
+ ~StackFrameDepthScope()
+ {
+ StackFrameDepth::clearStackLimit();
+ }
};
} // 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