Back out fe29b2ae604b, 8c6ec2899d89 and 6b2f3cb031da (bug 851964) for test hangs
authorPhil Ringnalda <philringnalda@gmail.com>
Tue, 19 Mar 2013 21:44:48 -0700
changeset 132005 26653529ea8bd1842a17f7c68026dd0676fd2d74
parent 132004 5882acd59c33e800e3b1b45c5e00acbdd12c1f0c
child 132006 1d6fe70c79c55c1b8dd64a0c8153c896c3955565
child 132018 221a7a558c630d848b9b516d70d16e594ad4d741
push idunknown
push userunknown
push dateunknown
bugs851964
milestone22.0a1
backs outfe29b2ae604b7e7cf570bd8c57c8d21415789c9f
Back out fe29b2ae604b, 8c6ec2899d89 and 6b2f3cb031da (bug 851964) for test hangs CLOSED TREE
js/src/ion/AsmJS.h
js/src/ion/AsmJSModule.h
js/src/ion/AsmJSSignalHandlers.cpp
js/src/jsapi.cpp
js/src/jscntxt.cpp
js/src/jscntxt.h
toolkit/crashreporter/breakpad-patches/09-osx-64bit.patch
toolkit/crashreporter/breakpad-patches/10-user-osx-handlers.patch
toolkit/crashreporter/google-breakpad/src/client/mac/handler/exception_handler.cc
--- a/js/src/ion/AsmJS.h
+++ b/js/src/ion/AsmJS.h
@@ -8,17 +8,17 @@
 #if !defined(jsion_asmjs_h__)
 #define jsion_asmjs_h__
 
 // asm.js compilation is only available on desktop x86/x64 at the moment.
 // Don't panic, mobile support is coming soon.
 #if defined(JS_ION) && \
     !defined(ANDROID) && \
     (defined(JS_CPU_X86) || defined(JS_CPU_X64)) &&  \
-    (defined(__linux__) || defined(XP_WIN) || defined(XP_MACOSX))
+    (defined(__linux__) || defined(XP_WIN))
 # define JS_ASMJS
 #endif
 
 namespace js {
 
 class SPSProfiler;
 class AsmJSModule;
 namespace frontend { struct TokenStream; struct ParseNode; }
--- a/js/src/ion/AsmJSModule.h
+++ b/js/src/ion/AsmJSModule.h
@@ -507,21 +507,16 @@ class AsmJSModule
         totalBytes_ = totalBytes;
     }
     uint8_t *functionCode() const {
         JS_ASSERT(code_);
         JS_ASSERT(uintptr_t(code_) % gc::PageSize == 0);
         return code_;
     }
 
-    bool pcIsInModule(void *pc) const {
-        return pc >= functionCode() &&
-               pc < (functionCode() + functionBytes());
-    }
-
     void setOperationCallbackExit(uint8_t *ptr) {
         operationCallbackExit_ = ptr;
     }
     uint8_t *operationCallbackExit() const {
         return operationCallbackExit_;
     }
 
     void setIsLinked(Handle<ArrayBufferObject*> maybeHeap) {
--- a/js/src/ion/AsmJSSignalHandlers.cpp
+++ b/js/src/ion/AsmJSSignalHandlers.cpp
@@ -76,16 +76,23 @@ InnermostAsmJSActivation()
 {
     PerThreadData *threadData = TlsPerThreadData.get();
     if (!threadData)
         return NULL;
 
     return threadData->asmJSActivationStackFromOwnerThread();
 }
 
+static bool
+PCIsInModule(const AsmJSModule &module, void *pc)
+{
+    uint8_t *code = module.functionCode();
+    return pc >= code && pc < (code + module.functionBytes());
+}
+
 # if defined(JS_CPU_X64)
 template <class T>
 static void
 SetXMMRegToNaN(bool isFloat32, T *xmm_reg)
 {
     if (isFloat32) {
         JS_STATIC_ASSERT(sizeof(T) == 4 * sizeof(float));
         float *floats = reinterpret_cast<float*>(xmm_reg);
@@ -101,17 +108,17 @@ SetXMMRegToNaN(bool isFloat32, T *xmm_re
     }
 }
 
 // Perform a binary search on the projected offsets of the known heap accesses
 // in the module.
 static const AsmJSHeapAccess *
 LookupHeapAccess(const AsmJSModule &module, uint8_t *pc)
 {
-    JS_ASSERT(module.pcIsInModule(pc));
+    JS_ASSERT(PCIsInModule(module, pc));
     size_t targetOffset = pc - module.functionCode();
 
     if (module.numHeapAccesses() == 0)
         return NULL;
 
     size_t low = 0;
     size_t high = module.numHeapAccesses() - 1;
     while (high - low >= 2) {
@@ -209,30 +216,30 @@ HandleException(PEXCEPTION_POINTERS exce
     if (!activation)
         return false;
 
     uint8_t **ppc = ContextToPC(context);
     uint8_t *pc = *ppc;
 	JS_ASSERT(pc == record->ExceptionAddress);
 
     const AsmJSModule &module = activation->module();
-    if (!module.pcIsInModule(pc))
+    if (!PCIsInModule(module, pc))
         return false;
 
 	if (record->NumberParameters < 2)
 		return false;
 
     void *faultingAddress = (void*)record->ExceptionInformation[1];
 
     // If we faulted trying to execute code in 'module', this must be an
     // operation callback (see TriggerOperationCallbackForAsmJSCode). Redirect
     // execution to a trampoline which will call js_HandleExecutionInterrupt.
     // The trampoline will jump to activation->resumePC if execution isn't
     // interrupted.
-    if (module.pcIsInModule(faultingAddress)) {
+    if (PCIsInModule(module, faultingAddress)) {
         activation->setResumePC(pc);
         *ppc = module.operationCallbackExit();
         DWORD oldProtect;
         if (!VirtualProtect(module.functionCode(), module.functionBytes(), PAGE_EXECUTE, &oldProtect))
             MOZ_CRASH();
         return true;
     }
 
@@ -278,37 +285,16 @@ AsmJSExceptionHandler(LPEXCEPTION_POINTE
     // No need to worry about calling other handlers, the OS does this for us.
     return EXCEPTION_CONTINUE_SEARCH;
 }
 
 # else  // If not Windows, assume Unix
 #  include <signal.h>
 #  include <sys/mman.h>
 
-#if defined(XP_MACOSX)
-// Oh boy.  We get to do fun things to make this work with the Mach
-// exception handling installed by breakpad.  Note that we still
-// use and set up the signal() infrastructure; we'll fall back to
-// that if breakpad is not active.
-#include <mach/exc.h>
-#include <mach/mig.h>
-#include <mach/thread_act.h>
-
-extern "C" {
-    // this must be visible to dlsym(), and must have this name.
-    // Breakpad will call this before doing its thing if it exists
-    // in the process.
-    boolean_t BreakpadUserExceptionHandler64(exception_type_t extype,
-                                             mach_exception_data_t code,
-                                             mach_msg_type_number_t code_count,
-                                             mach_port_t thread)
-        __attribute__((visibility("default")));
-}
-#endif
-
 // Unfortunately, we still need OS-specific code to read/write to the thread
 // state via the mcontext_t.
 #  if defined(__linux__)
 static uint8_t **
 ContextToPC(mcontext_t &context)
 {
 #   if defined(JS_CPU_X86)
     JS_STATIC_ASSERT(sizeof(context.gregs[REG_EIP]) == sizeof(void*));
@@ -376,70 +362,59 @@ ContextToPC(mcontext_t context)
 #   else
     JS_STATIC_ASSERT(sizeof(context->__ss.__rip) == sizeof(void*));
     return reinterpret_cast<uint8_t **>(&context->__ss.__rip);
 #   endif
 }
 
 #   if defined(JS_CPU_X64)
 static void
-SetFloatStateRegisterToCoercedUndefined(x86_float_state64_t *fs, bool isFloat32, AnyRegister reg)
-{
-    switch (reg.fpu().code()) {
-      case JSC::X86Registers::xmm0:  SetXMMRegToNaN(isFloat32, &fs->__fpu_xmm0); break;
-      case JSC::X86Registers::xmm1:  SetXMMRegToNaN(isFloat32, &fs->__fpu_xmm1); break;
-      case JSC::X86Registers::xmm2:  SetXMMRegToNaN(isFloat32, &fs->__fpu_xmm2); break;
-      case JSC::X86Registers::xmm3:  SetXMMRegToNaN(isFloat32, &fs->__fpu_xmm3); break;
-      case JSC::X86Registers::xmm4:  SetXMMRegToNaN(isFloat32, &fs->__fpu_xmm4); break;
-      case JSC::X86Registers::xmm5:  SetXMMRegToNaN(isFloat32, &fs->__fpu_xmm5); break;
-      case JSC::X86Registers::xmm6:  SetXMMRegToNaN(isFloat32, &fs->__fpu_xmm6); break;
-      case JSC::X86Registers::xmm7:  SetXMMRegToNaN(isFloat32, &fs->__fpu_xmm7); break;
-      case JSC::X86Registers::xmm8:  SetXMMRegToNaN(isFloat32, &fs->__fpu_xmm8); break;
-      case JSC::X86Registers::xmm9:  SetXMMRegToNaN(isFloat32, &fs->__fpu_xmm9); break;
-      case JSC::X86Registers::xmm10: SetXMMRegToNaN(isFloat32, &fs->__fpu_xmm10); break;
-      case JSC::X86Registers::xmm11: SetXMMRegToNaN(isFloat32, &fs->__fpu_xmm11); break;
-      case JSC::X86Registers::xmm12: SetXMMRegToNaN(isFloat32, &fs->__fpu_xmm12); break;
-      case JSC::X86Registers::xmm13: SetXMMRegToNaN(isFloat32, &fs->__fpu_xmm13); break;
-      case JSC::X86Registers::xmm14: SetXMMRegToNaN(isFloat32, &fs->__fpu_xmm14); break;
-      case JSC::X86Registers::xmm15: SetXMMRegToNaN(isFloat32, &fs->__fpu_xmm15); break;
-      default: MOZ_CRASH();
-    }
-}
-
-static void
-SetThreadStateRegisterToCoercedUndefined(x86_thread_state64_t *ss, bool isFloat32, AnyRegister reg)
-{
-    switch (reg.gpr().code()) {
-      case JSC::X86Registers::eax: ss->__rax = 0; break;
-      case JSC::X86Registers::ecx: ss->__rcx = 0; break;
-      case JSC::X86Registers::edx: ss->__rdx = 0; break;
-      case JSC::X86Registers::ebx: ss->__rbx = 0; break;
-      case JSC::X86Registers::esp: ss->__rsp = 0; break;
-      case JSC::X86Registers::ebp: ss->__rbp = 0; break;
-      case JSC::X86Registers::esi: ss->__rsi = 0; break;
-      case JSC::X86Registers::edi: ss->__rdi = 0; break;
-      case JSC::X86Registers::r8:  ss->__r8  = 0; break;
-      case JSC::X86Registers::r9:  ss->__r9  = 0; break;
-      case JSC::X86Registers::r10: ss->__r10 = 0; break;
-      case JSC::X86Registers::r11: ss->__r11 = 0; break;
-      case JSC::X86Registers::r12: ss->__r12 = 0; break;
-      case JSC::X86Registers::r13: ss->__r13 = 0; break;
-      case JSC::X86Registers::r14: ss->__r14 = 0; break;
-      case JSC::X86Registers::r15: ss->__r15 = 0; break;
-      default: MOZ_CRASH();
-    }
-}
-
-static void
 SetRegisterToCoercedUndefined(mcontext_t &context, bool isFloat32, AnyRegister reg)
 {
-    if (reg.isFloat())
-        SetFloatStateRegisterToCoercedUndefined(&context->__fs, isFloat32, reg);
-    else
-        SetThreadStateRegisterToCoercedUndefined(&context->__ss, isFloat32, reg);
+    if (reg.isFloat()) {
+        switch (reg.fpu().code()) {
+          case JSC::X86Registers::xmm0:  SetXMMRegToNaN(isFloat32, &context->__fs.__fpu_xmm0); break;
+          case JSC::X86Registers::xmm1:  SetXMMRegToNaN(isFloat32, &context->__fs.__fpu_xmm1); break;
+          case JSC::X86Registers::xmm2:  SetXMMRegToNaN(isFloat32, &context->__fs.__fpu_xmm2); break;
+          case JSC::X86Registers::xmm3:  SetXMMRegToNaN(isFloat32, &context->__fs.__fpu_xmm3); break;
+          case JSC::X86Registers::xmm4:  SetXMMRegToNaN(isFloat32, &context->__fs.__fpu_xmm4); break;
+          case JSC::X86Registers::xmm5:  SetXMMRegToNaN(isFloat32, &context->__fs.__fpu_xmm5); break;
+          case JSC::X86Registers::xmm6:  SetXMMRegToNaN(isFloat32, &context->__fs.__fpu_xmm6); break;
+          case JSC::X86Registers::xmm7:  SetXMMRegToNaN(isFloat32, &context->__fs.__fpu_xmm7); break;
+          case JSC::X86Registers::xmm8:  SetXMMRegToNaN(isFloat32, &context->__fs.__fpu_xmm8); break;
+          case JSC::X86Registers::xmm9:  SetXMMRegToNaN(isFloat32, &context->__fs.__fpu_xmm9); break;
+          case JSC::X86Registers::xmm10: SetXMMRegToNaN(isFloat32, &context->__fs.__fpu_xmm10); break;
+          case JSC::X86Registers::xmm11: SetXMMRegToNaN(isFloat32, &context->__fs.__fpu_xmm11); break;
+          case JSC::X86Registers::xmm12: SetXMMRegToNaN(isFloat32, &context->__fs.__fpu_xmm12); break;
+          case JSC::X86Registers::xmm13: SetXMMRegToNaN(isFloat32, &context->__fs.__fpu_xmm13); break;
+          case JSC::X86Registers::xmm14: SetXMMRegToNaN(isFloat32, &context->__fs.__fpu_xmm14); break;
+          case JSC::X86Registers::xmm15: SetXMMRegToNaN(isFloat32, &context->__fs.__fpu_xmm15); break;
+          default: MOZ_CRASH();
+        }
+    } else {
+        switch (reg.gpr().code()) {
+          case JSC::X86Registers::eax: context->__ss.__rax = 0; break;
+          case JSC::X86Registers::ecx: context->__ss.__rcx = 0; break;
+          case JSC::X86Registers::edx: context->__ss.__rdx = 0; break;
+          case JSC::X86Registers::ebx: context->__ss.__rbx = 0; break;
+          case JSC::X86Registers::esp: context->__ss.__rsp = 0; break;
+          case JSC::X86Registers::ebp: context->__ss.__rbp = 0; break;
+          case JSC::X86Registers::esi: context->__ss.__rsi = 0; break;
+          case JSC::X86Registers::edi: context->__ss.__rdi = 0; break;
+          case JSC::X86Registers::r8:  context->__ss.__r8  = 0; break;
+          case JSC::X86Registers::r9:  context->__ss.__r9  = 0; break;
+          case JSC::X86Registers::r10: context->__ss.__r10 = 0; break;
+          case JSC::X86Registers::r11: context->__ss.__r11 = 0; break;
+          case JSC::X86Registers::r12: context->__ss.__r12 = 0; break;
+          case JSC::X86Registers::r13: context->__ss.__r13 = 0; break;
+          case JSC::X86Registers::r14: context->__ss.__r14 = 0; break;
+          case JSC::X86Registers::r15: context->__ss.__r15 = 0; break;
+          default: MOZ_CRASH();
+        }
+    }
 }
 #   endif
 #  endif  // end of OS-specific mcontext accessors
 
 // Be very cautious and default to not handling; we don't want to accidentally
 // silence real crashes from real bugs.
 static bool
 HandleSignal(int signum, siginfo_t *info, void *ctx)
@@ -448,27 +423,27 @@ HandleSignal(int signum, siginfo_t *info
     if (!activation)
         return false;
 
     mcontext_t &context = reinterpret_cast<ucontext_t*>(ctx)->uc_mcontext;
     uint8_t **ppc = ContextToPC(context);
     uint8_t *pc = *ppc;
 
     const AsmJSModule &module = activation->module();
-    if (!module.pcIsInModule(pc))
+    if (!PCIsInModule(module, pc))
         return false;
 
     void *faultingAddress = info->si_addr;
 
     // If we faulted trying to execute code in 'module', this must be an
     // operation callback (see TriggerOperationCallbackForAsmJSCode). Redirect
     // execution to a trampoline which will call js_HandleExecutionInterrupt.
     // The trampoline will jump to activation->resumePC if execution isn't
     // interrupted.
-    if (module.pcIsInModule(faultingAddress)) {
+    if (PCIsInModule(module, faultingAddress)) {
         activation->setResumePC(pc);
         *ppc = module.operationCallbackExit();
         mprotect(module.functionCode(), module.functionBytes(), PROT_EXEC);
         return true;
     }
 
 #  if defined(JS_CPU_X64)
     // These checks aren't necessary, but, since we can, check anyway to make
@@ -519,138 +494,16 @@ AsmJSFaultHandler(int signum, siginfo_t 
         exit(signum);  // backstop
     } else if (sPrevHandler.sa_handler == SIG_DFL || sPrevHandler.sa_handler == SIG_IGN) {
         sigaction(signum, &sPrevHandler, NULL);
     } else {
         sPrevHandler.sa_handler(signum);
         exit(signum);  // backstop
     }
 }
-
-#if defined(XP_MACOSX)
-
-// This is the Mach-exceptions-in-conjunction-with-breakpad handler.
-// There's an unfortunate amount of code duplicated from HandleSignal
-// above, but there are enough differences in paths that unifying
-// them is a bit of a pain (differences in how you get or set register
-// state, how you look up the AsmJS Activation, etc.)
-boolean_t
-BreakpadUserExceptionHandler64(exception_type_t extype,
-                               mach_exception_data_t code,
-                               mach_msg_type_number_t code_count,
-                               mach_port_t thread)
-{
-    // we only care about BAD_ACCESS
-    if (extype != EXC_BAD_ACCESS)
-        return false;
-
-    kern_return_t kr;
-
-# if defined(JS_CPU_X64)
-    x86_thread_state64_t state;
-    unsigned int count = x86_THREAD_STATE64_COUNT;
-    unsigned int state_flavor = x86_THREAD_STATE64;
-    uint8_t **ppc = reinterpret_cast<uint8_t**>(&state.__rip);
-#else
-    x86_thread_state32_t state;
-    unsigned int count = x86_THREAD_STATE32_COUNT;
-    unsigned int state_flavor = x86_THREAD_STATE32;
-    uint8_t **ppc = reinterpret_cast<uint8_t**>(&state.__eip);
-#endif
-
-    kr = thread_get_state(thread, state_flavor, (thread_state_t) &state, &count);
-    if (kr != KERN_SUCCESS) {
-        // couldn't get state? welp, at least we'll get a breakpad stack!
-        return false;
-    }
-
-    uint8_t *pc = *ppc;
-
-    AsmJSActivation *activation = JSRuntime::findAsmJSActivationForPC(pc);
-    if (!activation) {
-        return false;
-    }
-
-    // we know pc is in module because we found it earlier by the pc
-    const AsmJSModule &module = activation->module();
-
-    void *faultingAddress = reinterpret_cast<void*>(code[1]);
-
-    // If we faulted trying to execute code in 'module', this must be an
-    // operation callback (see TriggerOperationCallbackForAsmJSCode). Redirect
-    // execution to a trampoline which will call js_HandleExecutionInterrupt.
-    // The trampoline will jump to activation->resumePC if execution isn't
-    // interrupted.
-    if (module.pcIsInModule(faultingAddress)) {
-        activation->setResumePC(pc);
-        *ppc = module.operationCallbackExit();
-        mprotect(module.functionCode(), module.functionBytes(), PROT_EXEC);
-
-        // count better not have been modified since we called thread_get_state above
-        kr = thread_set_state(thread, state_flavor, (thread_state_t) &state, count);
-        if (kr != KERN_SUCCESS) {
-            return false;
-        }
-        
-        return true;
-    }
-
-# if defined(JS_CPU_X64)
-    // These checks aren't necessary, but, since we can, check anyway to make
-    // sure we aren't covering up a real bug.
-    if (!module.maybeHeap() ||
-        faultingAddress < module.maybeHeap() ||
-        faultingAddress >= module.maybeHeap() + AsmJSBufferProtectedSize)
-    {
-        return false;
-    }
-
-    const AsmJSHeapAccess *heapAccess = LookupHeapAccess(module, pc);
-    if (!heapAccess)
-        return false;
-
-    // We now know that this is an out-of-bounds access made by an asm.js
-    // load/store that we should handle. If this is a load, assign the
-    // JS-defined result value to the destination register (ToInt32(undefined)
-    // or ToNumber(undefined), determined by the type of the destination
-    // register) and set the PC to the next op. Upon return from the handler,
-    // execution will resume at this next PC.
-    if (heapAccess->isLoad()) {
-        AnyRegister reg = heapAccess->loadedReg();
-        if (reg.isFloat()) {
-            // We have to grab the floating point registers
-            x86_float_state64_t fstate;
-            count = x86_FLOAT_STATE64_COUNT;
-            kr = thread_get_state(thread, x86_FLOAT_STATE64, (thread_state_t) &fstate, &count);
-            if (kr != KERN_SUCCESS)
-                return false;
-
-            SetFloatStateRegisterToCoercedUndefined(&fstate, heapAccess->isFloat32Load(), reg);
-
-            kr = thread_set_state(thread, x86_FLOAT_STATE64, (thread_state_t) &fstate, x86_FLOAT_STATE64_COUNT);
-            if (kr != KERN_SUCCESS)
-                return false;
-        } else {
-            SetThreadStateRegisterToCoercedUndefined(&state, heapAccess->isFloat32Load(), reg);
-        }
-    }
-
-    *ppc += heapAccess->opLength();
-
-    kr = thread_set_state(thread, x86_THREAD_STATE64, (thread_state_t) &state, x86_THREAD_STATE64_COUNT);
-    if (kr != KERN_SUCCESS)
-        return false;
-
-    return true;
-#  else
-    return false;
-#  endif
-}
-#endif
-
 # endif
 #endif // JS_ASMJS
 
 bool
 EnsureAsmJSSignalHandlersInstalled()
 {
 #if defined(JS_ASMJS)
     SignalMutex::Lock lock;
--- a/js/src/jsapi.cpp
+++ b/js/src/jsapi.cpp
@@ -84,19 +84,18 @@
 #include "vm/Stack-inl.h"
 #include "vm/String-inl.h"
 
 #if ENABLE_YARR_JIT
 #include "assembler/jit/ExecutableAllocator.h"
 #include "methodjit/Logging.h"
 #endif
 
-#ifdef JS_ION
+#ifdef JS_METHODJIT
 #include "ion/Ion.h"
-#include "ion/AsmJSModule.h"
 #endif
 
 using namespace js;
 using namespace js::gc;
 using namespace js::types;
 
 using mozilla::Maybe;
 
@@ -963,59 +962,25 @@ JSRuntime::init(uint32_t maxbytes)
     if (useHelperThreads() && !sourceCompressorThread.init())
         return false;
 #endif
 
     if (!evalCache.init())
         return false;
 
     nativeStackBase = GetNativeStackBase();
-
-#ifdef XP_MACOSX
-    if (!runtimeListLock_) {
-        runtimeListLock_ = PR_NewLock();
-        runtimeListHead_ = NULL;
-    }
-
-    PR_Lock(runtimeListLock_);
-    runtimeListNext_ = runtimeListHead_;
-    runtimeListHead_ = this;
-    PR_Unlock(runtimeListLock_);
-#endif
-
     return true;
 }
 
 JSRuntime::~JSRuntime()
 {
 #ifdef JS_THREADSAFE
     clearOwnerThread();
 #endif
 
-#ifdef XP_MACOSX
-    {
-        PR_Lock(runtimeListLock_);
-        JSRuntime *r = runtimeListHead_;
-        // find ourselves to remove us from the list
-        if (r == this) {
-            runtimeListHead_ = runtimeListNext_;
-        } else {
-            // look for the node that has us in the next
-            // pointer
-            while (r && r->runtimeListNext_ != this)
-                r = r->runtimeListNext_;
-            JS_ASSERT(r);
-            r->runtimeListNext_ = runtimeListNext_;
-        }
-
-        runtimeListNext_ = NULL;
-        PR_Unlock(runtimeListLock_);
-    }
-#endif
-
     /*
      * Even though all objects in the compartment are dead, we may have keep
      * some filenames around because of gcKeepAtoms.
      */
     FreeScriptData(this);
 
 #ifdef JS_THREADSAFE
 # ifdef JS_ION
--- a/js/src/jscntxt.cpp
+++ b/js/src/jscntxt.cpp
@@ -44,17 +44,16 @@
 #include "jsopcode.h"
 #include "jspubtd.h"
 #include "jsscript.h"
 #include "jsstr.h"
 #include "jsworkers.h"
 #ifdef JS_ION
 #include "ion/Ion.h"
 #include "ion/IonFrames.h"
-#include "ion/AsmJSModule.h"
 #endif
 
 #ifdef JS_METHODJIT
 # include "assembler/assembler/MacroAssembler.h"
 # include "methodjit/MethodJIT.h"
 #endif
 #include "gc/Marking.h"
 #include "js/CharacterEncoding.h"
@@ -1402,41 +1401,16 @@ JSRuntime::onOutOfMemory(void *p, size_t
       p = js_realloc(p, nbytes);
     if (p)
         return p;
     if (cx)
         js_ReportOutOfMemory(cx);
     return NULL;
 }
 
-#ifdef XP_MACOSX
-PRLock *JSRuntime::runtimeListLock_ = NULL;
-JSRuntime *JSRuntime::runtimeListHead_ = NULL;
-
-AsmJSActivation*
-JSRuntime::findAsmJSActivationForPC(void *pc)
-{
-    PR_Lock(runtimeListLock_);
-
-    AsmJSActivation *activation = NULL;
-
-    JSRuntime *r = runtimeListHead_;
-    while (r) {
-        activation = r->mainThread.asmJSActivationStackFromAnyThread();
-        if (activation && activation->module().pcIsInModule(pc))
-            break;
-        activation = NULL;
-        r = r->runtimeListNext_;
-    }
-
-    PR_Unlock(runtimeListLock_);
-    return activation;
-}
-#endif
-
 void
 JSContext::purge()
 {
     if (!activeCompilations) {
         js_delete(parseMapPool_);
         parseMapPool_ = NULL;
     }
 }
--- a/js/src/jscntxt.h
+++ b/js/src/jscntxt.h
@@ -672,28 +672,16 @@ struct JSRuntime : js::RuntimeFriendFiel
     void                *ownerThread_;
   public:
 #else
   public:
     void abortIfWrongThread() const {}
     void assertValidThread() const {}
 #endif
 
-#ifdef XP_MACOSX
-    // On OSX, we need a way to find all the live runtimes from an arbitrary
-    // thread (specifically, the exception thread, for fixing up Odin
-    // accesses).
-  private:
-    static PRLock *runtimeListLock_;
-    static JSRuntime *runtimeListHead_;
-    JSRuntime *runtimeListNext_;
-  public:
-    static js::AsmJSActivation* findAsmJSActivationForPC(void *pc);
-#endif
-
     /* Keeper of the contiguous stack used by all contexts in this thread. */
     js::StackSpace stackSpace;
 
     /* Temporary arena pool used while compiling and decompiling. */
     static const size_t TEMP_LIFO_ALLOC_PRIMARY_CHUNK_SIZE = 4 * 1024;
     js::LifoAlloc tempLifoAlloc;
 
     /*
deleted file mode 100644
--- a/toolkit/crashreporter/breakpad-patches/09-osx-64bit.patch
+++ /dev/null
@@ -1,479 +0,0 @@
-commit 4b67f801ba77ce1c90568347650a7c2792eb30cf
-Author: Vladimir Vukicevic <vladimir@pobox.com>
-Date:   Mon Mar 18 01:01:53 2013 -0400
-
-    Add breakpad TARGET_OSX_USE_64BIT_EXCEPTIONS support
-
-diff --git a/toolkit/crashreporter/google-breakpad/src/client/mac/handler/exception_handler.cc b/toolkit/crashreporter/google-breakpad/src/client/mac/handler/exception_handler.cc
-index 6862322..db605dc 100644
---- a/toolkit/crashreporter/google-breakpad/src/client/mac/handler/exception_handler.cc
-+++ b/toolkit/crashreporter/google-breakpad/src/client/mac/handler/exception_handler.cc
-@@ -31,10 +31,17 @@
- #include <mach/mig.h>
- #include <pthread.h>
- #include <signal.h>
-+#include <dlfcn.h>
- #include <TargetConditionals.h>
- 
- #include <map>
- 
-+#ifdef __x86_64__
-+// On x86-64, use the 64-bit exception catching mechanism so that exception
-+// codes don't get truncated
-+#define TARGET_OSX_USE_64BIT_EXCEPTIONS 1
-+#endif
-+
- #include "client/mac/handler/exception_handler.h"
- #include "client/mac/handler/minidump_generator.h"
- #include "common/mac/macho_utilities.h"
-@@ -83,6 +90,9 @@ using std::map;
- 
- // These structures and techniques are illustrated in
- // Mac OS X Internals, Amit Singh, ch 9.7
-+#ifdef  __MigPackStructs
-+#pragma pack(4)
-+#endif
- struct ExceptionMessage {
-   mach_msg_header_t           header;
-   mach_msg_body_t             body;
-@@ -91,9 +101,16 @@ struct ExceptionMessage {
-   NDR_record_t                ndr;
-   exception_type_t            exception;
-   mach_msg_type_number_t      code_count;
-+#if TARGET_OSX_USE_64BIT_EXCEPTIONS
-+  int64_t                     code[EXCEPTION_CODE_MAX];
-+#else
-   integer_t                   code[EXCEPTION_CODE_MAX];
-+#endif
-   char                        padding[512];
- };
-+#ifdef  __MigPackStructs
-+#pragma pack()
-+#endif
- 
- struct ExceptionParameters {
-   ExceptionParameters() : count(0) {}
-@@ -104,18 +121,24 @@ struct ExceptionParameters {
-   thread_state_flavor_t flavors[EXC_TYPES_COUNT];
- };
- 
-+#ifdef  __MigPackStructs
-+#pragma pack(4)
-+#endif
- struct ExceptionReplyMessage {
-   mach_msg_header_t  header;
-   NDR_record_t       ndr;
-   kern_return_t      return_code;
- };
-+#ifdef  __MigPackStructs
-+#pragma pack()
-+#endif
- 
- // Only catch these three exceptions.  The other ones are nebulously defined
- // and may result in treating a non-fatal exception as fatal.
- exception_mask_t s_exception_mask = EXC_MASK_BAD_ACCESS |
- EXC_MASK_BAD_INSTRUCTION | EXC_MASK_ARITHMETIC | EXC_MASK_BREAKPOINT;
- 
--#if !TARGET_OS_IPHONE
-+#if !TARGET_OS_IPHONE && !TARGET_OSX_USE_64BIT_EXCEPTIONS
- extern "C" {
-   // Forward declarations for functions that need "C" style compilation
-   boolean_t exc_server(mach_msg_header_t* request,
-@@ -136,13 +159,28 @@ extern "C" {
- kern_return_t ForwardException(mach_port_t task,
-                                mach_port_t failed_thread,
-                                exception_type_t exception,
-+#if TARGET_OSX_USE_64BIT_EXCEPTIONS
-+                               mach_exception_data_t code,
-+#else
-                                exception_data_t code,
-+#endif
-                                mach_msg_type_number_t code_count);
- 
-+#if TARGET_OS_IPHONE || TARGET_OSX_USE_64BIT_EXCEPTIONS
-+
- #if TARGET_OS_IPHONE
-+// no idea if this is still correct; this is the value the old code had
-+#define MACH_EXCEPTION_RAISE_RPC 2401
-+#elif TARGET_OSX_USE_64BIT_EXCEPTIONS
-+#define MACH_EXCEPTION_RAISE_RPC 2405
-+#else
-+#error Need a value for MACH_EXCEPTION_RAISE_RPC
-+#endif
-+
- // Implementation is based on the implementation generated by mig.
- boolean_t breakpad_exc_server(mach_msg_header_t* InHeadP,
--                              mach_msg_header_t* OutHeadP) {
-+                              mach_msg_header_t* OutHeadP)
-+{
-   OutHeadP->msgh_bits =
-       MACH_MSGH_BITS(MACH_MSGH_BITS_REMOTE(InHeadP->msgh_bits), 0);
-   OutHeadP->msgh_remote_port = InHeadP->msgh_remote_port;
-@@ -151,7 +189,7 @@ boolean_t breakpad_exc_server(mach_msg_header_t* InHeadP,
-   OutHeadP->msgh_local_port = MACH_PORT_NULL;
-   OutHeadP->msgh_id = InHeadP->msgh_id + 100;
- 
--  if (InHeadP->msgh_id != 2401) {
-+  if (InHeadP->msgh_id != MACH_EXCEPTION_RAISE_RPC) {
-     ((mig_reply_error_t*)OutHeadP)->NDR = NDR_record;
-     ((mig_reply_error_t*)OutHeadP)->RetCode = MIG_BAD_ID;
-     return FALSE;
-@@ -170,7 +208,11 @@ boolean_t breakpad_exc_server(mach_msg_header_t* InHeadP,
-     NDR_record_t NDR;
-     exception_type_t exception;
-     mach_msg_type_number_t codeCnt;
-+#if TARGET_OSX_USE_64BIT_EXCEPTIONS
-+    int64_t code[2];
-+#else
-     integer_t code[2];
-+#endif
-     mach_msg_trailer_t trailer;
-   } Request;
- 
-@@ -197,7 +239,93 @@ boolean_t breakpad_exc_server(mach_msg_header_t* InHeadP,
-   OutP->NDR = NDR_record;
-   return TRUE;
- }
--#else
-+
-+#if TARGET_OSX_USE_64BIT_EXCEPTIONS
-+// Implementation is based on the implementation generated by mig.
-+kern_return_t breakpad_exception_raise (mach_port_t exception_port,
-+                                        mach_port_t thread,
-+                                        mach_port_t task,
-+                                        exception_type_t exception,
-+                                        mach_exception_data_t code,
-+                                        mach_msg_type_number_t codeCnt)
-+{
-+#ifdef  __MigPackStructs
-+#pragma pack(4)
-+#endif
-+	typedef struct {
-+		mach_msg_header_t Head;
-+		/* start of the kernel processed data */
-+		mach_msg_body_t msgh_body;
-+		mach_msg_port_descriptor_t thread;
-+		mach_msg_port_descriptor_t task;
-+		/* end of the kernel processed data */
-+		NDR_record_t NDR;
-+		exception_type_t exception;
-+		mach_msg_type_number_t codeCnt;
-+		int64_t code[2];
-+	} Request;
-+#ifdef  __MigPackStructs
-+#pragma pack()
-+#endif
-+
-+#ifdef  __MigPackStructs
-+#pragma pack(4)
-+#endif
-+	typedef struct {
-+		mach_msg_header_t Head;
-+		NDR_record_t NDR;
-+		kern_return_t RetCode;
-+		mach_msg_trailer_t trailer;
-+	} Reply;
-+#ifdef  __MigPackStructs
-+#pragma pack()
-+#endif
-+
-+    Request In;
-+	Request *InP = &In;
-+
-+	mach_msg_return_t msg_result;
-+	unsigned int msgh_size;
-+
-+	InP->msgh_body.msgh_descriptor_count = 2;
-+	InP->thread.name = thread;
-+	InP->thread.disposition = 19;
-+	InP->thread.type = MACH_MSG_PORT_DESCRIPTOR;
-+	InP->task.name = task;
-+	InP->task.disposition = 19;
-+	InP->task.type = MACH_MSG_PORT_DESCRIPTOR;
-+	InP->NDR = NDR_record;
-+
-+	InP->exception = exception;
-+
-+	if (codeCnt > 2) {
-+		{ return MIG_ARRAY_TOO_LARGE; }
-+	}
-+	(void)memcpy((char *) InP->code, (const char *) code, 8 * codeCnt);
-+
-+	msgh_size = (mach_msg_size_t)(sizeof(Request) - 16) + ((8 * codeCnt));
-+	InP->Head.msgh_bits = MACH_MSGH_BITS_COMPLEX|
-+		MACH_MSGH_BITS(19, MACH_MSG_TYPE_MAKE_SEND_ONCE);
-+	/* msgh_size passed as argument */
-+	InP->Head.msgh_remote_port = exception_port;
-+	InP->Head.msgh_local_port = mig_get_reply_port();
-+	InP->Head.msgh_id = 2405;
-+
-+	msg_result = mach_msg(&InP->Head, MACH_SEND_MSG|MACH_RCV_MSG|MACH_MSG_OPTION_NONE,
-+                          msgh_size, (mach_msg_size_t)sizeof(Reply), InP->Head.msgh_local_port,
-+                          MACH_MSG_TIMEOUT_NONE, MACH_PORT_NULL);
-+	if (msg_result != MACH_MSG_SUCCESS) {
-+		return msg_result;
-+	}
-+
-+	return KERN_SUCCESS;
-+}
-+#endif
-+
-+#else /* not TARGET_OS_IPHONE || TARGET_OSX_USE_64BIT_EXCEPTIONS */
-+
-+#define breakpad_exception_raise exception_raise
-+
- boolean_t breakpad_exc_server(mach_msg_header_t* request,
-                               mach_msg_header_t* reply) {
-   return exc_server(request, reply);
-@@ -414,7 +542,11 @@ bool ExceptionHandler::WriteMinidumpWithException(int exception_type,
- 
- kern_return_t ForwardException(mach_port_t task, mach_port_t failed_thread,
-                                exception_type_t exception,
-+#if TARGET_OSX_USE_64BIT_EXCEPTIONS
-+                               mach_exception_data_t code,
-+#else
-                                exception_data_t code,
-+#endif
-                                mach_msg_type_number_t code_count) {
-   // At this time, we should have called Uninstall() on the exception handler
-   // so that the current exception ports are the ones that we should be
-@@ -448,11 +580,25 @@ kern_return_t ForwardException(mach_port_t task, mach_port_t failed_thread,
-   mach_port_t target_port = current.ports[found];
-   exception_behavior_t target_behavior = current.behaviors[found];
- 
-+#if TARGET_OSX_USE_64BIT_EXCEPTIONS
-+  boolean_t code64 = (target_behavior & MACH_EXCEPTION_CODES) != 0;
-+  target_behavior = target_behavior & ~MACH_EXCEPTION_CODES;
-+
-+  if (target_behavior == EXCEPTION_DEFAULT && !code64) {
-+    // we could in theory handle this by downcasting codes to int_t and calling
-+    // exception_raise instead of breakpad_exception_raise with the int_t array
-+    // below; but, really, we end up aborting the process before we ever
-+    // get here, so why bother?
-+    fprintf(stderr, "*** EXCEPTION_DEFAULT but without MACH_EXCEPTION_CODES bit, we don't have code to forward this");
-+    return KERN_FAILURE;
-+  }
-+#endif
-+
-   kern_return_t result;
-   switch (target_behavior) {
-     case EXCEPTION_DEFAULT:
--      result = exception_raise(target_port, failed_thread, task, exception,
--                               code, code_count);
-+      result = breakpad_exception_raise(target_port, failed_thread, task, exception,
-+                                        code, code_count);
-       break;
- 
-     default:
-@@ -480,90 +626,99 @@ void* ExceptionHandler::WaitForMessage(void* exception_handler_class) {
-                                     self->handler_port_,
-                                     MACH_MSG_TIMEOUT_NONE, MACH_PORT_NULL);
- 
--
--    if (result == KERN_SUCCESS) {
--      // Uninstall our handler so that we don't get in a loop if the process of
--      // writing out a minidump causes an exception.  However, if the exception
--      // was caused by a fork'd process, don't uninstall things
--
--      // If the actual exception code is zero, then we're calling this handler
--      // in a way that indicates that we want to either exit this thread or
--      // generate a minidump
--      //
--      // While reporting, all threads (except this one) must be suspended
--      // to avoid misleading stacks.  If appropriate they will be resumed
--      // afterwards.
--      if (!receive.exception) {
--        // Don't touch self, since this message could have been sent
--        // from its destructor.
--        if (receive.header.msgh_id == kShutdownMessage)
--          return NULL;
--
--        self->SuspendThreads();
-+    if (result != KERN_SUCCESS)
-+      continue;
-+
-+    // Uninstall our handler so that we don't get in a loop if the process of
-+    // writing out a minidump causes an exception.  However, if the exception
-+    // was caused by a fork'd process, don't uninstall things
-+
-+    // If the actual exception code is zero, then we're calling this handler
-+    // in a way that indicates that we want to either exit this thread or
-+    // generate a minidump
-+    //
-+    // While reporting, all threads (except this one) must be suspended
-+    // to avoid misleading stacks.  If appropriate they will be resumed
-+    // afterwards.
-+    if (!receive.exception) {
-+      // Don't touch self, since this message could have been sent
-+      // from its destructor.
-+      if (receive.header.msgh_id == kShutdownMessage)
-+        return NULL;
-+
-+      self->SuspendThreads();
- 
- #if USE_PROTECTED_ALLOCATIONS
--        if (gBreakpadAllocator)
--          gBreakpadAllocator->Unprotect();
-+      if (gBreakpadAllocator)
-+        gBreakpadAllocator->Unprotect();
- #endif
- 
--        mach_port_t thread = MACH_PORT_NULL;
--        int exception_type = 0;
--        int exception_code = 0;
--        if (receive.header.msgh_id == kWriteDumpWithExceptionMessage) {
--          thread = receive.thread.name;
--          exception_type = EXC_BREAKPOINT;
-+      mach_port_t thread = MACH_PORT_NULL;
-+      int exception_type = 0;
-+      int exception_code = 0;
-+      if (receive.header.msgh_id == kWriteDumpWithExceptionMessage) {
-+        thread = receive.thread.name;
-+        exception_type = EXC_BREAKPOINT;
- #if defined(__i386__) || defined(__x86_64__)
--          exception_code = EXC_I386_BPT;
-+        exception_code = EXC_I386_BPT;
- #elif defined(__ppc__) || defined(__ppc64__)
--          exception_code = EXC_PPC_BREAKPOINT;
-+        exception_code = EXC_PPC_BREAKPOINT;
- #elif defined(__arm__)
--          exception_code = EXC_ARM_BREAKPOINT;
-+        exception_code = EXC_ARM_BREAKPOINT;
- #else
- #error architecture not supported
- #endif
--        }
-+      }
- 
--        // Write out the dump and save the result for later retrieval
--        self->last_minidump_write_result_ =
--          self->WriteMinidumpWithException(exception_type, exception_code,
--                                           0, NULL, thread,
--                                           false, false);
-+      // Write out the dump and save the result for later retrieval
-+      self->last_minidump_write_result_ =
-+        self->WriteMinidumpWithException(exception_type, exception_code,
-+                                         0, NULL, thread,
-+                                         false, false);
- 
- #if USE_PROTECTED_ALLOCATIONS
--        if (gBreakpadAllocator)
--          gBreakpadAllocator->Protect();
-+      if (gBreakpadAllocator)
-+        gBreakpadAllocator->Protect();
-+#endif
-+
-+      self->ResumeThreads();
-+
-+      if (self->use_minidump_write_mutex_)
-+        pthread_mutex_unlock(&self->minidump_write_mutex_);
-+    } else {
-+      // When forking a child process with the exception handler installed,
-+      // if the child crashes, it will send the exception back to the parent
-+      // process.  The check for task == self_task() ensures that only
-+      // exceptions that occur in the parent process are caught and
-+      // processed.  If the exception was not caused by this task, we
-+      // still need to call into the exception server and have it return
-+      // KERN_FAILURE (see catch_exception_raise) in order for the kernel
-+      // to move onto the host exception handler for the child task
-+      if (receive.task.name == mach_task_self()) {
-+#if TARGET_OSX_USE_64BIT_EXCEPTIONS
-+        int64_t subcode = 0;
-+#else
-+        int subcode = 0;
- #endif
- 
--        self->ResumeThreads();
-+        if (receive.exception == EXC_BAD_ACCESS && receive.code_count > 1)
-+          subcode = receive.code[1];
- 
--        if (self->use_minidump_write_mutex_)
--          pthread_mutex_unlock(&self->minidump_write_mutex_);
--      } else {
--        // When forking a child process with the exception handler installed,
--        // if the child crashes, it will send the exception back to the parent
--        // process.  The check for task == self_task() ensures that only
--        // exceptions that occur in the parent process are caught and
--        // processed.  If the exception was not caused by this task, we
--        // still need to call into the exception server and have it return
--        // KERN_FAILURE (see catch_exception_raise) in order for the kernel
--        // to move onto the host exception handler for the child task
--        if (receive.task.name == mach_task_self()) {
--          self->SuspendThreads();
-+        self->SuspendThreads();
- 
- #if USE_PROTECTED_ALLOCATIONS
-         if (gBreakpadAllocator)
-           gBreakpadAllocator->Unprotect();
- #endif
- 
--        int subcode = 0;
--        if (receive.exception == EXC_BAD_ACCESS && receive.code_count > 1)
--          subcode = receive.code[1];
--
-         // Generate the minidump with the exception data.
-         self->WriteMinidumpWithException(receive.exception, receive.code[0],
-                                          subcode, NULL, receive.thread.name,
-                                          true, false);
- 
-+        // Note! We passed "true" to the exit_after_write param above;
-+        // this code will never execute, because the process will have exited.
-+
- #if USE_PROTECTED_ALLOCATIONS
-         // This may have become protected again within
-         // WriteMinidumpWithException, but it needs to be unprotected for
-@@ -578,19 +733,20 @@ void* ExceptionHandler::WaitForMessage(void* exception_handler_class) {
-         if (gBreakpadAllocator)
-           gBreakpadAllocator->Protect();
- #endif
--        }
--        // Pass along the exception to the server, which will setup the
--        // message and call catch_exception_raise() and put the return
--        // code into the reply.
--        ExceptionReplyMessage reply;
--        if (!breakpad_exc_server(&receive.header, &reply.header))
--          exit(1);
--
--        // Send a reply and exit
--        mach_msg(&(reply.header), MACH_SEND_MSG,
--                 reply.header.msgh_size, 0, MACH_PORT_NULL,
--                 MACH_MSG_TIMEOUT_NONE, MACH_PORT_NULL);
-+      } // if (receive.task.name == mach_task_self())
-+
-+      // Pass along the exception to the server, which will setup the
-+      // message and call catch_exception_raise() and put the return
-+      // code into the reply.
-+      ExceptionReplyMessage reply;
-+      if (!breakpad_exc_server(&receive.header, &reply.header)) {
-+        exit(1);
-       }
-+
-+      // Send a reply
-+      mach_msg(&(reply.header), MACH_SEND_MSG,
-+               reply.header.msgh_size, 0, MACH_PORT_NULL,
-+               MACH_MSG_TIMEOUT_NONE, MACH_PORT_NULL);
-     }
-   }
- 
-@@ -622,6 +778,7 @@ bool ExceptionHandler::InstallHandler() {
-   if (gProtectedData.handler != NULL) {
-     return false;
-   }
-+
- #if TARGET_OS_IPHONE
-   if (!IsOutOfProcess()) {
-     struct sigaction sa;
-@@ -670,7 +827,12 @@ bool ExceptionHandler::InstallHandler() {
-   // Setup the exception ports on this task
-   if (result == KERN_SUCCESS)
-     result = task_set_exception_ports(current_task, s_exception_mask,
--                                      handler_port_, EXCEPTION_DEFAULT,
-+                                      handler_port_,
-+#if TARGET_OSX_USE_64BIT_EXCEPTIONS
-+                                      EXCEPTION_DEFAULT | MACH_EXCEPTION_CODES,
-+#else
-+                                      EXCEPTION_DEFAULT,
-+#endif
-                                       THREAD_STATE_NONE);
- 
-   installed_exception_handler_ = (result == KERN_SUCCESS);
deleted file mode 100644
--- a/toolkit/crashreporter/breakpad-patches/10-user-osx-handlers.patch
+++ /dev/null
@@ -1,85 +0,0 @@
-commit 79a74a58644e515c61846b71b6da42cf9b486448
-Author: Vladimir Vukicevic <vladimir@pobox.com>
-Date:   Mon Mar 18 18:50:19 2013 -0400
-
-    Add BreakpadUserExceptionHandler support to breakpad for first-chance handling
-
-diff --git a/toolkit/crashreporter/google-breakpad/src/client/mac/handler/exception_handler.cc b/toolkit/crashreporter/google-breakpad/src/client/mac/handler/exception_handler.cc
-index db605dc..70d75ec 100644
---- a/toolkit/crashreporter/google-breakpad/src/client/mac/handler/exception_handler.cc
-+++ b/toolkit/crashreporter/google-breakpad/src/client/mac/handler/exception_handler.cc
-@@ -133,6 +133,22 @@ struct ExceptionReplyMessage {
- #pragma pack()
- #endif
- 
-+// the type of function that an exception forwarder needs to have
-+typedef boolean_t (*UserExceptionHandlerFunc) (exception_type_t exception,
-+#if TARGET_OSX_USE_64BIT_EXCEPTIONS
-+                                               mach_exception_data_t code,
-+#else
-+                                               exception_data_t code,
-+#endif
-+                                               mach_msg_type_number_t code_count,
-+                                               mach_port_t thread);
-+
-+// If userspace needs to see exceptions before breakpad gets to it, it should
-+// define an external symbol with the name BreakpadUserExceptionHandler or
-+// BreakpadUserExceptionHandler64.  The latter will be used with
-+// TARGET_OSX_USE_64BIT_EXCEPTIONS.
-+static UserExceptionHandlerFunc s_UserExceptionHandler = NULL;
-+
- // Only catch these three exceptions.  The other ones are nebulously defined
- // and may result in treating a non-fatal exception as fatal.
- exception_mask_t s_exception_mask = EXC_MASK_BAD_ACCESS |
-@@ -704,6 +720,38 @@ void* ExceptionHandler::WaitForMessage(void* exception_handler_class) {
-         if (receive.exception == EXC_BAD_ACCESS && receive.code_count > 1)
-           subcode = receive.code[1];
- 
-+        if (s_UserExceptionHandler &&
-+            s_UserExceptionHandler(receive.exception, receive.code, receive.code_count,
-+                                   receive.thread.name) == TRUE) {
-+          // Userspace handler got it.  Create an approriate reply indicating success,
-+          // and send it back to the kernel.
-+          ExceptionReplyMessage reply;
-+
-+          // the reply needs to have msgh_id + 100
-+          reply.header.msgh_id = receive.header.msgh_id + 100;
-+          reply.header.msgh_bits = MACH_MSGH_BITS(MACH_MSGH_BITS_REMOTE(receive.header.msgh_bits), 0);
-+          reply.header.msgh_size = sizeof(reply);
-+          reply.header.msgh_remote_port = receive.header.msgh_remote_port;
-+          reply.header.msgh_local_port = MACH_PORT_NULL;
-+
-+          reply.ndr = NDR_record;
-+          reply.return_code = KERN_SUCCESS;
-+
-+          // actually send it off
-+          result = mach_msg(&(reply.header), MACH_SEND_MSG,
-+                            reply.header.msgh_size, 0, MACH_PORT_NULL,
-+                            MACH_MSG_TIMEOUT_NONE, MACH_PORT_NULL);
-+          if (result != KERN_SUCCESS) {
-+            // if this failed, we're likely hung; the thread will never continue.
-+            // just bail.
-+            fprintf(stderr, "mach_msg reply after user exception handler returned %d!\n", result);
-+            exit(1);
-+          }
-+
-+          // go back to waiting for messages
-+          continue;
-+        }
-+
-         self->SuspendThreads();
- 
- #if USE_PROTECTED_ALLOCATIONS
-@@ -779,6 +827,12 @@ bool ExceptionHandler::InstallHandler() {
-     return false;
-   }
- 
-+#if TARGET_OSX_USE_64BIT_EXCEPTIONS
-+  s_UserExceptionHandler = (UserExceptionHandlerFunc) dlsym(RTLD_SELF, "BreakpadUserExceptionHandler64");
-+#else
-+  s_UserExceptionHandler = (UserExceptionHandlerFunc) dlsym(RTLD_SELF, "BreakpadUserExceptionHandler");
-+#endif
-+
- #if TARGET_OS_IPHONE
-   if (!IsOutOfProcess()) {
-     struct sigaction sa;
--- a/toolkit/crashreporter/google-breakpad/src/client/mac/handler/exception_handler.cc
+++ b/toolkit/crashreporter/google-breakpad/src/client/mac/handler/exception_handler.cc
@@ -26,27 +26,20 @@
 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
 #include <mach/exc.h>
 #include <mach/mig.h>
 #include <pthread.h>
 #include <signal.h>
-#include <dlfcn.h>
 #include <TargetConditionals.h>
 
 #include <map>
 
-#ifdef __x86_64__
-// On x86-64, use the 64-bit exception catching mechanism so that exception
-// codes don't get truncated
-#define TARGET_OSX_USE_64BIT_EXCEPTIONS 1
-#endif
-
 #include "client/mac/handler/exception_handler.h"
 #include "client/mac/handler/minidump_generator.h"
 #include "common/mac/macho_utilities.h"
 #include "common/mac/scoped_task_suspend-inl.h"
 #include "google_breakpad/common/minidump_exception_mac.h"
 
 #ifndef __EXCEPTIONS
 // This file uses C++ try/catch (but shouldn't). Duplicate the macros from
@@ -85,81 +78,49 @@ static union {
 #endif
   google_breakpad::ExceptionHandler *handler;
 } gProtectedData;
 
 using std::map;
 
 // These structures and techniques are illustrated in
 // Mac OS X Internals, Amit Singh, ch 9.7
-#ifdef  __MigPackStructs
-#pragma pack(4)
-#endif
 struct ExceptionMessage {
   mach_msg_header_t           header;
   mach_msg_body_t             body;
   mach_msg_port_descriptor_t  thread;
   mach_msg_port_descriptor_t  task;
   NDR_record_t                ndr;
   exception_type_t            exception;
   mach_msg_type_number_t      code_count;
-#if TARGET_OSX_USE_64BIT_EXCEPTIONS
-  int64_t                     code[EXCEPTION_CODE_MAX];
-#else
   integer_t                   code[EXCEPTION_CODE_MAX];
-#endif
   char                        padding[512];
 };
-#ifdef  __MigPackStructs
-#pragma pack()
-#endif
 
 struct ExceptionParameters {
   ExceptionParameters() : count(0) {}
   mach_msg_type_number_t count;
   exception_mask_t masks[EXC_TYPES_COUNT];
   mach_port_t ports[EXC_TYPES_COUNT];
   exception_behavior_t behaviors[EXC_TYPES_COUNT];
   thread_state_flavor_t flavors[EXC_TYPES_COUNT];
 };
 
-#ifdef  __MigPackStructs
-#pragma pack(4)
-#endif
 struct ExceptionReplyMessage {
   mach_msg_header_t  header;
   NDR_record_t       ndr;
   kern_return_t      return_code;
 };
-#ifdef  __MigPackStructs
-#pragma pack()
-#endif
-
-// the type of function that an exception forwarder needs to have
-typedef boolean_t (*UserExceptionHandlerFunc) (exception_type_t exception,
-#if TARGET_OSX_USE_64BIT_EXCEPTIONS
-                                               mach_exception_data_t code,
-#else
-                                               exception_data_t code,
-#endif
-                                               mach_msg_type_number_t code_count,
-                                               mach_port_t thread);
-
-// If userspace needs to see exceptions before breakpad gets to it, it should
-// define an external symbol with the name BreakpadUserExceptionHandler or
-// BreakpadUserExceptionHandler64.  The latter will be used with
-// TARGET_OSX_USE_64BIT_EXCEPTIONS.
-static UserExceptionHandlerFunc s_UserExceptionHandler = NULL;
 
 // Only catch these three exceptions.  The other ones are nebulously defined
 // and may result in treating a non-fatal exception as fatal.
 exception_mask_t s_exception_mask = EXC_MASK_BAD_ACCESS |
 EXC_MASK_BAD_INSTRUCTION | EXC_MASK_ARITHMETIC | EXC_MASK_BREAKPOINT;
 
-#if !TARGET_OS_IPHONE && !TARGET_OSX_USE_64BIT_EXCEPTIONS
+#if !TARGET_OS_IPHONE
 extern "C" {
   // Forward declarations for functions that need "C" style compilation
   boolean_t exc_server(mach_msg_header_t* request,
                        mach_msg_header_t* reply);
 
   // This symbol must be visible to dlsym() - see
   // http://code.google.com/p/google-breakpad/issues/detail?id=345 for details.
   kern_return_t catch_exception_raise(mach_port_t target_port,
@@ -170,47 +131,32 @@ extern "C" {
                                       mach_msg_type_number_t code_count)
       __attribute__((visibility("default")));
 }
 #endif
 
 kern_return_t ForwardException(mach_port_t task,
                                mach_port_t failed_thread,
                                exception_type_t exception,
-#if TARGET_OSX_USE_64BIT_EXCEPTIONS
-                               mach_exception_data_t code,
-#else
                                exception_data_t code,
-#endif
                                mach_msg_type_number_t code_count);
 
-#if TARGET_OS_IPHONE || TARGET_OSX_USE_64BIT_EXCEPTIONS
-
 #if TARGET_OS_IPHONE
-// no idea if this is still correct; this is the value the old code had
-#define MACH_EXCEPTION_RAISE_RPC 2401
-#elif TARGET_OSX_USE_64BIT_EXCEPTIONS
-#define MACH_EXCEPTION_RAISE_RPC 2405
-#else
-#error Need a value for MACH_EXCEPTION_RAISE_RPC
-#endif
-
 // Implementation is based on the implementation generated by mig.
 boolean_t breakpad_exc_server(mach_msg_header_t* InHeadP,
-                              mach_msg_header_t* OutHeadP)
-{
+                              mach_msg_header_t* OutHeadP) {
   OutHeadP->msgh_bits =
       MACH_MSGH_BITS(MACH_MSGH_BITS_REMOTE(InHeadP->msgh_bits), 0);
   OutHeadP->msgh_remote_port = InHeadP->msgh_remote_port;
   /* Minimal size: routine() will update it if different */
   OutHeadP->msgh_size = (mach_msg_size_t)sizeof(mig_reply_error_t);
   OutHeadP->msgh_local_port = MACH_PORT_NULL;
   OutHeadP->msgh_id = InHeadP->msgh_id + 100;
 
-  if (InHeadP->msgh_id != MACH_EXCEPTION_RAISE_RPC) {
+  if (InHeadP->msgh_id != 2401) {
     ((mig_reply_error_t*)OutHeadP)->NDR = NDR_record;
     ((mig_reply_error_t*)OutHeadP)->RetCode = MIG_BAD_ID;
     return FALSE;
   }
 
 #ifdef  __MigPackStructs
 #pragma pack(4)
 #endif
@@ -219,21 +165,17 @@ boolean_t breakpad_exc_server(mach_msg_h
     /* start of the kernel processed data */
     mach_msg_body_t msgh_body;
     mach_msg_port_descriptor_t thread;
     mach_msg_port_descriptor_t task;
     /* end of the kernel processed data */
     NDR_record_t NDR;
     exception_type_t exception;
     mach_msg_type_number_t codeCnt;
-#if TARGET_OSX_USE_64BIT_EXCEPTIONS
-    int64_t code[2];
-#else
     integer_t code[2];
-#endif
     mach_msg_trailer_t trailer;
   } Request;
 
   typedef struct {
     mach_msg_header_t Head;
     NDR_record_t NDR;
     kern_return_t RetCode;
   } Reply;
@@ -250,103 +192,17 @@ boolean_t breakpad_exc_server(mach_msg_h
   OutP->RetCode = ForwardException(In0P->task.name,
                                    In0P->thread.name,
                                    In0P->exception,
                                    In0P->code,
                                    In0P->codeCnt);
   OutP->NDR = NDR_record;
   return TRUE;
 }
-
-#if TARGET_OSX_USE_64BIT_EXCEPTIONS
-// Implementation is based on the implementation generated by mig.
-kern_return_t breakpad_exception_raise (mach_port_t exception_port,
-                                        mach_port_t thread,
-                                        mach_port_t task,
-                                        exception_type_t exception,
-                                        mach_exception_data_t code,
-                                        mach_msg_type_number_t codeCnt)
-{
-#ifdef  __MigPackStructs
-#pragma pack(4)
-#endif
-	typedef struct {
-		mach_msg_header_t Head;
-		/* start of the kernel processed data */
-		mach_msg_body_t msgh_body;
-		mach_msg_port_descriptor_t thread;
-		mach_msg_port_descriptor_t task;
-		/* end of the kernel processed data */
-		NDR_record_t NDR;
-		exception_type_t exception;
-		mach_msg_type_number_t codeCnt;
-		int64_t code[2];
-	} Request;
-#ifdef  __MigPackStructs
-#pragma pack()
-#endif
-
-#ifdef  __MigPackStructs
-#pragma pack(4)
-#endif
-	typedef struct {
-		mach_msg_header_t Head;
-		NDR_record_t NDR;
-		kern_return_t RetCode;
-		mach_msg_trailer_t trailer;
-	} Reply;
-#ifdef  __MigPackStructs
-#pragma pack()
-#endif
-
-    Request In;
-	Request *InP = &In;
-
-	mach_msg_return_t msg_result;
-	unsigned int msgh_size;
-
-	InP->msgh_body.msgh_descriptor_count = 2;
-	InP->thread.name = thread;
-	InP->thread.disposition = 19;
-	InP->thread.type = MACH_MSG_PORT_DESCRIPTOR;
-	InP->task.name = task;
-	InP->task.disposition = 19;
-	InP->task.type = MACH_MSG_PORT_DESCRIPTOR;
-	InP->NDR = NDR_record;
-
-	InP->exception = exception;
-
-	if (codeCnt > 2) {
-		{ return MIG_ARRAY_TOO_LARGE; }
-	}
-	(void)memcpy((char *) InP->code, (const char *) code, 8 * codeCnt);
-
-	msgh_size = (mach_msg_size_t)(sizeof(Request) - 16) + ((8 * codeCnt));
-	InP->Head.msgh_bits = MACH_MSGH_BITS_COMPLEX|
-		MACH_MSGH_BITS(19, MACH_MSG_TYPE_MAKE_SEND_ONCE);
-	/* msgh_size passed as argument */
-	InP->Head.msgh_remote_port = exception_port;
-	InP->Head.msgh_local_port = mig_get_reply_port();
-	InP->Head.msgh_id = 2405;
-
-	msg_result = mach_msg(&InP->Head, MACH_SEND_MSG|MACH_RCV_MSG|MACH_MSG_OPTION_NONE,
-                          msgh_size, (mach_msg_size_t)sizeof(Reply), InP->Head.msgh_local_port,
-                          MACH_MSG_TIMEOUT_NONE, MACH_PORT_NULL);
-	if (msg_result != MACH_MSG_SUCCESS) {
-		return msg_result;
-	}
-
-	return KERN_SUCCESS;
-}
-#endif
-
-#else /* not TARGET_OS_IPHONE || TARGET_OSX_USE_64BIT_EXCEPTIONS */
-
-#define breakpad_exception_raise exception_raise
-
+#else
 boolean_t breakpad_exc_server(mach_msg_header_t* request,
                               mach_msg_header_t* reply) {
   return exc_server(request, reply);
 }
 
 // Callback from exc_server()
 kern_return_t catch_exception_raise(mach_port_t port, mach_port_t failed_thread,
                                     mach_port_t task,
@@ -553,21 +409,17 @@ bool ExceptionHandler::WriteMinidumpWith
     }
   }
 
   return result;
 }
 
 kern_return_t ForwardException(mach_port_t task, mach_port_t failed_thread,
                                exception_type_t exception,
-#if TARGET_OSX_USE_64BIT_EXCEPTIONS
-                               mach_exception_data_t code,
-#else
                                exception_data_t code,
-#endif
                                mach_msg_type_number_t code_count) {
   // At this time, we should have called Uninstall() on the exception handler
   // so that the current exception ports are the ones that we should be
   // forwarding to.
   ExceptionParameters current;
 
   current.count = EXC_TYPES_COUNT;
   mach_port_t current_task = mach_task_self();
@@ -591,35 +443,21 @@ kern_return_t ForwardException(mach_port
   if (found == current.count) {
     fprintf(stderr, "** No previous ports for forwarding!! \n");
     exit(KERN_FAILURE);
   }
 
   mach_port_t target_port = current.ports[found];
   exception_behavior_t target_behavior = current.behaviors[found];
 
-#if TARGET_OSX_USE_64BIT_EXCEPTIONS
-  boolean_t code64 = (target_behavior & MACH_EXCEPTION_CODES) != 0;
-  target_behavior = target_behavior & ~MACH_EXCEPTION_CODES;
-
-  if (target_behavior == EXCEPTION_DEFAULT && !code64) {
-    // we could in theory handle this by downcasting codes to int_t and calling
-    // exception_raise instead of breakpad_exception_raise with the int_t array
-    // below; but, really, we end up aborting the process before we ever
-    // get here, so why bother?
-    fprintf(stderr, "*** EXCEPTION_DEFAULT but without MACH_EXCEPTION_CODES bit, we don't have code to forward this");
-    return KERN_FAILURE;
-  }
-#endif
-
   kern_return_t result;
   switch (target_behavior) {
     case EXCEPTION_DEFAULT:
-      result = breakpad_exception_raise(target_port, failed_thread, task, exception,
-                                        code, code_count);
+      result = exception_raise(target_port, failed_thread, task, exception,
+                               code, code_count);
       break;
 
     default:
       fprintf(stderr, "** Unknown exception behavior: %d\n", target_behavior);
       result = KERN_FAILURE;
       break;
   }
 
@@ -637,169 +475,127 @@ void* ExceptionHandler::WaitForMessage(v
     receive.header.msgh_local_port = self->handler_port_;
     receive.header.msgh_size = static_cast<mach_msg_size_t>(sizeof(receive));
     kern_return_t result = mach_msg(&(receive.header),
                                     MACH_RCV_MSG | MACH_RCV_LARGE, 0,
                                     receive.header.msgh_size,
                                     self->handler_port_,
                                     MACH_MSG_TIMEOUT_NONE, MACH_PORT_NULL);
 
-    if (result != KERN_SUCCESS)
-      continue;
 
-    // Uninstall our handler so that we don't get in a loop if the process of
-    // writing out a minidump causes an exception.  However, if the exception
-    // was caused by a fork'd process, don't uninstall things
-
-    // If the actual exception code is zero, then we're calling this handler
-    // in a way that indicates that we want to either exit this thread or
-    // generate a minidump
-    //
-    // While reporting, all threads (except this one) must be suspended
-    // to avoid misleading stacks.  If appropriate they will be resumed
-    // afterwards.
-    if (!receive.exception) {
-      // Don't touch self, since this message could have been sent
-      // from its destructor.
-      if (receive.header.msgh_id == kShutdownMessage)
-        return NULL;
-
-      self->SuspendThreads();
-
-#if USE_PROTECTED_ALLOCATIONS
-      if (gBreakpadAllocator)
-        gBreakpadAllocator->Unprotect();
-#endif
-
-      mach_port_t thread = MACH_PORT_NULL;
-      int exception_type = 0;
-      int exception_code = 0;
-      if (receive.header.msgh_id == kWriteDumpWithExceptionMessage) {
-        thread = receive.thread.name;
-        exception_type = EXC_BREAKPOINT;
-#if defined(__i386__) || defined(__x86_64__)
-        exception_code = EXC_I386_BPT;
-#elif defined(__ppc__) || defined(__ppc64__)
-        exception_code = EXC_PPC_BREAKPOINT;
-#elif defined(__arm__)
-        exception_code = EXC_ARM_BREAKPOINT;
-#else
-#error architecture not supported
-#endif
-      }
-
-      // Write out the dump and save the result for later retrieval
-      self->last_minidump_write_result_ =
-        self->WriteMinidumpWithException(exception_type, exception_code,
-                                         0, NULL, thread,
-                                         false, false);
-
-#if USE_PROTECTED_ALLOCATIONS
-      if (gBreakpadAllocator)
-        gBreakpadAllocator->Protect();
-#endif
+    if (result == KERN_SUCCESS) {
+      // Uninstall our handler so that we don't get in a loop if the process of
+      // writing out a minidump causes an exception.  However, if the exception
+      // was caused by a fork'd process, don't uninstall things
 
-      self->ResumeThreads();
-
-      if (self->use_minidump_write_mutex_)
-        pthread_mutex_unlock(&self->minidump_write_mutex_);
-    } else {
-      // When forking a child process with the exception handler installed,
-      // if the child crashes, it will send the exception back to the parent
-      // process.  The check for task == self_task() ensures that only
-      // exceptions that occur in the parent process are caught and
-      // processed.  If the exception was not caused by this task, we
-      // still need to call into the exception server and have it return
-      // KERN_FAILURE (see catch_exception_raise) in order for the kernel
-      // to move onto the host exception handler for the child task
-      if (receive.task.name == mach_task_self()) {
-#if TARGET_OSX_USE_64BIT_EXCEPTIONS
-        int64_t subcode = 0;
-#else
-        int subcode = 0;
-#endif
-
-        if (receive.exception == EXC_BAD_ACCESS && receive.code_count > 1)
-          subcode = receive.code[1];
-
-        if (s_UserExceptionHandler &&
-            s_UserExceptionHandler(receive.exception, receive.code, receive.code_count,
-                                   receive.thread.name) == TRUE) {
-          // Userspace handler got it.  Create an approriate reply indicating success,
-          // and send it back to the kernel.
-          ExceptionReplyMessage reply;
-
-          // the reply needs to have msgh_id + 100
-          reply.header.msgh_id = receive.header.msgh_id + 100;
-          reply.header.msgh_bits = MACH_MSGH_BITS(MACH_MSGH_BITS_REMOTE(receive.header.msgh_bits), 0);
-          reply.header.msgh_size = sizeof(reply);
-          reply.header.msgh_remote_port = receive.header.msgh_remote_port;
-          reply.header.msgh_local_port = MACH_PORT_NULL;
-
-          reply.ndr = NDR_record;
-          reply.return_code = KERN_SUCCESS;
-
-          // actually send it off
-          result = mach_msg(&(reply.header), MACH_SEND_MSG,
-                            reply.header.msgh_size, 0, MACH_PORT_NULL,
-                            MACH_MSG_TIMEOUT_NONE, MACH_PORT_NULL);
-          if (result != KERN_SUCCESS) {
-            // if this failed, we're likely hung; the thread will never continue.
-            // just bail.
-            fprintf(stderr, "mach_msg reply after user exception handler returned %d!\n", result);
-            exit(1);
-          }
-
-          // go back to waiting for messages
-          continue;
-        }
+      // If the actual exception code is zero, then we're calling this handler
+      // in a way that indicates that we want to either exit this thread or
+      // generate a minidump
+      //
+      // While reporting, all threads (except this one) must be suspended
+      // to avoid misleading stacks.  If appropriate they will be resumed
+      // afterwards.
+      if (!receive.exception) {
+        // Don't touch self, since this message could have been sent
+        // from its destructor.
+        if (receive.header.msgh_id == kShutdownMessage)
+          return NULL;
 
         self->SuspendThreads();
 
 #if USE_PROTECTED_ALLOCATIONS
         if (gBreakpadAllocator)
           gBreakpadAllocator->Unprotect();
 #endif
 
+        mach_port_t thread = MACH_PORT_NULL;
+        int exception_type = 0;
+        int exception_code = 0;
+        if (receive.header.msgh_id == kWriteDumpWithExceptionMessage) {
+          thread = receive.thread.name;
+          exception_type = EXC_BREAKPOINT;
+#if defined(__i386__) || defined(__x86_64__)
+          exception_code = EXC_I386_BPT;
+#elif defined(__ppc__) || defined(__ppc64__)
+          exception_code = EXC_PPC_BREAKPOINT;
+#elif defined(__arm__)
+          exception_code = EXC_ARM_BREAKPOINT;
+#else
+#error architecture not supported
+#endif
+        }
+
+        // Write out the dump and save the result for later retrieval
+        self->last_minidump_write_result_ =
+          self->WriteMinidumpWithException(exception_type, exception_code,
+                                           0, NULL, thread,
+                                           false, false);
+
+#if USE_PROTECTED_ALLOCATIONS
+        if (gBreakpadAllocator)
+          gBreakpadAllocator->Protect();
+#endif
+
+        self->ResumeThreads();
+
+        if (self->use_minidump_write_mutex_)
+          pthread_mutex_unlock(&self->minidump_write_mutex_);
+      } else {
+        // When forking a child process with the exception handler installed,
+        // if the child crashes, it will send the exception back to the parent
+        // process.  The check for task == self_task() ensures that only
+        // exceptions that occur in the parent process are caught and
+        // processed.  If the exception was not caused by this task, we
+        // still need to call into the exception server and have it return
+        // KERN_FAILURE (see catch_exception_raise) in order for the kernel
+        // to move onto the host exception handler for the child task
+        if (receive.task.name == mach_task_self()) {
+          self->SuspendThreads();
+
+#if USE_PROTECTED_ALLOCATIONS
+        if (gBreakpadAllocator)
+          gBreakpadAllocator->Unprotect();
+#endif
+
+        int subcode = 0;
+        if (receive.exception == EXC_BAD_ACCESS && receive.code_count > 1)
+          subcode = receive.code[1];
+
         // Generate the minidump with the exception data.
         self->WriteMinidumpWithException(receive.exception, receive.code[0],
                                          subcode, NULL, receive.thread.name,
                                          true, false);
 
-        // Note! We passed "true" to the exit_after_write param above;
-        // this code will never execute, because the process will have exited.
-
 #if USE_PROTECTED_ALLOCATIONS
         // This may have become protected again within
         // WriteMinidumpWithException, but it needs to be unprotected for
         // UninstallHandler.
         if (gBreakpadAllocator)
           gBreakpadAllocator->Unprotect();
 #endif
 
         self->UninstallHandler(true);
 
 #if USE_PROTECTED_ALLOCATIONS
         if (gBreakpadAllocator)
           gBreakpadAllocator->Protect();
 #endif
-      } // if (receive.task.name == mach_task_self())
+        }
+        // Pass along the exception to the server, which will setup the
+        // message and call catch_exception_raise() and put the return
+        // code into the reply.
+        ExceptionReplyMessage reply;
+        if (!breakpad_exc_server(&receive.header, &reply.header))
+          exit(1);
 
-      // Pass along the exception to the server, which will setup the
-      // message and call catch_exception_raise() and put the return
-      // code into the reply.
-      ExceptionReplyMessage reply;
-      if (!breakpad_exc_server(&receive.header, &reply.header)) {
-        exit(1);
+        // Send a reply and exit
+        mach_msg(&(reply.header), MACH_SEND_MSG,
+                 reply.header.msgh_size, 0, MACH_PORT_NULL,
+                 MACH_MSG_TIMEOUT_NONE, MACH_PORT_NULL);
       }
-
-      // Send a reply
-      mach_msg(&(reply.header), MACH_SEND_MSG,
-               reply.header.msgh_size, 0, MACH_PORT_NULL,
-               MACH_MSG_TIMEOUT_NONE, MACH_PORT_NULL);
     }
   }
 
   return NULL;
 }
 
 // static
 void ExceptionHandler::SignalHandler(int sig, siginfo_t* info, void* uc) {
@@ -821,23 +617,16 @@ void ExceptionHandler::SignalHandler(int
 #endif
 }
 
 bool ExceptionHandler::InstallHandler() {
   // If a handler is already installed, something is really wrong.
   if (gProtectedData.handler != NULL) {
     return false;
   }
-
-#if TARGET_OSX_USE_64BIT_EXCEPTIONS
-  s_UserExceptionHandler = (UserExceptionHandlerFunc) dlsym(RTLD_SELF, "BreakpadUserExceptionHandler64");
-#else
-  s_UserExceptionHandler = (UserExceptionHandlerFunc) dlsym(RTLD_SELF, "BreakpadUserExceptionHandler");
-#endif
-
 #if TARGET_OS_IPHONE
   if (!IsOutOfProcess()) {
     struct sigaction sa;
     memset(&sa, 0, sizeof(sa));
     sigemptyset(&sa.sa_mask);
     sigaddset(&sa.sa_mask, SIGABRT);
     sa.sa_sigaction = ExceptionHandler::SignalHandler;
     sa.sa_flags = SA_SIGINFO;
@@ -876,22 +665,17 @@ bool ExceptionHandler::InstallHandler() 
                                                   &previous_->count,
                                                   previous_->ports,
                                                   previous_->behaviors,
                                                   previous_->flavors);
 
   // Setup the exception ports on this task
   if (result == KERN_SUCCESS)
     result = task_set_exception_ports(current_task, s_exception_mask,
-                                      handler_port_,
-#if TARGET_OSX_USE_64BIT_EXCEPTIONS
-                                      EXCEPTION_DEFAULT | MACH_EXCEPTION_CODES,
-#else
-                                      EXCEPTION_DEFAULT,
-#endif
+                                      handler_port_, EXCEPTION_DEFAULT,
                                       THREAD_STATE_NONE);
 
   installed_exception_handler_ = (result == KERN_SUCCESS);
 
   return installed_exception_handler_;
 }
 
 bool ExceptionHandler::UninstallHandler(bool in_exception) {