Bug 924891 - don't use JS_BITS_PER_WORD in jscrashreport.cpp; r=njn
authorNathan Froyd <froydnj@mozilla.com>
Wed, 09 Oct 2013 09:06:13 -0400
changeset 164769 ceef564c96d8c38247d333f290fd2b4824576e17
parent 164768 03b528014634dc0452c82c85979a4190d991707e
child 164770 612f4837513a6c0279294acc34227a3b6443b4b4
push id3066
push userakeybl@mozilla.com
push dateMon, 09 Dec 2013 19:58:46 +0000
treeherdermozilla-beta@a31a0dce83aa [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersnjn
bugs924891
milestone27.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 924891 - don't use JS_BITS_PER_WORD in jscrashreport.cpp; r=njn
js/src/jscrashreport.cpp
--- a/js/src/jscrashreport.cpp
+++ b/js/src/jscrashreport.cpp
@@ -41,40 +41,42 @@ GetStack(uint64_t *stack, uint64_t *stac
 
     if (len > size)
         len = size;
 
     *stack = p;
     *stack_len = len;
 
     /* Get the register state. */
-#if defined(_MSC_VER) && JS_BITS_PER_WORD == 32
+#if defined(_MSC_VER) && defined(_M_IX86)
     /* ASM version for win2k that doesn't support RtlCaptureContext */
     uint32_t vip, vsp, vbp;
     __asm {
     Label:
         mov [vbp], ebp;
         mov [vsp], esp;
         mov eax, [Label];
         mov [vip], eax;
     }
     regs->ip = vip;
     regs->sp = vsp;
     regs->bp = vbp;
 #else
     CONTEXT context;
     RtlCaptureContext(&context);
-#if JS_BITS_PER_WORD == 32
+#if defined(_M_IX86)
     regs->ip = context.Eip;
     regs->sp = context.Esp;
     regs->bp = context.Ebp;
-#else
+#elif defined(_M_X64)
     regs->ip = context.Rip;
     regs->sp = context.Rsp;
     regs->bp = context.Rbp;
+#else
+#error unknown cpu architecture
 #endif
 #endif
 
     js_memcpy(buffer, (void *)p, len);
 
     return true;
 }
 
@@ -109,24 +111,26 @@ GetStack(uint64_t *stack, uint64_t *stac
     *stack = p;
     *stack_len = len;
 
     /* Get the register state. */
     ucontext_t context;
     if (getcontext(&context) != 0)
 	return false;
 
-#if JS_BITS_PER_WORD == 64
+#if defined(__x86_64__)
     regs->sp = (uint64_t)context.uc_mcontext.gregs[REG_RSP];
     regs->bp = (uint64_t)context.uc_mcontext.gregs[REG_RBP];
     regs->ip = (uint64_t)context.uc_mcontext.gregs[REG_RIP];
-#elif JS_BITS_PER_WORD == 32
+#elif defined(__i386__)
     regs->sp = (uint64_t)context.uc_mcontext.gregs[REG_ESP];
     regs->bp = (uint64_t)context.uc_mcontext.gregs[REG_EBP];
     regs->ip = (uint64_t)context.uc_mcontext.gregs[REG_EIP];
+#else
+#error unknown cpu architecture
 #endif
 
     js_memcpy(buffer, (void *)p, len);
 
     return true;
 }
 
 #else