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

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

Issue 953453003: Revert of [Oilpan] Set stack limit using estimated sizes (Re-land) (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 10 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 | « no previous file | Source/platform/heap/ThreadState.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/platform/heap/StackFrameDepth.cpp
diff --git a/Source/platform/heap/StackFrameDepth.cpp b/Source/platform/heap/StackFrameDepth.cpp
index 5295f81bb3339fd2be94390a565d66dee2956c20..2d7985a1d3bf9fd1d72f07cb50a8673e3ff6c5eb 100644
--- a/Source/platform/heap/StackFrameDepth.cpp
+++ b/Source/platform/heap/StackFrameDepth.cpp
@@ -29,17 +29,7 @@
void StackFrameDepth::configureLimit()
{
- static const int kStackRoomSize = 1024;
-
- size_t stackSize = getUnderestimatedStackSize();
- if (stackSize) {
- size_t stackBase = reinterpret_cast<size_t>(getStackStart());
- m_stackFrameLimit = stackBase - stackSize + kStackRoomSize;
- return;
- }
-
- // Fallback version
- // Allocate a 32KB object on stack and query stack frame base after it.
+ // Allocate a large object in stack and query stack frame pointer after it.
char dummy[kSafeStackFrameSize];
m_stackFrameLimit = currentStackFrameBaseOnCallee(dummy);
@@ -49,39 +39,14 @@
size_t StackFrameDepth::getUnderestimatedStackSize()
{
- // FIXME: On Mac OSX and Linux, this method cannot estimate stack size
- // correctly for the main thread.
-
#if defined(__GLIBC__) || OS(ANDROID) || OS(FREEBSD)
- // pthread_getattr_np() can fail if the thread is not invoked by
- // pthread_create() (e.g., the main thread of webkit_unit_tests).
- // In this case, this method returns 0 and the caller must handle it.
-
- pthread_attr_t attr;
- int error;
-#if OS(FREEBSD)
- pthread_attr_init(&attr);
- error = pthread_attr_get_np(pthread_self(), &attr);
-#else
- error = pthread_getattr_np(pthread_self(), &attr);
-#endif
- if (!error) {
- void* base;
- size_t size;
- error = pthread_attr_getstack(&attr, &base, &size);
- RELEASE_ASSERT(!error);
- pthread_attr_destroy(&attr);
- return size;
- }
-#if OS(FREEBSD)
- pthread_attr_destroy(&attr);
-#endif
-
+ // We cannot get the stack size in these platforms because
+ // pthread_getattr_np() can fail for the main thread.
+ // This is OK because ThreadState::current() doesn't use the stack size
+ // in these platforms.
return 0;
#elif OS(MACOSX)
- // FIXME: pthread_get_stacksize_np() returns shorter size than actual stack
- // size for the main thread on Mavericks(10.9).
- return 0;
+ return pthread_get_stacksize_np(pthread_self());
#elif OS(WIN) && COMPILER(MSVC)
// On Windows stack limits for the current thread are available in
// the thread information block (TIB). Its fields can be accessed through
@@ -92,7 +57,6 @@
return __readfsdword(offsetof(NT_TIB, StackBase)) - __readfsdword(offsetof(NT_TIB, StackLimit));
#endif
#else
-#error "Stack frame size estimation not supported on this platform."
return 0;
#endif
}
« no previous file with comments | « no previous file | Source/platform/heap/ThreadState.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698