Changeset 74455 in webkit
- Timestamp:
- Dec 21, 2010 8:29:33 PM (13 years ago)
- Location:
- trunk/JavaScriptCore
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/ChangeLog
r74454 r74455 1 2010-12-21 Gavin Barraclough <barraclough@apple.com> 2 3 Reviewed by Oliver Hunt. 4 5 Bug 26276 - Need a mechanism to determine stack extent 6 7 This patch adds accurate stack size calculation for: 8 DARWIN, QNX, UNIX 9 We still need to fix: 10 WINDOWS, SOLARIS, OPENBSD, SYMBIAN, HAIKU, WINCE 11 12 * wtf/StackBounds.cpp: 13 (WTF::StackBounds::initialize): 14 1 15 2010-12-21 Gavin Barraclough <barraclough@apple.com> 2 16 -
trunk/JavaScriptCore/wtf/StackBounds.cpp
r74415 r74455 58 58 namespace WTF { 59 59 60 // Bug 26276 - Need a mechanism to determine stack extent 61 // 62 // These platforms should now be working correctly: 63 // DARWIN, QNX, UNIX 64 // These platforms are not: 65 // WINDOWS, SOLARIS, OPENBSD, SYMBIAN, HAIKU, WINCE 66 // 67 // FIXME: remove this! - this code unsafely guesses at stack sizes! 68 #if OS(WINDOWS) || OS(SOLARIS) || OS(OPENBSD) || OS(SYMBIAN) || OS(HAIKU) || OS(WINCE) 60 69 // Based on the current limit used by the JSC parser, guess the stack size. 61 70 static const ptrdiff_t estimatedStackSize = 128 * sizeof(void*) * 1024; 62 63 71 // This method assumes the stack is growing downwards. 64 72 static void* estimateStackBound(void* origin) … … 66 74 return static_cast<char*>(origin) - estimatedStackSize; 67 75 } 76 #endif 68 77 69 78 #if OS(DARWIN) … … 73 82 pthread_t thread = pthread_self(); 74 83 m_origin = pthread_get_stackaddr_np(thread); 75 m_bound = estimateStackBound(m_origin);84 m_bound = static_cast<char*>(m_origin) - pthread_get_stacksize_np(thread); 76 85 } 77 86 … … 103 112 #error Need a way to get the stack bounds on this platform (Windows) 104 113 #endif 114 // Looks like we should be able to get pTib->StackLimit 105 115 m_bound = estimateStackBound(m_origin); 106 116 } … … 128 138 ASSERT(stackBase); 129 139 140 m_bound = stackBase; 130 141 m_origin = static_cast<char*>(stackBase) + stackSize; 131 m_bound = estimateStackBound(m_origin);132 142 } 133 143 … … 195 205 ASSERT(stackBase); 196 206 pthread_attr_destroy(&sattr); 207 m_bound = stackBase; 197 208 m_origin = static_cast<char*>(stackBase) + stackSize; 198 m_bound = estimateStackBound(m_origin);199 209 } 200 210
Note: See TracChangeset
for help on using the changeset viewer.