bug 672493 - skip native stack check under GLIBC. r=dmandelin
authorIgor Bukanov <igor@mir2.org>
Wed, 20 Jul 2011 13:26:35 +0200
changeset 76376 d05513502cdc0ac1e6b8b9f27eb15fec34954e6e
parent 76375 04545026b4ae067e8f2aeb7258ff1e09de458575
child 76377 56bb9cbd6c26defa6a9f55dec9bd8509d9f0fdfd
push id3
push userfelipc@gmail.com
push dateFri, 30 Sep 2011 20:09:13 +0000
reviewersdmandelin
bugs672493
milestone9.0a1
bug 672493 - skip native stack check under GLIBC. r=dmandelin
js/src/jscntxt.cpp
--- a/js/src/jscntxt.cpp
+++ b/js/src/jscntxt.cpp
@@ -36,16 +36,19 @@
  * the provisions above, a recipient may use your version of this file under
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 
 /*
  * JS execution context.
  */
+
+#include <limits.h> /* make sure that <features.h> is included and we can use
+                       __GLIBC__ to detect glibc presence */
 #include <new>
 #include <stdarg.h>
 #include <stdlib.h>
 #include <string.h>
 #ifdef ANDROID
 # include <android/log.h>
 # include <fstream>
 # include <string>
@@ -208,23 +211,22 @@ js_CurrentThreadAndLockGC(JSRuntime *rt)
             return NULL;
         }
 
         /* Another thread cannot add an entry for the current thread id. */
         JS_ASSERT(p->value == thread);
     }
     JS_ASSERT(thread->id == id);
 
-#ifdef DEBUG
-    char* gnsb = (char*) GetNativeStackBase();
-    JS_ASSERT(gnsb + 0      == (char*) thread->data.nativeStackBase ||
-              /* Work around apparent glibc bug; see bug 608526. */
-              gnsb + 0x1000 == (char*) thread->data.nativeStackBase ||
-              gnsb + 0x2000 == (char*) thread->data.nativeStackBase ||
-              gnsb + 0x3000 == (char*) thread->data.nativeStackBase);
+    /*
+     * We skip the assert under glibc due to an apparent bug there, see
+     * bug 608526.
+     */
+#ifndef __GLIBC__
+    JS_ASSERT(GetNativeStackBase() == thread->data.nativeStackBase);
 #endif
 
     return thread;
 }
 
 JSBool
 js_InitContextThreadAndLockGC(JSContext *cx)
 {