[SCM] WebKit Debian packaging branch, debian/experimental, updated. debian/1.3.8-1-142-g786665c

barraclough at apple.com barraclough at apple.com
Mon Dec 27 16:26:54 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit fec357c42e0c5d4cae65f28c00fb4b3ecd97e1ef
Author: barraclough at apple.com <barraclough at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Tue Dec 21 07:36:37 2010 +0000

    Bug 26276 - Need a mechanism to determine stack extent
    
    Reviewed by Oliver Hunt.
    
    JavaScriptCore:
    
    This patch adds accurate stack size calculation for:
        DARWIN, WINDOWS, QNX, UNIX
    We still need to fix:
        SOLARIS, OPENBSD, SYMBIAN, HAIKU, WINCE
    
    * wtf/StackBounds.cpp:
    (WTF::StackBounds::initialize):
    
    LayoutTests:
    
    Correctly measuring available stack increases the size of expression we can handle!
    
    * fast/js/large-expressions-expected.txt:
    * fast/js/script-tests/large-expressions.js:
    
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@74402 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/JavaScriptCore/ChangeLog b/JavaScriptCore/ChangeLog
index e927c5e..fcd7e21 100644
--- a/JavaScriptCore/ChangeLog
+++ b/JavaScriptCore/ChangeLog
@@ -1,5 +1,19 @@
 2010-12-20  Gavin Barraclough  <barraclough at apple.com>
 
+        Reviewed by Oliver Hunt.
+
+        Bug 26276 - Need a mechanism to determine stack extent
+
+        This patch adds accurate stack size calculation for:
+            DARWIN, WINDOWS, QNX, UNIX
+        We still need to fix:
+            SOLARIS, OPENBSD, SYMBIAN, HAIKU, WINCE
+
+        * wtf/StackBounds.cpp:
+        (WTF::StackBounds::initialize):
+
+2010-12-20  Gavin Barraclough  <barraclough at apple.com>
+
         PPC build fix; stop using std::swap on PageAllocation/PageReservation,
         this was failing on some compilers since the lack of default construction
         for the m_executable/m_writable fields meant the value being swapped may
diff --git a/JavaScriptCore/wtf/StackBounds.cpp b/JavaScriptCore/wtf/StackBounds.cpp
index 2f91c2b..0ae7ebf 100644
--- a/JavaScriptCore/wtf/StackBounds.cpp
+++ b/JavaScriptCore/wtf/StackBounds.cpp
@@ -57,14 +57,23 @@
 
 namespace WTF {
 
+// Bug 26276 - Need a mechanism to determine stack extent
+//
+// These platforms should now be working correctly:
+//     DARWIN, WINDOWS, QNX, UNIX
+// These platforms are not:
+//     SOLARIS, OPENBSD, SYMBIAN, HAIKU, WINCE
+//
+// FIXME: remove this! - this code unsafely guesses at stack sizes!
+#if OS(SOLARIS) || OS(OPENBSD) || OS(SYMBIAN) || OS(HAIKU) || OS(WINCE)
 // Based on the current limit used by the JSC parser, guess the stack size.
 static const ptrdiff_t estimatedStackSize = 128 * sizeof(void*) * 1024;
-
 // This method assumes the stack is growing downwards.
 static void* estimateStackBound(void* origin)
 {
     return static_cast<char*>(origin) - estimatedStackSize;
 }
+#endif
 
 #if OS(DARWIN)
 
@@ -72,7 +81,7 @@ void StackBounds::initialize()
 {
     pthread_t thread = pthread_self();
     m_origin = pthread_get_stackaddr_np(thread);
-    m_bound = estimateStackBound(m_origin);
+    m_bound = static_cast<char*>(m_origin) - pthread_get_stacksize_np(thread);
 }
 
 #elif OS(WINDOWS)
@@ -88,6 +97,7 @@ void StackBounds::initialize()
         MOV pTib, EAX
     }
     m_origin = static_cast<void*>(pTib->StackBase);
+    m_bound = static_cast<void*>(pTib->StackLimit);
 #elif OS(WINDOWS) && CPU(X86) && COMPILER(GCC)
     // offset 0x18 from the FS segment register gives a pointer to
     // the thread information block for the current thread
@@ -96,13 +106,14 @@ void StackBounds::initialize()
           : "=r" (pTib)
         );
     m_origin = static_cast<void*>(pTib->StackBase);
+    m_bound = static_cast<void*>(pTib->StackLimit);
 #elif OS(WINDOWS) && CPU(X86_64)
     PNT_TIB64 pTib = reinterpret_cast<PNT_TIB64>(NtCurrentTeb());
     m_origin = reinterpret_cast<void*>(pTib->StackBase);
+    m_bound = reinterpret_cast<void*>(pTib->StackLimit);
 #else
 #error Need a way to get the stack bounds on this platform (Windows)
 #endif
-    m_bound = estimateStackBound(m_origin);
 }
 
 #elif OS(QNX)
@@ -127,8 +138,8 @@ void StackBounds::initialize()
     stackSize = threadInfo.stksize;
     ASSERT(stackBase);
 
+    m_bound = stackBase;
     m_origin = static_cast<char*>(stackBase) + stackSize;
-    m_bound = estimateStackBound(m_origin);
 }
 
 #elif OS(SOLARIS)
@@ -194,8 +205,8 @@ void StackBounds::initialize()
     (void)rc; // FIXME: Deal with error code somehow? Seems fatal.
     ASSERT(stackBase);
     pthread_attr_destroy(&sattr);
+    m_bound = stackBase;
     m_origin = static_cast<char*>(stackBase) + stackSize;
-    m_bound = estimateStackBound(m_origin);
 }
 
 #elif OS(WINCE)
diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index e5be2ae..4e0c8b6 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,14 @@
+2010-12-20  Gavin Barraclough  <barraclough at apple.com>
+
+        Reviewed by Oliver Hunt.
+
+        Bug 26276 - Need a mechanism to determine stack extent
+
+        Correctly measuring available stack increases the size of expression we can handle!
+
+        * fast/js/large-expressions-expected.txt:
+        * fast/js/script-tests/large-expressions.js:
+
 2010-12-20  Yuzo Fujishima  <yuzo at google.com>
 
         Reviewed by Eric Seidel.
diff --git a/LayoutTests/fast/js/large-expressions-expected.txt b/LayoutTests/fast/js/large-expressions-expected.txt
index 3306023..743964f 100644
--- a/LayoutTests/fast/js/large-expressions-expected.txt
+++ b/LayoutTests/fast/js/large-expressions-expected.txt
@@ -5,7 +5,7 @@ On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE
 
 PASS eval(repeatedExpression("letterA", "+", 100)) is repeatedString("a", 100)
 PASS eval(repeatedExpression("letterA", "+", 1000)) is repeatedString("a", 1000)
-PASS eval(repeatedExpression("letterA", "+", 10000)) threw exception SyntaxError: Expression too deep.
+PASS eval(repeatedExpression("letterA", "+", 10000)) is repeatedString("a", 10000)
 PASS eval(repeatedExpression("letterA", "+", 100000)) threw exception SyntaxError: Expression too deep.
 PASS successfullyParsed is true
 
diff --git a/LayoutTests/fast/js/script-tests/large-expressions.js b/LayoutTests/fast/js/script-tests/large-expressions.js
index 2bc3f3a..c019cc8 100644
--- a/LayoutTests/fast/js/script-tests/large-expressions.js
+++ b/LayoutTests/fast/js/script-tests/large-expressions.js
@@ -26,7 +26,7 @@ function repeatedString(value, count)
 
 shouldBe('eval(repeatedExpression("letterA", "+", 100))', 'repeatedString("a", 100)');
 shouldBe('eval(repeatedExpression("letterA", "+", 1000))', 'repeatedString("a", 1000)');
-shouldThrow('eval(repeatedExpression("letterA", "+", 10000))', '"SyntaxError: Expression too deep"');
+shouldBe('eval(repeatedExpression("letterA", "+", 10000))', 'repeatedString("a", 10000)');
 shouldThrow('eval(repeatedExpression("letterA", "+", 100000))', '"SyntaxError: Expression too deep"');
 
 var successfullyParsed = true;

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list