Bug 726230: remove obsolete typedefs JSIntn, JSUIntn, r=luke
authorDavid Mandelin <dmandelin@mozilla.com>
Fri, 10 Feb 2012 18:07:35 -0800
changeset 90952 4d386c85ce4b1a7d1a1761133c08311149bd4957
parent 90951 481410bfe37c2dc507be31f9547ca007d8a77571
child 90953 791442d6d0123bff6551f05148a61ca6ba81b585
push id136
push userlsblakk@mozilla.com
push dateFri, 01 Jun 2012 02:39:32 +0000
treeherdermozilla-release@7ebf7352c959 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersluke
bugs726230
milestone13.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 726230: remove obsolete typedefs JSIntn, JSUIntn, r=luke
js/ipc/PObjectWrapper.ipdl
js/src/jscompat.h
js/src/jsprf.cpp
js/src/jsprf.h
js/src/jstypes.h
js/src/jsutil.cpp
--- a/js/ipc/PObjectWrapper.ipdl
+++ b/js/ipc/PObjectWrapper.ipdl
@@ -50,18 +50,18 @@ namespace mozilla {
 namespace jsipc {
 
 union JSVariant {
     void_t;
     nullable PObjectWrapper;
     nsString;
     int;
     double;
-    bool; // We'd like to use JSBool here, but JSBool is really JSIntn,
-          // and IPC::ParamTraits mistakes JSIntn for int.
+    bool; // We'd like to use JSBool here, but IPC::ParamTraits would
+          // treat JSBool as int.
 };
 
 union OperationStatus {
     JSBool;
     JSVariant; // Exception thrown.
 };
 
 rpc protocol PObjectWrapper
--- a/js/src/jscompat.h
+++ b/js/src/jscompat.h
@@ -41,11 +41,11 @@
 #define jscompat_h___
 /*
  * Compatibility glue for various NSPR versions.  We must always define int8,
  * int16, jsword, and so on to minimize differences with js/ref, no matter what
  * the NSPR typedef names may be.
  */
 #include "jstypes.h"
 
-typedef JSIntn intN;
-typedef JSUintn uintN;
+typedef int intN;
+typedef unsigned uintN;
 #endif /* jscompat_h___ */
--- a/js/src/jsprf.cpp
+++ b/js/src/jsprf.cpp
@@ -575,17 +575,17 @@ static struct NumArgState* BuildArgArray
             break;
 
         case 'p':
             /* XXX should use cpp */
             if (sizeof(void *) == sizeof(int32_t)) {
                 nas[ cn ].type = TYPE_UINT32;
             } else if (sizeof(void *) == sizeof(int64_t)) {
                 nas[ cn ].type = TYPE_UINT64;
-            } else if (sizeof(void *) == sizeof(JSIntn)) {
+            } else if (sizeof(void *) == sizeof(int)) {
                 nas[ cn ].type = TYPE_UINTN;
             } else {
                 nas[ cn ].type = TYPE_UNKNOWN;
             }
             break;
 
         case 'C':
         case 'S':
@@ -637,31 +637,31 @@ static struct NumArgState* BuildArgArray
         }
 
         VARARGS_ASSIGN(nas[cn].ap, ap);
 
         switch( nas[cn].type ){
         case TYPE_INT16:
         case TYPE_UINT16:
         case TYPE_INTN:
-        case TYPE_UINTN:                (void)va_arg( ap, JSIntn );             break;
+        case TYPE_UINTN:                (void)va_arg( ap, int );             break;
 
         case TYPE_INT32:                (void)va_arg( ap, int32_t );            break;
 
         case TYPE_UINT32:       (void)va_arg( ap, uint32_t );   break;
 
         case TYPE_INT64:        (void)va_arg( ap, int64_t );            break;
 
         case TYPE_UINT64:       (void)va_arg( ap, uint64_t );           break;
 
         case TYPE_STRING:       (void)va_arg( ap, char* );              break;
 
         case TYPE_WSTRING:      (void)va_arg( ap, jschar* );            break;
 
-        case TYPE_INTSTR:       (void)va_arg( ap, JSIntn* );            break;
+        case TYPE_INTSTR:       (void)va_arg( ap, int* );            break;
 
         case TYPE_DOUBLE:       (void)va_arg( ap, double );             break;
 
         default:
             if( nas != nasArray )
                 UnwantedForeground::free_( nas );
             *rv = -1;
             return NULL;
--- a/js/src/jsprf.h
+++ b/js/src/jsprf.h
@@ -93,17 +93,17 @@ extern JS_PUBLIC_API(char*) JS_sprintf_a
 
 /*
 ** sprintf into a function. The function "f" is called with a string to
 ** place into the output. "arg" is an opaque pointer used by the stuff
 ** function to hold any state needed to do the storage of the output
 ** data. The return value is a count of the number of characters fed to
 ** the stuff function, or (uint32_t)-1 if an error occurs.
 */
-typedef JSIntn (*JSStuffFunc)(void *arg, const char *s, uint32_t slen);
+typedef int (*JSStuffFunc)(void *arg, const char *s, uint32_t slen);
 
 extern JS_PUBLIC_API(uint32_t) JS_sxprintf(JSStuffFunc f, void *arg, const char *fmt, ...);
 
 /*
 ** va_list forms of the above.
 */
 extern JS_PUBLIC_API(uint32_t) JS_vsnprintf(char *out, uint32_t outlen, const char *fmt, va_list ap);
 extern JS_PUBLIC_API(char*) JS_vsmprintf(const char *fmt, va_list ap);
--- a/js/src/jstypes.h
+++ b/js/src/jstypes.h
@@ -215,39 +215,26 @@
 #else
 # error "Implement me"
 #endif
 
 
 JS_BEGIN_EXTERN_C
 
 /************************************************************************
-** TYPES:       JSUintn
-**              JSIntn
-** DESCRIPTION:
-**  The JSIntn types are most appropriate for automatic variables. They are
-**      guaranteed to be at least 16 bits, though various architectures may
-**      define them to be wider (e.g., 32 or even 64 bits). These types are
-**      never valid for fields of a structure.
-************************************************************************/
-
-typedef int JSIntn;
-typedef unsigned int JSUintn;
-
-/************************************************************************
 ** TYPES:       JSBool
 ** DESCRIPTION:
 **  Use JSBool for variables and parameter types. Use JS_FALSE and JS_TRUE
 **      for clarity of target type in assignments and actual arguments. Use
 **      'if (bool)', 'while (!bool)', '(bool) ? x : y' etc., to test booleans
 **      just as you would C int-valued conditions.
 ************************************************************************/
-typedef JSIntn JSBool;
-#define JS_TRUE (JSIntn)1
-#define JS_FALSE (JSIntn)0
+typedef int JSBool;
+#define JS_TRUE (int)1
+#define JS_FALSE (int)0
 
 /************************************************************************
 ** TYPES:       JSPackedBool
 ** DESCRIPTION:
 **  Use JSPackedBool within structs where bitfields are not desireable
 **      but minimum and consistent overhead matters.
 ************************************************************************/
 typedef uint8_t JSPackedBool;
--- a/js/src/jsutil.cpp
+++ b/js/src/jsutil.cpp
@@ -64,23 +64,52 @@ JS_PUBLIC_DATA(uint32_t) OOM_counter = 0
 #endif
 
 /*
  * Checks the assumption that JS_FUNC_TO_DATA_PTR and JS_DATA_TO_FUNC_PTR
  * macros uses to implement casts between function and data pointers.
  */
 JS_STATIC_ASSERT(sizeof(void *) == sizeof(void (*)()));
 
-/*
- * |JS_Assert| historically took |JSIntn ln| as its last argument.  We've
- * boiled |JSIntn ln| down to simply |int ln| so that mfbt may declare the
- * function without depending on the |JSIntn| typedef, so we must manually
- * verify that the |JSIntn| typedef is consistent.
- */
-JS_STATIC_ASSERT((tl::IsSameType<JSIntn, int>::result));
+static JS_NEVER_INLINE void
+CrashInJS()
+{
+    /*
+     * We write 123 here so that the machine code for this function is
+     * unique. Otherwise the linker, trying to be smart, might use the
+     * same code for CrashInJS and for some other function. That
+     * messes up the signature in minidumps.
+     */
+
+#if defined(WIN32)
+    /*
+     * We used to call DebugBreak() on Windows, but amazingly, it causes
+     * the MSVS 2010 debugger not to be able to recover a call stack.
+     */
+    *((volatile int *) NULL) = 123;
+    exit(3);
+#elif defined(__APPLE__)
+    /*
+     * On Mac OS X, Breakpad ignores signals. Only real Mach exceptions are
+     * trapped.
+     */
+    *((volatile int *) NULL) = 123;  /* To continue from here in GDB: "return" then "continue". */
+    raise(SIGABRT);  /* In case above statement gets nixed by the optimizer. */
+#else
+    raise(SIGABRT);  /* To continue from here in GDB: "signal 0". */
+#endif
+}
+
+JS_PUBLIC_API(void)
+JS_Assert(const char *s, const char *file, int ln)
+{
+    fprintf(stderr, "Assertion failure: %s, at %s:%d\n", s, file, ln);
+    fflush(stderr);
+    CrashInJS();
+}
 
 #ifdef JS_BASIC_STATS
 
 #include <math.h>
 #include <string.h>
 #include "jscompat.h"
 
 /*