[prev in list] [next in list] [prev in thread] [next in thread] 

List:       webkit-changes
Subject:    [webkit-changes] [74595] trunk/JavaScriptCore
From:       paroga () webkit ! org
Date:       2010-12-24 1:03:28
Message-ID: 20101224010328.7D53A60ADED9 () beta ! macosforge ! org
[Download RAW message or body]

[Attachment #2 (text/html)]

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[74595] trunk/JavaScriptCore</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: \
verdana,arial,helvetica,sans-serif; font-size: 10pt;  } #msg dl a { font-weight: \
bold} #msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: \
bold; } #msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: \
6px; } #logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em \
0; } #logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg \
h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; } \
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; \
} #logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: \
-1.5em; padding-left: 1.5em; } #logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em \
1em 0 1em; background: white;} #logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid \
#fa0; border-bottom: 1px solid #fa0; background: #fff; } #logmsg table th { \
text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted \
#fa0; } #logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: \
0.2em 0.5em; } #logmsg table thead th { text-align: center; border-bottom: 1px solid \
#fa0; } #logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: \
6px; } #patch { width: 100%; }
#patch h4 {font-family: \
verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
 #patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, \
#patch .copfile {border:1px solid #ccc;margin:10px 0;} #patch ins \
{background:#dfd;text-decoration:none;display:block;padding:0 10px;} #patch del \
{background:#fdd;text-decoration:none;display:block;padding:0 10px;} #patch .lines, \
                .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a \
href="http://trac.webkit.org/projects/webkit/changeset/74595">74595</a></dd> \
<dt>Author</dt> <dd>paroga@webkit.org</dd> <dt>Date</dt> <dd>2010-12-23 17:03:23 \
-0800 (Thu, 23 Dec 2010)</dd> </dl>

<h3>Log Message</h3>
<pre>2010-12-23  Patrick Gansterer  &lt;paroga@webkit.org&gt;

        Unreviewed build fix for WinCE after <a \
href="http://trac.webkit.org/projects/webkit/changeset/74360">r74360</a>.

        Move the OS(WINDOWS) section after the OS(WINCE) section
        and add missing argument to the getStackMax call.

        * wtf/StackBounds.cpp:
        (WTF::StackBounds::initialize):</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkJavaScriptCoreChangeLog">trunk/JavaScriptCore/ChangeLog</a></li>
<li><a href="#trunkJavaScriptCorewtfStackBoundscpp">trunk/JavaScriptCore/wtf/StackBounds.cpp</a></li>
 </ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkJavaScriptCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/JavaScriptCore/ChangeLog (74594 => \
74595)</h4> <pre class="diff"><span>
<span class="info">--- trunk/JavaScriptCore/ChangeLog	2010-12-24 00:55:48 UTC (rev \
                74594)
+++ trunk/JavaScriptCore/ChangeLog	2010-12-24 01:03:23 UTC (rev 74595)
</span><span class="lines">@@ -1,3 +1,13 @@
</span><ins>+2010-12-23  Patrick Gansterer  &lt;paroga@webkit.org&gt;
+
+        Unreviewed build fix for WinCE after r74360.
+
+        Move the OS(WINDOWS) section after the OS(WINCE) section
+        and add missing argument to the getStackMax call.
+
+        * wtf/StackBounds.cpp:
+        (WTF::StackBounds::initialize):
+
</ins><span class="cx"> 2010-12-22  Laszlo Gombos  &lt;laszlo.1.gombos@nokia.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Unreviewed build fix.
</span></span></pre></div>
<a id="trunkJavaScriptCorewtfStackBoundscpp"></a>
<div class="modfile"><h4>Modified: trunk/JavaScriptCore/wtf/StackBounds.cpp (74594 => \
74595)</h4> <pre class="diff"><span>
<span class="info">--- trunk/JavaScriptCore/wtf/StackBounds.cpp	2010-12-24 00:55:48 \
                UTC (rev 74594)
+++ trunk/JavaScriptCore/wtf/StackBounds.cpp	2010-12-24 01:03:23 UTC (rev 74595)
</span><span class="lines">@@ -1,283 +1,284 @@
</span><del>-/*
- *  Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights \
                reserved.
- *  Copyright (C) 2007 Eric Seidel &lt;eric@webkit.org&gt;
- *
- *  This library is free software; you can redistribute it and/or
- *  modify it under the terms of the GNU Lesser General Public
- *  License as published by the Free Software Foundation; either
- *  version 2 of the License, or (at your option) any later version.
- *
- *  This library is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- *  Lesser General Public License for more details.
- *
- *  You should have received a copy of the GNU Lesser General Public
- *  License along with this library; if not, write to the Free Software
- *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
- *
- */
-
-#include &quot;config.h&quot;
-#include &quot;StackBounds.h&quot;
-
-#if OS(DARWIN)
-
-#include &lt;mach/task.h&gt;
-#include &lt;mach/thread_act.h&gt;
-#include &lt;pthread.h&gt;
-
-#elif OS(WINDOWS)
-
-#include &lt;windows.h&gt;
-
-#elif OS(HAIKU)
-
-#include &lt;OS.h&gt;
-
-#elif OS(SOLARIS)
-
-#include &lt;thread.h&gt;
-
-#elif OS(QNX)
-
-#include &lt;fcntl.h&gt;
-#include &lt;sys/procfs.h&gt;
-#include &lt;stdio.h&gt;
-#include &lt;errno.h&gt;
-
-#elif OS(UNIX)
-
-#include &lt;pthread.h&gt;
-#if HAVE(PTHREAD_NP_H)
-#include &lt;pthread_np.h&gt;
-#endif
-
-#endif
-
-namespace WTF {
-
-// Bug 26276 - Need a mechanism to determine stack extent
-//
-// These platforms should now be working correctly:
-//     DARWIN, QNX, UNIX
-// These platforms are not:
-//     WINDOWS, SOLARIS, OPENBSD, SYMBIAN, HAIKU, WINCE
-//
-// FIXME: remove this! - this code unsafely guesses at stack sizes!
-#if OS(WINDOWS) || 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&lt;char*&gt;(origin) - estimatedStackSize;
-}
-#endif
-
-#if OS(DARWIN)
-
-void StackBounds::initialize()
-{
-    pthread_t thread = pthread_self();
-    m_origin = pthread_get_stackaddr_np(thread);
-    m_bound = static_cast&lt;char*&gt;(m_origin) - pthread_get_stacksize_np(thread);
-}
-
-#elif OS(WINDOWS)
-
-void StackBounds::initialize()
-{
-#if CPU(X86) &amp;&amp; COMPILER(MSVC)
-    // offset 0x18 from the FS segment register gives a pointer to
-    // the thread information block for the current thread
-    NT_TIB* pTib;
-    __asm {
-        MOV EAX, FS:[18h]
-        MOV pTib, EAX
-    }
-    m_origin = static_cast&lt;void*&gt;(pTib-&gt;StackBase);
-#elif OS(WINDOWS) &amp;&amp; CPU(X86) &amp;&amp; COMPILER(GCC)
-    // offset 0x18 from the FS segment register gives a pointer to
-    // the thread information block for the current thread
-    NT_TIB* pTib;
-    asm ( &quot;movl %%fs:0x18, %0\n&quot;
-          : &quot;=r&quot; (pTib)
-        );
-    m_origin = static_cast&lt;void*&gt;(pTib-&gt;StackBase);
-#elif OS(WINDOWS) &amp;&amp; CPU(X86_64)
-    PNT_TIB64 pTib = reinterpret_cast&lt;PNT_TIB64&gt;(NtCurrentTeb());
-    m_origin = reinterpret_cast&lt;void*&gt;(pTib-&gt;StackBase);
-#else
-#error Need a way to get the stack bounds on this platform (Windows)
-#endif
-    // Looks like we should be able to get pTib-&gt;StackLimit
-    m_bound = estimateStackBound(m_origin);
-}
-
-#elif OS(QNX)
-
-void StackBounds::initialize()
-{
-    void* stackBase = 0;
-    size_t stackSize = 0;
-    pthread_t thread = pthread_self();
-
-    struct _debug_thread_info threadInfo;
-    memset(&amp;threadInfo, 0, sizeof(threadInfo));
-    threadInfo.tid = pthread_self();
-    int fd = open(&quot;/proc/self&quot;, O_RDONLY);
-    if (fd == -1) {
-        LOG_ERROR(&quot;Unable to open /proc/self (errno: %d)&quot;, errno);
-        CRASH();
-    }
-    devctl(fd, DCMD_PROC_TIDSTATUS, &amp;threadInfo, sizeof(threadInfo), 0);
-    close(fd);
-    stackBase = reinterpret_cast&lt;void*&gt;(threadInfo.stkbase);
-    stackSize = threadInfo.stksize;
-    ASSERT(stackBase);
-
-    m_bound = stackBase;
-    m_origin = static_cast&lt;char*&gt;(stackBase) + stackSize;
-}
-
-#elif OS(SOLARIS)
-
-void StackBounds::initialize()
-{
-    stack_t s;
-    thr_stksegment(&amp;s);
-    m_origin = s.ss_sp;
-    m_bound = estimateStackBound(m_origin);
-}
-
-#elif OS(OPENBSD)
-
-void StackBounds::initialize()
-{
-    pthread_t thread = pthread_self();
-    stack_t stack;
-    pthread_stackseg_np(thread, &amp;stack);
-    m_origin = stack.ss_sp;
-    m_bound = estimateStackBound(m_origin);
-}
-
-#elif OS(SYMBIAN)
-
-void StackBounds::initialize()
-{
-    TThreadStackInfo info;
-    RThread thread;
-    thread.StackInfo(info);
-    m_origin = (void*)info.iBase;
-    m_bound = estimateStackBound(m_origin);
-}
-
-#elif OS(HAIKU)
-
-void StackBounds::initialize()
-{
-    thread_info threadInfo;
-    get_thread_info(find_thread(NULL), &amp;threadInfo);
-    m_origin = threadInfo.stack_end;
-    m_bound = estimateStackBound(m_origin);
-}
-
-#elif OS(UNIX)
-
-void StackBounds::initialize()
-{
-    void* stackBase = 0;
-    size_t stackSize = 0;
-
-    pthread_t thread = pthread_self();
-    pthread_attr_t sattr;
-    pthread_attr_init(&amp;sattr);
-#if HAVE(PTHREAD_NP_H) || OS(NETBSD)
-    // e.g. on FreeBSD 5.4, neundorf@kde.org
-    pthread_attr_get_np(thread, &amp;sattr);
-#else
-    // FIXME: this function is non-portable; other POSIX systems may have different \
                np alternatives
-    pthread_getattr_np(thread, &amp;sattr);
-#endif
-    int rc = pthread_attr_getstack(&amp;sattr, &amp;stackBase, &amp;stackSize);
-    (void)rc; // FIXME: Deal with error code somehow? Seems fatal.
-    ASSERT(stackBase);
-    pthread_attr_destroy(&amp;sattr);
-    m_bound = stackBase;
-    m_origin = static_cast&lt;char*&gt;(stackBase) + stackSize;
-}
-
-#elif OS(WINCE)
-
-} // namespace WTF
-// FIXME: this is not threadsafe, and should probably be removed.
-namespace JSC { JS_EXPORTDATA void* g_stackBase = 0; }
-namespace WTF {
-
-inline bool isPageWritable(void* page)
-{
-    MEMORY_BASIC_INFORMATION memoryInformation;
-    DWORD result = VirtualQuery(page, &amp;memoryInformation, \
                sizeof(memoryInformation));
-
-    // return false on error, including ptr outside memory
-    if (result != sizeof(memoryInformation))
-        return false;
-
-    DWORD protect = memoryInformation.Protect &amp; ~(PAGE_GUARD | PAGE_NOCACHE);
-    return protect == PAGE_READWRITE
-        || protect == PAGE_WRITECOPY
-        || protect == PAGE_EXECUTE_READWRITE
-        || protect == PAGE_EXECUTE_WRITECOPY;
-}
-
-static void* getStackMax(void* previousFrame, bool&amp; isGrowingDownward)
-{
-    // find the address of this stack frame by taking the address of a local \
                variable
-    void* thisFrame = &amp;thisFrame;
-    isGrowingDownward = previousFrame &lt; &amp;thisFrame;
-
-    if (JSC::g_stackBase)
-        return JSC::g_stackBase;
-
-    SYSTEM_INFO systemInfo;
-    GetSystemInfo(&amp;systemInfo);
-    DWORD pageSize = systemInfo.dwPageSize;
-
-    // scan all of memory starting from this frame, and return the last writeable \
                page found
-    register char* currentPage = (char*)((DWORD)thisFrame &amp; ~(pageSize - 1));
-    if (isGrowingDownward) {
-        while (currentPage &gt; 0) {
-            // check for underflow
-            if (currentPage &gt;= (char*)pageSize)
-                currentPage -= pageSize;
-            else
-                currentPage = 0;
-            if (!isPageWritable(currentPage))
-                return currentPage + pageSize;
-        }
-        return 0;
-    } else {
-        while (true) {
-            // guaranteed to complete because isPageWritable returns false at end of \
                memory
-            currentPage += pageSize;
-            if (!isPageWritable(currentPage))
-                return currentPage;
-        }
-    }
-}
-
-void StackBounds::initialize()
-{
-    bool isGrowingDownward
-    m_origin = getStackMax(isGrowingDownward);
-    m_bound = isGrowingDownward
-        ? static_cast&lt;char*&gt;(m_origin) - estimatedStackSize
-        : static_cast&lt;char*&gt;(m_origin) + estimatedStackSize;
-}
-
-#else
-#error Need a way to get the stack bounds on this platform
-#endif
-
-} // namespace WTF
</del><ins>+/*
+ *  Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights \
reserved. + *  Copyright (C) 2007 Eric Seidel &lt;eric@webkit.org&gt;
+ *
+ *  This library is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU Lesser General Public
+ *  License as published by the Free Software Foundation; either
+ *  version 2 of the License, or (at your option) any later version.
+ *
+ *  This library is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ *  Lesser General Public License for more details.
+ *
+ *  You should have received a copy of the GNU Lesser General Public
+ *  License along with this library; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ *
+ */
+
+#include &quot;config.h&quot;
+#include &quot;StackBounds.h&quot;
+
+#if OS(DARWIN)
+
+#include &lt;mach/task.h&gt;
+#include &lt;mach/thread_act.h&gt;
+#include &lt;pthread.h&gt;
+
+#elif OS(WINDOWS)
+
+#include &lt;windows.h&gt;
+
+#elif OS(HAIKU)
+
+#include &lt;OS.h&gt;
+
+#elif OS(SOLARIS)
+
+#include &lt;thread.h&gt;
+
+#elif OS(QNX)
+
+#include &lt;fcntl.h&gt;
+#include &lt;sys/procfs.h&gt;
+#include &lt;stdio.h&gt;
+#include &lt;errno.h&gt;
+
+#elif OS(UNIX)
+
+#include &lt;pthread.h&gt;
+#if HAVE(PTHREAD_NP_H)
+#include &lt;pthread_np.h&gt;
+#endif
+
+#endif
+
+namespace WTF {
+
+// Bug 26276 - Need a mechanism to determine stack extent
+//
+// These platforms should now be working correctly:
+//     DARWIN, QNX, UNIX
+// These platforms are not:
+//     WINDOWS, SOLARIS, OPENBSD, SYMBIAN, HAIKU, WINCE
+//
+// FIXME: remove this! - this code unsafely guesses at stack sizes!
+#if OS(WINDOWS) || 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&lt;char*&gt;(origin) - estimatedStackSize;
+}
+#endif
+
+#if OS(DARWIN)
+
+void StackBounds::initialize()
+{
+    pthread_t thread = pthread_self();
+    m_origin = pthread_get_stackaddr_np(thread);
+    m_bound = static_cast&lt;char*&gt;(m_origin) - pthread_get_stacksize_np(thread);
+}
+
+#elif OS(QNX)
+
+void StackBounds::initialize()
+{
+    void* stackBase = 0;
+    size_t stackSize = 0;
+    pthread_t thread = pthread_self();
+
+    struct _debug_thread_info threadInfo;
+    memset(&amp;threadInfo, 0, sizeof(threadInfo));
+    threadInfo.tid = pthread_self();
+    int fd = open(&quot;/proc/self&quot;, O_RDONLY);
+    if (fd == -1) {
+        LOG_ERROR(&quot;Unable to open /proc/self (errno: %d)&quot;, errno);
+        CRASH();
+    }
+    devctl(fd, DCMD_PROC_TIDSTATUS, &amp;threadInfo, sizeof(threadInfo), 0);
+    close(fd);
+    stackBase = reinterpret_cast&lt;void*&gt;(threadInfo.stkbase);
+    stackSize = threadInfo.stksize;
+    ASSERT(stackBase);
+
+    m_bound = stackBase;
+    m_origin = static_cast&lt;char*&gt;(stackBase) + stackSize;
+}
+
+#elif OS(SOLARIS)
+
+void StackBounds::initialize()
+{
+    stack_t s;
+    thr_stksegment(&amp;s);
+    m_origin = s.ss_sp;
+    m_bound = estimateStackBound(m_origin);
+}
+
+#elif OS(OPENBSD)
+
+void StackBounds::initialize()
+{
+    pthread_t thread = pthread_self();
+    stack_t stack;
+    pthread_stackseg_np(thread, &amp;stack);
+    m_origin = stack.ss_sp;
+    m_bound = estimateStackBound(m_origin);
+}
+
+#elif OS(SYMBIAN)
+
+void StackBounds::initialize()
+{
+    TThreadStackInfo info;
+    RThread thread;
+    thread.StackInfo(info);
+    m_origin = (void*)info.iBase;
+    m_bound = estimateStackBound(m_origin);
+}
+
+#elif OS(HAIKU)
+
+void StackBounds::initialize()
+{
+    thread_info threadInfo;
+    get_thread_info(find_thread(NULL), &amp;threadInfo);
+    m_origin = threadInfo.stack_end;
+    m_bound = estimateStackBound(m_origin);
+}
+
+#elif OS(UNIX)
+
+void StackBounds::initialize()
+{
+    void* stackBase = 0;
+    size_t stackSize = 0;
+
+    pthread_t thread = pthread_self();
+    pthread_attr_t sattr;
+    pthread_attr_init(&amp;sattr);
+#if HAVE(PTHREAD_NP_H) || OS(NETBSD)
+    // e.g. on FreeBSD 5.4, neundorf@kde.org
+    pthread_attr_get_np(thread, &amp;sattr);
+#else
+    // FIXME: this function is non-portable; other POSIX systems may have different \
np alternatives +    pthread_getattr_np(thread, &amp;sattr);
+#endif
+    int rc = pthread_attr_getstack(&amp;sattr, &amp;stackBase, &amp;stackSize);
+    (void)rc; // FIXME: Deal with error code somehow? Seems fatal.
+    ASSERT(stackBase);
+    pthread_attr_destroy(&amp;sattr);
+    m_bound = stackBase;
+    m_origin = static_cast&lt;char*&gt;(stackBase) + stackSize;
+}
+
+#elif OS(WINCE)
+
+} // namespace WTF
+// FIXME: this is not threadsafe, and should probably be removed.
+namespace JSC { JS_EXPORTDATA void* g_stackBase = 0; }
+namespace WTF {
+
+inline bool isPageWritable(void* page)
+{
+    MEMORY_BASIC_INFORMATION memoryInformation;
+    DWORD result = VirtualQuery(page, &amp;memoryInformation, \
sizeof(memoryInformation)); +
+    // return false on error, including ptr outside memory
+    if (result != sizeof(memoryInformation))
+        return false;
+
+    DWORD protect = memoryInformation.Protect &amp; ~(PAGE_GUARD | PAGE_NOCACHE);
+    return protect == PAGE_READWRITE
+        || protect == PAGE_WRITECOPY
+        || protect == PAGE_EXECUTE_READWRITE
+        || protect == PAGE_EXECUTE_WRITECOPY;
+}
+
+static void* getStackMax(void* previousFrame, bool&amp; isGrowingDownward)
+{
+    // find the address of this stack frame by taking the address of a local \
variable +    void* thisFrame = &amp;thisFrame;
+    isGrowingDownward = previousFrame &lt; &amp;thisFrame;
+
+    if (JSC::g_stackBase)
+        return JSC::g_stackBase;
+
+    SYSTEM_INFO systemInfo;
+    GetSystemInfo(&amp;systemInfo);
+    DWORD pageSize = systemInfo.dwPageSize;
+
+    // scan all of memory starting from this frame, and return the last writeable \
page found +    register char* currentPage = (char*)((DWORD)thisFrame &amp; \
~(pageSize - 1)); +    if (isGrowingDownward) {
+        while (currentPage &gt; 0) {
+            // check for underflow
+            if (currentPage &gt;= (char*)pageSize)
+                currentPage -= pageSize;
+            else
+                currentPage = 0;
+            if (!isPageWritable(currentPage))
+                return currentPage + pageSize;
+        }
+        return 0;
+    } else {
+        while (true) {
+            // guaranteed to complete because isPageWritable returns false at end of \
memory +            currentPage += pageSize;
+            if (!isPageWritable(currentPage))
+                return currentPage;
+        }
+    }
+}
+
+void StackBounds::initialize()
+{
+    int dummy;
+    bool isGrowingDownward;
+    m_origin = getStackMax(&amp;dummy, isGrowingDownward);
+    m_bound = isGrowingDownward
+        ? static_cast&lt;char*&gt;(m_origin) - estimatedStackSize
+        : static_cast&lt;char*&gt;(m_origin) + estimatedStackSize;
+}
+
+#elif OS(WINDOWS)
+
+void StackBounds::initialize()
+{
+#if CPU(X86) &amp;&amp; COMPILER(MSVC)
+    // offset 0x18 from the FS segment register gives a pointer to
+    // the thread information block for the current thread
+    NT_TIB* pTib;
+    __asm {
+        MOV EAX, FS:[18h]
+        MOV pTib, EAX
+    }
+    m_origin = static_cast&lt;void*&gt;(pTib-&gt;StackBase);
+#elif CPU(X86) &amp;&amp; COMPILER(GCC)
+    // offset 0x18 from the FS segment register gives a pointer to
+    // the thread information block for the current thread
+    NT_TIB* pTib;
+    asm ( &quot;movl %%fs:0x18, %0\n&quot;
+          : &quot;=r&quot; (pTib)
+        );
+    m_origin = static_cast&lt;void*&gt;(pTib-&gt;StackBase);
+#elif CPU(X86_64)
+    PNT_TIB64 pTib = reinterpret_cast&lt;PNT_TIB64&gt;(NtCurrentTeb());
+    m_origin = reinterpret_cast&lt;void*&gt;(pTib-&gt;StackBase);
+#else
+#error Need a way to get the stack bounds on this platform (Windows)
+#endif
+    // Looks like we should be able to get pTib-&gt;StackLimit
+    m_bound = estimateStackBound(m_origin);
+}
+
+#else
+#error Need a way to get the stack bounds on this platform
+#endif
+
+} // namespace WTF
</ins></span></pre>
</div>
</div>

</body>
</html>



_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic