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

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

Issue 2304023003: 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 94379aa71692505ddc0cfdd4a82680c1f28216cf..a06fea4db02ed2d8a3ab11a556074ff745528415 100644
--- a/third_party/WebKit/Source/platform/heap/StackFrameDepth.h
+++ b/third_party/WebKit/Source/platform/heap/StackFrameDepth.h
@@ -20,27 +20,26 @@ namespace blink {
// Use isSafeToRecurse() to determine if it is safe to consume
// more stack by invoking another recursive call.
class PLATFORM_EXPORT StackFrameDepth final {
haraken 2016/09/02 09:07:57 Add DISALLOW_NEW().
- STATIC_ONLY(StackFrameDepth);
public:
- inline static bool isSafeToRecurse()
+ 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() > s_stackFrameLimit;
+ return currentStackFrame() > m_stackFrameLimit;
}
- static void enableStackLimit();
- static void disableStackLimit()
+ void enableStackLimit();
+ void disableStackLimit()
{
- s_stackFrameLimit = kMinimumStackLimit;
+ m_stackFrameLimit = kMinimumStackLimit;
}
#if ENABLE(ASSERT)
- inline static bool isEnabled() { return s_stackFrameLimit != kMinimumStackLimit; }
- inline static bool isAcceptableStackUse()
+ bool isEnabled() { return m_stackFrameLimit != kMinimumStackLimit; }
+ bool isAcceptableStackUse()
{
#if defined(ADDRESS_SANITIZER)
// ASan adds extra stack usage leading to too noisy asserts.
@@ -89,24 +88,27 @@ private:
static uintptr_t getFallbackStackLimit();
// The (pointer-valued) stack limit.
- static uintptr_t s_stackFrameLimit;
+ uintptr_t m_stackFrameLimit;
};
class StackFrameDepthScope {
haraken 2016/09/02 09:07:57 Conceptually StackFrameDepthScope should be equal
keishi 2016/09/06 12:54:22 Done.
STACK_ALLOCATED();
WTF_MAKE_NONCOPYABLE(StackFrameDepthScope);
public:
- StackFrameDepthScope()
+ StackFrameDepthScope(StackFrameDepth* depth): m_depth(depth)
haraken 2016/09/02 09:07:57 Add explicit.
keishi 2016/09/06 12:54:22 Done.
{
- StackFrameDepth::enableStackLimit();
+ m_depth->enableStackLimit();
// Enabled unless under stack pressure.
- ASSERT(StackFrameDepth::isSafeToRecurse() || !StackFrameDepth::isEnabled());
+ DCHECK(m_depth->isSafeToRecurse() || !m_depth->isEnabled());
}
~StackFrameDepthScope()
{
- StackFrameDepth::disableStackLimit();
+ m_depth->disableStackLimit();
}
+
+private:
+ StackFrameDepth* m_depth;
};
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698