Changeset 74402 in webkit
- Timestamp:
- Dec 20, 2010 11:36:37 PM (13 years ago)
- Location:
- trunk
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/ChangeLog
r74382 r74402 1 2010-12-20 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, WINDOWS, QNX, UNIX 9 We still need to fix: 10 SOLARIS, OPENBSD, SYMBIAN, HAIKU, WINCE 11 12 * wtf/StackBounds.cpp: 13 (WTF::StackBounds::initialize): 14 1 15 2010-12-20 Gavin Barraclough <barraclough@apple.com> 2 16 -
trunk/JavaScriptCore/wtf/StackBounds.cpp
r74371 r74402 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, WINDOWS, QNX, UNIX 64 // These platforms are not: 65 // SOLARIS, OPENBSD, SYMBIAN, HAIKU, WINCE 66 // 67 // FIXME: remove this! - this code unsafely guesses at stack sizes! 68 #if 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 … … 89 98 } 90 99 m_origin = static_cast<void*>(pTib->StackBase); 100 m_bound = static_cast<void*>(pTib->StackLimit); 91 101 #elif OS(WINDOWS) && CPU(X86) && COMPILER(GCC) 92 102 // offset 0x18 from the FS segment register gives a pointer to … … 97 107 ); 98 108 m_origin = static_cast<void*>(pTib->StackBase); 109 m_bound = static_cast<void*>(pTib->StackLimit); 99 110 #elif OS(WINDOWS) && CPU(X86_64) 100 111 PNT_TIB64 pTib = reinterpret_cast<PNT_TIB64>(NtCurrentTeb()); 101 112 m_origin = reinterpret_cast<void*>(pTib->StackBase); 113 m_bound = reinterpret_cast<void*>(pTib->StackLimit); 102 114 #else 103 115 #error Need a way to get the stack bounds on this platform (Windows) 104 116 #endif 105 m_bound = estimateStackBound(m_origin);106 117 } 107 118 … … 128 139 ASSERT(stackBase); 129 140 141 m_bound = stackBase; 130 142 m_origin = static_cast<char*>(stackBase) + stackSize; 131 m_bound = estimateStackBound(m_origin);132 143 } 133 144 … … 195 206 ASSERT(stackBase); 196 207 pthread_attr_destroy(&sattr); 208 m_bound = stackBase; 197 209 m_origin = static_cast<char*>(stackBase) + stackSize; 198 m_bound = estimateStackBound(m_origin);199 210 } 200 211 -
trunk/LayoutTests/ChangeLog
r74401 r74402 1 2010-12-20 Gavin Barraclough <barraclough@apple.com> 2 3 Reviewed by Oliver Hunt. 4 5 Bug 26276 - Need a mechanism to determine stack extent 6 7 Correctly measuring available stack increases the size of expression we can handle! 8 9 * fast/js/large-expressions-expected.txt: 10 * fast/js/script-tests/large-expressions.js: 11 1 12 2010-12-20 Yuzo Fujishima <yuzo@google.com> 2 13 -
trunk/LayoutTests/fast/js/large-expressions-expected.txt
r38247 r74402 6 6 PASS eval(repeatedExpression("letterA", "+", 100)) is repeatedString("a", 100) 7 7 PASS eval(repeatedExpression("letterA", "+", 1000)) is repeatedString("a", 1000) 8 PASS eval(repeatedExpression("letterA", "+", 10000)) threw exception SyntaxError: Expression too deep.8 PASS eval(repeatedExpression("letterA", "+", 10000)) is repeatedString("a", 10000) 9 9 PASS eval(repeatedExpression("letterA", "+", 100000)) threw exception SyntaxError: Expression too deep. 10 10 PASS successfullyParsed is true -
trunk/LayoutTests/fast/js/script-tests/large-expressions.js
r48651 r74402 27 27 shouldBe('eval(repeatedExpression("letterA", "+", 100))', 'repeatedString("a", 100)'); 28 28 shouldBe('eval(repeatedExpression("letterA", "+", 1000))', 'repeatedString("a", 1000)'); 29 should Throw('eval(repeatedExpression("letterA", "+", 10000))', '"SyntaxError: Expression too deep"');29 shouldBe('eval(repeatedExpression("letterA", "+", 10000))', 'repeatedString("a", 10000)'); 30 30 shouldThrow('eval(repeatedExpression("letterA", "+", 100000))', '"SyntaxError: Expression too deep"'); 31 31
Note: See TracChangeset
for help on using the changeset viewer.