diff --git a/js/ipc/PObjectWrapper.ipdl b/js/ipc/PObjectWrapper.ipdl index 8cf8b08f2442..72c3017561a5 100644 --- a/js/ipc/PObjectWrapper.ipdl +++ b/js/ipc/PObjectWrapper.ipdl @@ -55,8 +55,8 @@ union JSVariant { 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 { diff --git a/js/src/jscompat.h b/js/src/jscompat.h index bee2977dc053..f8f1791fa997 100644 --- a/js/src/jscompat.h +++ b/js/src/jscompat.h @@ -46,6 +46,6 @@ */ #include "jstypes.h" -typedef JSIntn intN; -typedef JSUintn uintN; +typedef int intN; +typedef unsigned uintN; #endif /* jscompat_h___ */ diff --git a/js/src/jsprf.cpp b/js/src/jsprf.cpp index 5a058dccc18b..48f4985ce602 100644 --- a/js/src/jsprf.cpp +++ b/js/src/jsprf.cpp @@ -580,7 +580,7 @@ static struct NumArgState* BuildArgArray( const char *fmt, va_list ap, int* rv, 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; @@ -642,7 +642,7 @@ static struct NumArgState* BuildArgArray( const char *fmt, va_list ap, int* rv, 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; @@ -656,7 +656,7 @@ static struct NumArgState* BuildArgArray( const char *fmt, va_list ap, int* rv, 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; diff --git a/js/src/jsprf.h b/js/src/jsprf.h index 6c3b168742a9..9efbd6413177 100644 --- a/js/src/jsprf.h +++ b/js/src/jsprf.h @@ -98,7 +98,7 @@ extern JS_PUBLIC_API(char*) JS_sprintf_append(char *last, const char *fmt, ...); ** 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, ...); diff --git a/js/src/jstypes.h b/js/src/jstypes.h index 68e9c8d1790f..b9aaa0ff945d 100644 --- a/js/src/jstypes.h +++ b/js/src/jstypes.h @@ -219,19 +219,6 @@ 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: @@ -240,9 +227,9 @@ typedef unsigned int JSUintn; ** '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 diff --git a/js/src/jsutil.cpp b/js/src/jsutil.cpp index 5968e70e71c5..db0b72c2441c 100644 --- a/js/src/jsutil.cpp +++ b/js/src/jsutil.cpp @@ -69,13 +69,42 @@ JS_PUBLIC_DATA(uint32_t) OOM_counter = 0; */ 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::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