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

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

Issue 2326523004: Revert of StackFrameDepth should be managed per ThreadHeap (Closed)
Patch Set: Created 4 years, 3 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
Index: third_party/WebKit/Source/platform/heap/StackFrameDepth.h
diff --git a/third_party/WebKit/Source/platform/heap/StackFrameDepth.h b/third_party/WebKit/Source/platform/heap/StackFrameDepth.h
index 4ae894c12c8b14c9a2eac198bcd27efe44dc4c01..94379aa71692505ddc0cfdd4a82680c1f28216cf 100644
--- a/third_party/WebKit/Source/platform/heap/StackFrameDepth.h
+++ b/third_party/WebKit/Source/platform/heap/StackFrameDepth.h
@@ -20,26 +20,27 @@
// Use isSafeToRecurse() to determine if it is safe to consume
// more stack by invoking another recursive call.
class PLATFORM_EXPORT StackFrameDepth final {
- DISALLOW_NEW();
+ STATIC_ONLY(StackFrameDepth);
public:
- bool isSafeToRecurse()
+ inline static bool isSafeToRecurse()
{
// Asssume that the stack grows towards lower addresses, which
// all the ABIs currently supported do.
//
// A unit test checks that the assumption holds for a target
// (HeapTest.StackGrowthDirection.)
- return currentStackFrame() > m_stackFrameLimit;
+ return currentStackFrame() > s_stackFrameLimit;
}
- void enableStackLimit();
- void disableStackLimit()
+ static void enableStackLimit();
+ static void disableStackLimit()
{
- m_stackFrameLimit = kMinimumStackLimit;
+ s_stackFrameLimit = kMinimumStackLimit;
}
- bool isEnabled() { return m_stackFrameLimit != kMinimumStackLimit; }
- bool isAcceptableStackUse()
+#if ENABLE(ASSERT)
+ inline static bool isEnabled() { return s_stackFrameLimit != kMinimumStackLimit; }
+ inline static bool isAcceptableStackUse()
{
#if defined(ADDRESS_SANITIZER)
// ASan adds extra stack usage leading to too noisy asserts.
@@ -48,6 +49,7 @@
return !isEnabled() || isSafeToRecurse();
#endif
}
+#endif
static size_t getUnderestimatedStackSize();
static void* getStackStart();
@@ -87,27 +89,24 @@
static uintptr_t getFallbackStackLimit();
// The (pointer-valued) stack limit.
- uintptr_t m_stackFrameLimit;
+ static uintptr_t s_stackFrameLimit;
};
class StackFrameDepthScope {
STACK_ALLOCATED();
WTF_MAKE_NONCOPYABLE(StackFrameDepthScope);
public:
- explicit StackFrameDepthScope(StackFrameDepth* depth): m_depth(depth)
+ StackFrameDepthScope()
{
- m_depth->enableStackLimit();
+ StackFrameDepth::enableStackLimit();
// Enabled unless under stack pressure.
- DCHECK(m_depth->isSafeToRecurse() || !m_depth->isEnabled());
+ ASSERT(StackFrameDepth::isSafeToRecurse() || !StackFrameDepth::isEnabled());
}
~StackFrameDepthScope()
{
- m_depth->disableStackLimit();
+ StackFrameDepth::disableStackLimit();
}
-
-private:
- StackFrameDepth* m_depth;
};
} // namespace blink
« no previous file with comments | « third_party/WebKit/Source/platform/heap/HeapTest.cpp ('k') | third_party/WebKit/Source/platform/heap/StackFrameDepth.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698