Bug 1428453 - Baldr: remove old traps (r=bbouvier)
authorLuke Wagner <luke@mozilla.com>
Fri, 23 Mar 2018 12:32:46 -0500
changeset 454632 91a7028151315c2b06b9705b539d7131389288b5
parent 454631 11913418a9073396c5a4e740d79d80114fc99427
child 454633 e154006c28478f8c089f8f4c8936009ee6d98212
push id148
push userfmarier@mozilla.com
push dateThu, 29 Mar 2018 23:06:47 +0000
reviewersbbouvier
bugs1428453
milestone61.0a1
Bug 1428453 - Baldr: remove old traps (r=bbouvier)
js/src/jit/arm/Assembler-arm.cpp
js/src/jit/arm/Assembler-arm.h
js/src/jit/arm/MacroAssembler-arm.cpp
js/src/jit/arm/MacroAssembler-arm.h
js/src/jit/arm64/Assembler-arm64.cpp
js/src/jit/arm64/Assembler-arm64.h
js/src/jit/arm64/MacroAssembler-arm64.cpp
js/src/jit/arm64/MacroAssembler-arm64.h
js/src/jit/mips-shared/Assembler-mips-shared.cpp
js/src/jit/mips-shared/Assembler-mips-shared.h
js/src/jit/mips-shared/MacroAssembler-mips-shared.cpp
js/src/jit/mips-shared/MacroAssembler-mips-shared.h
js/src/jit/mips32/MacroAssembler-mips32.cpp
js/src/jit/mips32/MacroAssembler-mips32.h
js/src/jit/mips64/MacroAssembler-mips64.cpp
js/src/jit/mips64/MacroAssembler-mips64.h
js/src/jit/none/MacroAssembler-none.h
js/src/jit/shared/Assembler-shared.h
js/src/jit/shared/CodeGenerator-shared.h
js/src/jit/x86-shared/Assembler-x86-shared.h
js/src/jit/x86-shared/MacroAssembler-x86-shared.h
js/src/wasm/WasmBuiltins.cpp
js/src/wasm/WasmCode.cpp
js/src/wasm/WasmFrameIter.cpp
js/src/wasm/WasmGenerator.cpp
js/src/wasm/WasmGenerator.h
js/src/wasm/WasmTypes.cpp
js/src/wasm/WasmTypes.h
--- a/js/src/jit/arm/Assembler-arm.cpp
+++ b/js/src/jit/arm/Assembler-arm.cpp
@@ -2201,25 +2201,16 @@ Assembler::as_b(Label* l, Condition c)
     if (oom())
         return BufferOffset();
 
     l->use(ret.getOffset());
     return ret;
 }
 
 BufferOffset
-Assembler::as_b(wasm::OldTrapDesc target, Condition c)
-{
-    Label l;
-    BufferOffset ret = as_b(&l, c);
-    bindLater(&l, target);
-    return ret;
-}
-
-BufferOffset
 Assembler::as_b(BOffImm off, Condition c, BufferOffset inst)
 {
     // JS_DISASM_ARM NOTE: Can't disassemble here, because numerous callers use this to
     // patchup old code.  Must disassemble in caller where it makes sense.  Not many callers.
     *editSrc(inst) = InstBImm(off, c);
     return inst;
 }
 
@@ -2642,28 +2633,16 @@ Assembler::bind(Label* label, BufferOffs
             b = next;
         } while (more);
     }
     label->bind(nextOffset().getOffset());
     MOZ_ASSERT(!oom());
 }
 
 void
-Assembler::bindLater(Label* label, wasm::OldTrapDesc target)
-{
-    if (label->used()) {
-        BufferOffset b(label);
-        do {
-            append(wasm::OldTrapSite(target, b.getOffset()));
-        } while (nextLink(b, &b));
-    }
-    label->reset();
-}
-
-void
 Assembler::bind(RepatchLabel* label)
 {
     // It does not seem to be useful to record this label for
     // disassembly, as the value that is bound to the label is often
     // effectively garbage and is replaced by something else later.
     BufferOffset dest = nextOffset();
     if (label->used() && !oom()) {
         // If the label has a use, then change this use to refer to the bound
--- a/js/src/jit/arm/Assembler-arm.h
+++ b/js/src/jit/arm/Assembler-arm.h
@@ -1634,17 +1634,16 @@ class Assembler : public AssemblerShared
     // bx can *only* branch to a register never to an immediate.
     BufferOffset as_bx(Register r, Condition c = Always);
 
     // Branch can branch to an immediate *or* to a register. Branches to
     // immediates are pc relative, branches to registers are absolute.
     BufferOffset as_b(BOffImm off, Condition c, Label* documentation = nullptr);
 
     BufferOffset as_b(Label* l, Condition c = Always);
-    BufferOffset as_b(wasm::OldTrapDesc target, Condition c = Always);
     BufferOffset as_b(BOffImm off, Condition c, BufferOffset inst);
 
     // blx can go to either an immediate or a register. When blx'ing to a
     // register, we change processor mode depending on the low bit of the
     // register when blx'ing to an immediate, we *always* change processor
     // state.
     BufferOffset as_blx(Label* l);
 
@@ -1742,17 +1741,16 @@ class Assembler : public AssemblerShared
 
     BufferOffset as_vmrs(Register r, Condition c = Always);
     BufferOffset as_vmsr(Register r, Condition c = Always);
 
     // Label operations.
     bool nextLink(BufferOffset b, BufferOffset* next);
     void bind(Label* label, BufferOffset boff = BufferOffset());
     void bind(RepatchLabel* label);
-    void bindLater(Label* label, wasm::OldTrapDesc target);
     uint32_t currentOffset() {
         return nextOffset().getOffset();
     }
     void retarget(Label* label, Label* target);
     // I'm going to pretend this doesn't exist for now.
     void retarget(Label* label, void* target, Relocation::Kind reloc);
 
     static void Bind(uint8_t* rawCode, const CodeLabel& label);
--- a/js/src/jit/arm/MacroAssembler-arm.cpp
+++ b/js/src/jit/arm/MacroAssembler-arm.cpp
@@ -1362,22 +1362,16 @@ MacroAssemblerARM::ma_dsb(BarrierOption 
 
 // Branches when done from within arm-specific code.
 BufferOffset
 MacroAssemblerARM::ma_b(Label* dest, Assembler::Condition c)
 {
     return as_b(dest, c);
 }
 
-BufferOffset
-MacroAssemblerARM::ma_b(wasm::OldTrapDesc target, Assembler::Condition c)
-{
-    return as_b(target, c);
-}
-
 void
 MacroAssemblerARM::ma_bx(Register dest, Assembler::Condition c)
 {
     as_bx(dest, c);
 }
 
 void
 MacroAssemblerARM::ma_b(void* target, Assembler::Condition c)
--- a/js/src/jit/arm/MacroAssembler-arm.h
+++ b/js/src/jit/arm/MacroAssembler-arm.h
@@ -359,17 +359,16 @@ class MacroAssemblerARM : public Assembl
     void ma_vpush(VFPRegister r);
 
     // Barriers.
     void ma_dmb(BarrierOption option=BarrierSY);
     void ma_dsb(BarrierOption option=BarrierSY);
 
     // Branches when done from within arm-specific code.
     BufferOffset ma_b(Label* dest, Condition c = Always);
-    BufferOffset ma_b(wasm::OldTrapDesc target, Condition c = Always);
     void ma_b(void* target, Condition c = Always);
     void ma_bx(Register dest, Condition c = Always);
 
     // This is almost NEVER necessary, we'll basically never be calling a label
     // except, possibly in the crazy bailout-table case.
     void ma_bl(Label* dest, Condition c = Always);
 
     void ma_blx(Register dest, Condition c = Always);
@@ -690,19 +689,16 @@ class MacroAssemblerARMCompat : public M
         ma_bx(reg);
     }
     void jump(const Address& addr) {
         ScratchRegisterScope scratch(asMasm());
         SecondScratchRegisterScope scratch2(asMasm());
         ma_ldr(addr, scratch, scratch2);
         ma_bx(scratch);
     }
-    void jump(wasm::OldTrapDesc target) {
-        as_b(target);
-    }
 
     void negl(Register reg) {
         ma_neg(reg, reg, SetCC);
     }
     void test32(Register lhs, Register rhs) {
         ma_tst(lhs, rhs);
     }
     void test32(Register lhs, Imm32 imm) {
--- a/js/src/jit/arm64/Assembler-arm64.cpp
+++ b/js/src/jit/arm64/Assembler-arm64.cpp
@@ -310,29 +310,16 @@ Assembler::bind(RepatchLabel* label)
         return;
     }
     int branchOffset = label->offset();
     Instruction* inst = getInstructionAt(BufferOffset(branchOffset));
     inst->SetImmPCOffsetTarget(inst + nextOffset().getOffset() - branchOffset);
 }
 
 void
-Assembler::bindLater(Label* label, wasm::OldTrapDesc target)
-{
-    if (label->used()) {
-        BufferOffset b(label);
-        do {
-            append(wasm::OldTrapSite(target, b.getOffset()));
-            b = NextLink(b);
-        } while (b.assigned());
-    }
-    label->reset();
-}
-
-void
 Assembler::addJumpRelocation(BufferOffset src, Relocation::Kind reloc)
 {
     // Only JITCODE relocations are patchable at runtime.
     MOZ_ASSERT(reloc == Relocation::JITCODE);
 
     // The jump relocation table starts with a fixed-width integer pointing
     // to the start of the extended jump table. But, we don't know the
     // actual extended jump table offset yet, so write a 0 which we'll
--- a/js/src/jit/arm64/Assembler-arm64.h
+++ b/js/src/jit/arm64/Assembler-arm64.h
@@ -194,17 +194,16 @@ class Assembler : public vixl::Assembler
     BufferOffset fImmPool(ARMFPRegister dest, uint8_t* value, vixl::LoadLiteralOp op,
                           const LiteralDoc& doc);
     BufferOffset fImmPool64(ARMFPRegister dest, double value);
     BufferOffset fImmPool32(ARMFPRegister dest, float value);
 
     void bind(Label* label) { bind(label, nextOffset()); }
     void bind(Label* label, BufferOffset boff);
     void bind(RepatchLabel* label);
-    void bindLater(Label* label, wasm::OldTrapDesc target);
 
     bool oom() const {
         return AssemblerShared::oom() ||
             armbuffer_.oom() ||
             jumpRelocations_.oom() ||
             dataRelocations_.oom();
     }
 
--- a/js/src/jit/arm64/MacroAssembler-arm64.cpp
+++ b/js/src/jit/arm64/MacroAssembler-arm64.cpp
@@ -55,27 +55,16 @@ MacroAssemblerCompat::asVIXL()
 }
 
 const vixl::MacroAssembler&
 MacroAssemblerCompat::asVIXL() const
 {
     return *static_cast<const vixl::MacroAssembler*>(this);
 }
 
-void
-MacroAssemblerCompat::B(wasm::OldTrapDesc target, Condition cond)
-{
-    Label l;
-    if (cond == Always)
-        B(&l);
-    else
-        B(&l, cond);
-    bindLater(&l, target);
-}
-
 BufferOffset
 MacroAssemblerCompat::movePatchablePtr(ImmPtr ptr, Register dest)
 {
     const size_t numInst = 1; // Inserting one load instruction.
     const unsigned numPoolEntries = 2; // Every pool entry is 4 bytes.
     uint8_t* literalAddr = (uint8_t*)(&ptr.value); // TODO: Should be const.
 
     // Scratch space for generating the load instruction.
--- a/js/src/jit/arm64/MacroAssembler-arm64.h
+++ b/js/src/jit/arm64/MacroAssembler-arm64.h
@@ -513,17 +513,16 @@ class MacroAssemblerCompat : public vixl
     void convertFloat32ToDouble(FloatRegister src, FloatRegister dest) {
         Fcvt(ARMFPRegister(dest, 64), ARMFPRegister(src, 32));
     }
     void convertDoubleToFloat32(FloatRegister src, FloatRegister dest) {
         Fcvt(ARMFPRegister(dest, 32), ARMFPRegister(src, 64));
     }
 
     using vixl::MacroAssembler::B;
-    void B(wasm::OldTrapDesc, Condition cond = Always);
 
     void convertDoubleToInt32(FloatRegister src, Register dest, Label* fail,
                               bool negativeZeroCheck = true)
     {
         vixl::UseScratchRegisterScope temps(this);
         const ARMFPRegister scratch64 = temps.AcquireD();
 
         ARMFPRegister fsrc(src, 64);
@@ -688,19 +687,16 @@ class MacroAssemblerCompat : public vixl
     }
     void jump(Register reg) {
         Br(ARMRegister(reg, 64));
     }
     void jump(const Address& addr) {
         loadPtr(addr, ip0);
         Br(vixl::ip0);
     }
-    void jump(wasm::OldTrapDesc target) {
-        B(target);
-    }
 
     void align(int alignment) {
         armbuffer_.align(alignment);
     }
 
     void haltingAlign(int alignment) {
         // TODO: Implement a proper halting align.
         // ARM doesn't have one either.
--- a/js/src/jit/mips-shared/Assembler-mips-shared.cpp
+++ b/js/src/jit/mips-shared/Assembler-mips-shared.cpp
@@ -1881,36 +1881,16 @@ AssemblerMIPSShared::bind(Label* label, 
 
             b = BufferOffset(next);
         } while (next != LabelBase::INVALID_OFFSET);
     }
     label->bind(dest.getOffset());
 }
 
 void
-AssemblerMIPSShared::bindLater(Label* label, wasm::OldTrapDesc target)
-{
-    if (label->used()) {
-        int32_t next;
-
-        BufferOffset b(label);
-        do {
-            Instruction* inst = editSrc(b);
-
-            append(wasm::OldTrapSite(target, b.getOffset()));
-            next = inst[1].encode();
-            inst[1].makeNop();
-
-            b = BufferOffset(next);
-        } while (next != LabelBase::INVALID_OFFSET);
-    }
-    label->reset();
-}
-
-void
 AssemblerMIPSShared::retarget(Label* label, Label* target)
 {
     spew("retarget %p -> %p", label, target);
     if (label->used() && !oom()) {
         if (target->bound()) {
             bind(label, BufferOffset(target));
         } else if (target->used()) {
             // The target is not bound but used. Prepend label's branch list
--- a/js/src/jit/mips-shared/Assembler-mips-shared.h
+++ b/js/src/jit/mips-shared/Assembler-mips-shared.h
@@ -1247,17 +1247,16 @@ class AssemblerMIPSShared : public Assem
     BufferOffset as_tgeu(Register rs, Register rt, uint32_t code = 0);
     BufferOffset as_tlt(Register rs, Register rt, uint32_t code = 0);
     BufferOffset as_tltu(Register rs, Register rt, uint32_t code = 0);
     BufferOffset as_teq(Register rs, Register rt, uint32_t code = 0);
     BufferOffset as_tne(Register rs, Register rt, uint32_t code = 0);
 
     // label operations
     void bind(Label* label, BufferOffset boff = BufferOffset());
-    void bindLater(Label* label, wasm::OldTrapDesc target);
     virtual void bind(InstImm* inst, uintptr_t branch, uintptr_t target) = 0;
     void bind(CodeLabel* label) {
         label->target()->bind(currentOffset());
     }
     uint32_t currentOffset() {
         return nextOffset().getOffset();
     }
     void retarget(Label* label, Label* target);
--- a/js/src/jit/mips-shared/MacroAssembler-mips-shared.cpp
+++ b/js/src/jit/mips-shared/MacroAssembler-mips-shared.cpp
@@ -321,48 +321,32 @@ MacroAssemblerMIPSShared::ma_addu(Regist
 }
 
 void
 MacroAssemblerMIPSShared::ma_addu(Register rd, Imm32 imm)
 {
     ma_addu(rd, rd, imm);
 }
 
-template <typename L>
 void
-MacroAssemblerMIPSShared::ma_addTestCarry(Register rd, Register rs, Register rt, L overflow)
+MacroAssemblerMIPSShared::ma_addTestCarry(Register rd, Register rs, Register rt, Label* overflow)
 {
     MOZ_ASSERT_IF(rd == rs, rt != rd);
     as_addu(rd, rs, rt);
     as_sltu(SecondScratchReg, rd, rd == rs? rt : rs);
     ma_b(SecondScratchReg, SecondScratchReg, overflow, Assembler::NonZero);
 }
 
-template void
-MacroAssemblerMIPSShared::ma_addTestCarry<Label*>(Register rd, Register rs,
-                                                  Register rt, Label* overflow);
-template void
-MacroAssemblerMIPSShared::ma_addTestCarry<wasm::OldTrapDesc>(Register rd, Register rs, Register rt,
-                                                             wasm::OldTrapDesc overflow);
-
-template <typename L>
 void
-MacroAssemblerMIPSShared::ma_addTestCarry(Register rd, Register rs, Imm32 imm, L overflow)
+MacroAssemblerMIPSShared::ma_addTestCarry(Register rd, Register rs, Imm32 imm, Label* overflow)
 {
     ma_li(ScratchRegister, imm);
     ma_addTestCarry(rd, rs, ScratchRegister, overflow);
 }
 
-template void
-MacroAssemblerMIPSShared::ma_addTestCarry<Label*>(Register rd, Register rs,
-                                                  Imm32 imm, Label* overflow);
-template void
-MacroAssemblerMIPSShared::ma_addTestCarry<wasm::OldTrapDesc>(Register rd, Register rs, Imm32 imm,
-                                                             wasm::OldTrapDesc overflow);
-
 // Subtract.
 void
 MacroAssemblerMIPSShared::ma_subu(Register rd, Register rs, Imm32 imm)
 {
     if (Imm16::IsInSignedRange(-imm.value)) {
         as_addiu(rd, rs, -imm.value);
     } else {
         ma_li(ScratchRegister, imm);
@@ -803,50 +787,22 @@ MacroAssemblerMIPSShared::ma_b(Register 
 }
 
 void
 MacroAssemblerMIPSShared::ma_b(Register lhs, ImmPtr imm, Label* l, Condition c, JumpKind jumpKind)
 {
     asMasm().ma_b(lhs, ImmWord(uintptr_t(imm.value)), l, c, jumpKind);
 }
 
-template <typename T>
-void
-MacroAssemblerMIPSShared::ma_b(Register lhs, T rhs, wasm::OldTrapDesc target, Condition c,
-                               JumpKind jumpKind)
-{
-    Label label;
-    ma_b(lhs, rhs, &label, c, jumpKind);
-    bindLater(&label, target);
-}
-
-template void MacroAssemblerMIPSShared::ma_b<Register>(Register lhs, Register rhs,
-                                                       wasm::OldTrapDesc target, Condition c,
-                                                       JumpKind jumpKind);
-template void MacroAssemblerMIPSShared::ma_b<Imm32>(Register lhs, Imm32 rhs,
-                                                       wasm::OldTrapDesc target, Condition c,
-                                                       JumpKind jumpKind);
-template void MacroAssemblerMIPSShared::ma_b<ImmTag>(Register lhs, ImmTag rhs,
-                                                       wasm::OldTrapDesc target, Condition c,
-                                                       JumpKind jumpKind);
-
 void
 MacroAssemblerMIPSShared::ma_b(Label* label, JumpKind jumpKind)
 {
     asMasm().branchWithCode(getBranchCode(BranchIsJump), label, jumpKind);
 }
 
-void
-MacroAssemblerMIPSShared::ma_b(wasm::OldTrapDesc target, JumpKind jumpKind)
-{
-    Label label;
-    asMasm().branchWithCode(getBranchCode(BranchIsJump), &label, jumpKind);
-    bindLater(&label, target);
-}
-
 Assembler::Condition
 MacroAssemblerMIPSShared::ma_cmp(Register scratch, Register lhs, Register rhs, Condition c)
 {
     switch (c) {
       case Above:
         // bgtu s,t,label =>
         //   sltu at,t,s
         //   bne at,$zero,offs
--- a/js/src/jit/mips-shared/MacroAssembler-mips-shared.h
+++ b/js/src/jit/mips-shared/MacroAssembler-mips-shared.h
@@ -125,20 +125,18 @@ class MacroAssemblerMIPSShared : public 
     void ma_store_unaligned(const wasm::MemoryAccessDesc& access, Register data, const BaseIndex& dest, Register temp,
                             LoadStoreSize size, LoadStoreExtension extension);
 
     // arithmetic based ops
     // add
     void ma_addu(Register rd, Register rs, Imm32 imm);
     void ma_addu(Register rd, Register rs);
     void ma_addu(Register rd, Imm32 imm);
-    template <typename L>
-    void ma_addTestCarry(Register rd, Register rs, Register rt, L overflow);
-    template <typename L>
-    void ma_addTestCarry(Register rd, Register rs, Imm32 imm, L overflow);
+    void ma_addTestCarry(Register rd, Register rs, Register rt, Label* overflow);
+    void ma_addTestCarry(Register rd, Register rs, Imm32 imm, Label* overflow);
 
     // subtract
     void ma_subu(Register rd, Register rs, Imm32 imm);
     void ma_subu(Register rd, Register rs);
     void ma_subu(Register rd, Imm32 imm);
     void ma_subTestOverflow(Register rd, Register rs, Imm32 imm, Label* overflow);
 
     // multiplies.  For now, there are only few that we care about.
@@ -159,22 +157,18 @@ class MacroAssemblerMIPSShared : public 
     void ma_b(Register lhs, Register rhs, Label* l, Condition c, JumpKind jumpKind = LongJump);
     void ma_b(Register lhs, Imm32 imm, Label* l, Condition c, JumpKind jumpKind = LongJump);
     void ma_b(Register lhs, ImmPtr imm, Label* l, Condition c, JumpKind jumpKind = LongJump);
     void ma_b(Register lhs, ImmGCPtr imm, Label* l, Condition c, JumpKind jumpKind = LongJump) {
         MOZ_ASSERT(lhs != ScratchRegister);
         ma_li(ScratchRegister, imm);
         ma_b(lhs, ScratchRegister, l, c, jumpKind);
     }
-    template <typename T>
-    void ma_b(Register lhs, T rhs, wasm::OldTrapDesc target, Condition c,
-              JumpKind jumpKind = LongJump);
 
     void ma_b(Label* l, JumpKind jumpKind = LongJump);
-    void ma_b(wasm::OldTrapDesc target, JumpKind jumpKind = LongJump);
 
     // fp instructions
     void ma_lis(FloatRegister dest, float value);
 
     void ma_sd(FloatRegister src, BaseIndex address);
     void ma_ss(FloatRegister src, BaseIndex address);
 
     void ma_ld(FloatRegister dest, const BaseIndex& src);
--- a/js/src/jit/mips32/MacroAssembler-mips32.cpp
+++ b/js/src/jit/mips32/MacroAssembler-mips32.cpp
@@ -204,43 +204,34 @@ void
 MacroAssemblerMIPS::ma_liPatchable(Register dest, ImmWord imm)
 {
     ma_liPatchable(dest, Imm32(int32_t(imm.value)));
 }
 
 // Arithmetic-based ops.
 
 // Add.
-template <typename L>
 void
-MacroAssemblerMIPS::ma_addTestOverflow(Register rd, Register rs, Register rt, L overflow)
+MacroAssemblerMIPS::ma_addTestOverflow(Register rd, Register rs, Register rt, Label* overflow)
 {
     Label goodAddition;
     as_addu(rd, rs, rt);
 
     as_xor(ScratchRegister, rs, rt); // If different sign, no overflow
     ma_b(ScratchRegister, Imm32(0), &goodAddition, Assembler::LessThan, ShortJump);
 
     // If different sign, then overflow
     as_xor(ScratchRegister, rs, rd);
     ma_b(ScratchRegister, Imm32(0), overflow, Assembler::LessThan);
 
     bind(&goodAddition);
 }
 
-template void
-MacroAssemblerMIPS::ma_addTestOverflow<Label*>(Register rd, Register rs,
-                                               Register rt, Label* overflow);
-template void
-MacroAssemblerMIPS::ma_addTestOverflow<wasm::OldTrapDesc>(Register rd, Register rs, Register rt,
-                                                          wasm::OldTrapDesc overflow);
-
-template <typename L>
 void
-MacroAssemblerMIPS::ma_addTestOverflow(Register rd, Register rs, Imm32 imm, L overflow)
+MacroAssemblerMIPS::ma_addTestOverflow(Register rd, Register rs, Imm32 imm, Label* overflow)
 {
     // Check for signed range because of as_addiu
     // Check for unsigned range because of as_xori
     if (Imm16::IsInSignedRange(imm.value) && Imm16::IsInUnsignedRange(imm.value)) {
         Label goodAddition;
         as_addiu(rd, rs, imm.value);
 
         // If different sign, no overflow
@@ -253,23 +244,16 @@ MacroAssemblerMIPS::ma_addTestOverflow(R
 
         bind(&goodAddition);
     } else {
         ma_li(ScratchRegister, imm);
         ma_addTestOverflow(rd, rs, ScratchRegister, overflow);
     }
 }
 
-template void
-MacroAssemblerMIPS::ma_addTestOverflow<Label*>(Register rd, Register rs,
-                                               Imm32 imm, Label* overflow);
-template void
-MacroAssemblerMIPS::ma_addTestOverflow<wasm::OldTrapDesc>(Register rd, Register rs, Imm32 imm,
-                                                          wasm::OldTrapDesc overflow);
-
 // Subtract.
 void
 MacroAssemblerMIPS::ma_subTestOverflow(Register rd, Register rs, Register rt, Label* overflow)
 {
     Label goodSubtraction;
     // Use second scratch. The instructions generated by ma_b don't use the
     // second scratch register.
     as_subu(rd, rs, rt);
--- a/js/src/jit/mips32/MacroAssembler-mips32.h
+++ b/js/src/jit/mips32/MacroAssembler-mips32.h
@@ -91,20 +91,18 @@ class MacroAssemblerMIPS : public MacroA
                  LoadStoreExtension extension = SignExtend);
 
     // store
     void ma_store(Register data, Address address, LoadStoreSize size = SizeWord,
                   LoadStoreExtension extension = SignExtend);
 
     // arithmetic based ops
     // add
-    template <typename L>
-    void ma_addTestOverflow(Register rd, Register rs, Register rt, L overflow);
-    template <typename L>
-    void ma_addTestOverflow(Register rd, Register rs, Imm32 imm, L overflow);
+    void ma_addTestOverflow(Register rd, Register rs, Register rt, Label* overflow);
+    void ma_addTestOverflow(Register rd, Register rs, Imm32 imm, Label* overflow);
 
     // subtract
     void ma_subTestOverflow(Register rd, Register rs, Register rt, Label* overflow);
 
     // memory
     // shortcut for when we know we're transferring 32 bits of data
     void ma_lw(Register data, Address address);
 
@@ -337,20 +335,16 @@ class MacroAssemblerMIPSCompat : public 
         as_jr(ScratchRegister);
         as_nop();
     }
 
     void jump(JitCode* code) {
         branch(code);
     }
 
-    void jump(wasm::OldTrapDesc target) {
-        ma_b(target);
-    }
-
     void jump(TrampolinePtr code)
     {
         auto target = ImmPtr(code.value);
         BufferOffset bo = m_buffer.nextOffset();
         addPendingJump(bo, target, Relocation::HARDCODED);
         ma_jump(target);
     }
 
--- a/js/src/jit/mips64/MacroAssembler-mips64.cpp
+++ b/js/src/jit/mips64/MacroAssembler-mips64.cpp
@@ -392,54 +392,38 @@ MacroAssemblerMIPS64::ma_daddu(Register 
 }
 
 void
 MacroAssemblerMIPS64::ma_daddu(Register rd, Imm32 imm)
 {
     ma_daddu(rd, rd, imm);
 }
 
-template <typename L>
 void
-MacroAssemblerMIPS64::ma_addTestOverflow(Register rd, Register rs, Register rt, L overflow)
+MacroAssemblerMIPS64::ma_addTestOverflow(Register rd, Register rs, Register rt, Label* overflow)
 {
     as_daddu(SecondScratchReg, rs, rt);
     as_addu(rd, rs, rt);
     ma_b(rd, SecondScratchReg, overflow, Assembler::NotEqual);
 }
 
-template void
-MacroAssemblerMIPS64::ma_addTestOverflow<Label*>(Register rd, Register rs,
-                                                 Register rt, Label* overflow);
-template void
-MacroAssemblerMIPS64::ma_addTestOverflow<wasm::OldTrapDesc>(Register rd, Register rs, Register rt,
-                                                            wasm::OldTrapDesc overflow);
-
-template <typename L>
 void
-MacroAssemblerMIPS64::ma_addTestOverflow(Register rd, Register rs, Imm32 imm, L overflow)
+MacroAssemblerMIPS64::ma_addTestOverflow(Register rd, Register rs, Imm32 imm, Label* overflow)
 {
     // Check for signed range because of as_daddiu
     if (Imm16::IsInSignedRange(imm.value)) {
         as_daddiu(SecondScratchReg, rs, imm.value);
         as_addiu(rd, rs, imm.value);
         ma_b(rd, SecondScratchReg, overflow, Assembler::NotEqual);
     } else {
         ma_li(ScratchRegister, imm);
         ma_addTestOverflow(rd, rs, ScratchRegister, overflow);
     }
 }
 
-template void
-MacroAssemblerMIPS64::ma_addTestOverflow<Label*>(Register rd, Register rs,
-                                                 Imm32 imm, Label* overflow);
-template void
-MacroAssemblerMIPS64::ma_addTestOverflow<wasm::OldTrapDesc>(Register rd, Register rs, Imm32 imm,
-                                                            wasm::OldTrapDesc overflow);
-
 // Subtract.
 void
 MacroAssemblerMIPS64::ma_dsubu(Register rd, Register rs, Imm32 imm)
 {
     if (Imm16::IsInSignedRange(-imm.value)) {
         as_daddiu(rd, rs, -imm.value);
     } else {
         ma_li(ScratchRegister, imm);
--- a/js/src/jit/mips64/MacroAssembler-mips64.h
+++ b/js/src/jit/mips64/MacroAssembler-mips64.h
@@ -115,20 +115,18 @@ class MacroAssemblerMIPS64 : public Macr
     void ma_store(Register data, Address address, LoadStoreSize size = SizeWord,
                   LoadStoreExtension extension = SignExtend);
 
     // arithmetic based ops
     // add
     void ma_daddu(Register rd, Register rs, Imm32 imm);
     void ma_daddu(Register rd, Register rs);
     void ma_daddu(Register rd, Imm32 imm);
-    template <typename L>
-    void ma_addTestOverflow(Register rd, Register rs, Register rt, L overflow);
-    template <typename L>
-    void ma_addTestOverflow(Register rd, Register rs, Imm32 imm, L overflow);
+    void ma_addTestOverflow(Register rd, Register rs, Register rt, Label* overflow);
+    void ma_addTestOverflow(Register rd, Register rs, Imm32 imm, Label* overflow);
 
     // subtract
     void ma_dsubu(Register rd, Register rs, Imm32 imm);
     void ma_dsubu(Register rd, Register rs);
     void ma_dsubu(Register rd, Imm32 imm);
     void ma_subTestOverflow(Register rd, Register rs, Register rt, Label* overflow);
 
     // multiplies.  For now, there are only few that we care about.
@@ -355,20 +353,16 @@ class MacroAssemblerMIPS64Compat : publi
         as_jr(ScratchRegister);
         as_nop();
     }
 
     void jump(JitCode* code) {
         branch(code);
     }
 
-    void jump(wasm::OldTrapDesc target) {
-        ma_b(target);
-    }
-
     void jump(TrampolinePtr code)
     {
         auto target = ImmPtr(code.value);
         BufferOffset bo = m_buffer.nextOffset();
         addPendingJump(bo, target, Relocation::HARDCODED);
         ma_jump(target);
     }
 
--- a/js/src/jit/none/MacroAssembler-none.h
+++ b/js/src/jit/none/MacroAssembler-none.h
@@ -214,17 +214,16 @@ class MacroAssemblerNone : public Assemb
     void copyJumpRelocationTable(uint8_t*) { MOZ_CRASH(); }
     void copyDataRelocationTable(uint8_t*) { MOZ_CRASH(); }
     void copyPreBarrierTable(uint8_t*) { MOZ_CRASH(); }
     void processCodeLabels(uint8_t*) { MOZ_CRASH(); }
 
     void flushBuffer() { MOZ_CRASH(); }
 
     template <typename T> void bind(T) { MOZ_CRASH(); }
-    void bindLater(Label*, wasm::OldTrapDesc) { MOZ_CRASH(); }
     template <typename T> void j(Condition, T) { MOZ_CRASH(); }
     template <typename T> void jump(T) { MOZ_CRASH(); }
     void writeCodePointer(CodeLabel* label) { MOZ_CRASH(); }
     void haltingAlign(size_t) { MOZ_CRASH(); }
     void nopAlign(size_t) { MOZ_CRASH(); }
     void checkStackAlignment() { MOZ_CRASH(); }
     uint32_t currentOffset() { MOZ_CRASH(); }
     CodeOffset labelForPatch() { MOZ_CRASH(); }
--- a/js/src/jit/shared/Assembler-shared.h
+++ b/js/src/jit/shared/Assembler-shared.h
@@ -861,77 +861,26 @@ struct CallFarJump
 
     void offsetBy(size_t delta) {
         jump.offsetBy(delta);
     }
 };
 
 typedef Vector<CallFarJump, 0, SystemAllocPolicy> CallFarJumpVector;
 
-// The OldTrapDesc struct describes a wasm trap that is about to be emitted. This
-// includes the logical wasm bytecode offset to report, the kind of instruction
-// causing the trap, and the stack depth right before control is transferred to
-// the trap out-of-line path.
-
-struct OldTrapDesc : BytecodeOffset
-{
-    Trap trap;
-    uint32_t framePushed;
-
-    OldTrapDesc(BytecodeOffset offset, Trap trap, uint32_t framePushed)
-      : BytecodeOffset(offset), trap(trap), framePushed(framePushed)
-    {}
-};
-
-// An OldTrapSite captures all relevant information at the point of emitting the
-// in-line trapping instruction for the purpose of generating the out-of-line
-// trap code (at the end of the function).
-
-struct OldTrapSite : OldTrapDesc
-{
-    uint32_t codeOffset;
-
-    OldTrapSite(OldTrapDesc trap, uint32_t codeOffset)
-      : OldTrapDesc(trap), codeOffset(codeOffset)
-    {}
-};
-
-typedef Vector<OldTrapSite, 0, SystemAllocPolicy> OldTrapSiteVector;
-
-// An OldTrapFarJump records the offset of a jump that needs to be patched to a trap
-// exit at the end of the module when trap exits are emitted.
-
-struct OldTrapFarJump
-{
-    Trap trap;
-    jit::CodeOffset jump;
-
-    OldTrapFarJump(Trap trap, jit::CodeOffset jump)
-      : trap(trap), jump(jump)
-    {}
-
-    void offsetBy(size_t delta) {
-        jump.offsetBy(delta);
-    }
-};
-
-typedef Vector<OldTrapFarJump, 0, SystemAllocPolicy> OldTrapFarJumpVector;
-
 } // namespace wasm
 
 namespace jit {
 
 // The base class of all Assemblers for all archs.
 class AssemblerShared
 {
     wasm::CallSiteVector callSites_;
     wasm::CallSiteTargetVector callSiteTargets_;
     wasm::TrapSiteVectorArray trapSites_;
-    wasm::OldTrapSiteVector oldTrapSites_;
-    wasm::OldTrapFarJumpVector oldTrapFarJumps_;
     wasm::CallFarJumpVector callFarJumps_;
     wasm::SymbolicAccessVector symbolicAccesses_;
 
   protected:
     CodeLabelVector codeLabels_;
 
     bool enoughMemory_;
     bool embedsNurseryPointers_;
@@ -981,37 +930,29 @@ class AssemblerShared
     template <typename... Args>
     void append(const wasm::CallSiteDesc& desc, CodeOffset retAddr, Args&&... args) {
         enoughMemory_ &= callSites_.emplaceBack(desc, retAddr.offset());
         enoughMemory_ &= callSiteTargets_.emplaceBack(mozilla::Forward<Args>(args)...);
     }
     void append(wasm::Trap trap, wasm::TrapSite site) {
         enoughMemory_ &= trapSites_[trap].append(site);
     }
-    void append(wasm::OldTrapSite trapSite) {
-        enoughMemory_ &= oldTrapSites_.append(trapSite);
-    }
-    void append(wasm::OldTrapFarJump jmp) {
-        enoughMemory_ &= oldTrapFarJumps_.append(jmp);
-    }
     void append(wasm::CallFarJump jmp) {
         enoughMemory_ &= callFarJumps_.append(jmp);
     }
     void append(const wasm::MemoryAccessDesc& access, uint32_t pcOffset) {
         append(wasm::Trap::OutOfBounds, wasm::TrapSite(pcOffset, access.trapOffset()));
     }
     void append(wasm::SymbolicAccess access) {
         enoughMemory_ &= symbolicAccesses_.append(access);
     }
 
     wasm::CallSiteVector& callSites() { return callSites_; }
     wasm::CallSiteTargetVector& callSiteTargets() { return callSiteTargets_; }
     wasm::TrapSiteVectorArray& trapSites() { return trapSites_; }
-    wasm::OldTrapSiteVector& oldTrapSites() { return oldTrapSites_; }
-    wasm::OldTrapFarJumpVector& oldTrapFarJumps() { return oldTrapFarJumps_; }
     wasm::CallFarJumpVector& callFarJumps() { return callFarJumps_; }
     wasm::SymbolicAccessVector& symbolicAccesses() { return symbolicAccesses_; }
 };
 
 } // namespace jit
 } // namespace js
 
 #endif /* jit_shared_Assembler_shared_h */
--- a/js/src/jit/shared/CodeGenerator-shared.h
+++ b/js/src/jit/shared/CodeGenerator-shared.h
@@ -494,21 +494,16 @@ class CodeGeneratorShared : public LElem
     // place of jumpToBlock.
     Label* labelForBackedgeWithImplicitCheck(MBasicBlock* mir);
 
 // This function is not used for MIPS. MIPS has branchToBlock.
 #if !defined(JS_CODEGEN_MIPS32) && !defined(JS_CODEGEN_MIPS64)
     void jumpToBlock(MBasicBlock* mir, Assembler::Condition cond);
 #endif
 
-    template <class T>
-    wasm::OldTrapDesc oldTrap(T* mir, wasm::Trap trap) {
-        return wasm::OldTrapDesc(mir->bytecodeOffset(), trap, masm.framePushed());
-    }
-
   private:
     void generateInvalidateEpilogue();
 
   public:
     CodeGeneratorShared(MIRGenerator* gen, LIRGraph* graph, MacroAssembler* masm);
 
   public:
     template <class ArgSeq, class StoreOutputTo>
--- a/js/src/jit/x86-shared/Assembler-x86-shared.h
+++ b/js/src/jit/x86-shared/Assembler-x86-shared.h
@@ -934,27 +934,16 @@ class AssemblerX86Shared : public Assemb
   public:
     void nop() { masm.nop(); }
     void nop(size_t n) { masm.insert_nop(n); }
     void j(Condition cond, Label* label) { jSrc(cond, label); }
     void jmp(Label* label) { jmpSrc(label); }
     void j(Condition cond, RepatchLabel* label) { jSrc(cond, label); }
     void jmp(RepatchLabel* label) { jmpSrc(label); }
 
-    void j(Condition cond, wasm::OldTrapDesc target) {
-        Label l;
-        j(cond, &l);
-        bindLater(&l, target);
-    }
-    void jmp(wasm::OldTrapDesc target) {
-        Label l;
-        jmp(&l);
-        bindLater(&l, target);
-    }
-
     void jmp(const Operand& op) {
         switch (op.kind()) {
           case Operand::MEM_REG_DISP:
             masm.jmp_m(op.disp(), op.base());
             break;
           case Operand::MEM_SCALE:
             masm.jmp_m(op.disp(), op.base(), op.index(), op.scale());
             break;
@@ -975,25 +964,16 @@ class AssemblerX86Shared : public Assemb
                 JmpSrc next;
                 more = masm.nextJump(jmp, &next);
                 masm.linkJump(jmp, dst);
                 jmp = next;
             } while (more);
         }
         label->bind(dst.offset());
     }
-    void bindLater(Label* label, wasm::OldTrapDesc target) {
-        if (label->used()) {
-            JmpSrc jmp(label->offset());
-            do {
-                append(wasm::OldTrapSite(target, jmp.offset()));
-            } while (masm.nextJump(jmp, &jmp));
-        }
-        label->reset();
-    }
     void bind(RepatchLabel* label) {
         JmpDst dst(masm.label());
         if (label->used()) {
             JmpSrc jmp(label->offset());
             masm.linkJump(jmp, dst);
         }
         label->bind(dst.offset());
     }
--- a/js/src/jit/x86-shared/MacroAssembler-x86-shared.h
+++ b/js/src/jit/x86-shared/MacroAssembler-x86-shared.h
@@ -197,19 +197,16 @@ class MacroAssemblerX86Shared : public A
         jmp(label);
     }
     void jump(Register reg) {
         jmp(Operand(reg));
     }
     void jump(const Address& addr) {
         jmp(Operand(addr));
     }
-    void jump(wasm::OldTrapDesc target) {
-        jmp(target);
-    }
 
     void convertInt32ToDouble(Register src, FloatRegister dest) {
         // vcvtsi2sd and friends write only part of their output register, which
         // causes slowdowns on out-of-order processors. Explicitly break
         // dependencies with vxorpd (and vxorps elsewhere), which are handled
         // specially in modern CPUs, for this purpose. See sections 8.14, 9.8,
         // 10.8, 12.9, 13.16, 14.14, and 15.8 of Agner's Microarchitecture
         // document.
--- a/js/src/wasm/WasmBuiltins.cpp
+++ b/js/src/wasm/WasmBuiltins.cpp
@@ -234,22 +234,22 @@ CheckInterrupt(JSContext* cx, JitActivat
 
 // The calling convention between this function and its caller in the stub
 // generated by GenerateTrapExit() is:
 //   - return nullptr if the stub should jump to the throw stub to unwind
 //     the activation;
 //   - return the (non-null) resumePC that should be jumped if execution should
 //     resume after the trap.
 static void*
-HandleTrap(Trap trap)
+WasmHandleTrap()
 {
     JitActivation* activation = CallingActivation();
     JSContext* cx = activation->cx();
 
-    switch (trap) {
+    switch (activation->wasmTrapData().trap) {
       case Trap::Unreachable:
         return ReportError(cx, JSMSG_WASM_UNREACHABLE);
       case Trap::IntegerOverflow:
         return ReportError(cx, JSMSG_WASM_INTEGER_OVERFLOW);
       case Trap::InvalidConversionToInteger:
         return ReportError(cx, JSMSG_WASM_INVALID_CONVERSION);
       case Trap::IntegerDivideByZero:
         return ReportError(cx, JSMSG_WASM_INT_DIVIDE_BY_ZERO);
@@ -282,30 +282,16 @@ HandleTrap(Trap trap)
       case Trap::Limit:
         break;
     }
 
     MOZ_CRASH("unexpected trap");
 }
 
 static void
-WasmOldReportTrap(int32_t trapIndex)
-{
-    MOZ_ASSERT(trapIndex < int32_t(Trap::Limit) && trapIndex >= 0);
-    DebugOnly<void*> resumePC = HandleTrap(Trap(trapIndex));
-    MOZ_ASSERT(!resumePC);
-}
-
-static void*
-WasmHandleTrap()
-{
-    return HandleTrap(CallingActivation()->wasmTrapData().trap);
-}
-
-static void
 WasmReportOutOfBounds()
 {
     JSContext* cx = TlsContext.get();
     JS_ReportErrorNumberUTF8(cx, GetErrorMessage, nullptr, JSMSG_WASM_OUT_OF_BOUNDS);
 }
 
 static void
 WasmReportUnalignedAccess()
@@ -524,19 +510,16 @@ wasm::AddressOf(SymbolicAddress imm, ABI
         *abiType = Args_General0;
         return FuncCast(WasmHandleDebugTrap, *abiType);
       case SymbolicAddress::HandleThrow:
         *abiType = Args_General0;
         return FuncCast(WasmHandleThrow, *abiType);
       case SymbolicAddress::HandleTrap:
         *abiType = Args_General0;
         return FuncCast(WasmHandleTrap, *abiType);
-      case SymbolicAddress::OldReportTrap:
-        *abiType = Args_General1;
-        return FuncCast(WasmOldReportTrap, *abiType);
       case SymbolicAddress::ReportOutOfBounds:
         *abiType = Args_General0;
         return FuncCast(WasmReportOutOfBounds, *abiType);
       case SymbolicAddress::ReportUnalignedAccess:
         *abiType = Args_General0;
         return FuncCast(WasmReportUnalignedAccess, *abiType);
       case SymbolicAddress::ReportInt64JSCall:
         *abiType = Args_General0;
@@ -696,17 +679,16 @@ bool
 wasm::NeedsBuiltinThunk(SymbolicAddress sym)
 {
     // Some functions don't want to a thunk, because they already have one or
     // they don't have frame info.
     switch (sym) {
       case SymbolicAddress::HandleDebugTrap:          // GenerateDebugTrapStub
       case SymbolicAddress::HandleThrow:              // GenerateThrowStub
       case SymbolicAddress::HandleTrap:               // GenerateTrapExit
-      case SymbolicAddress::OldReportTrap:            // GenerateOldTrapExit
       case SymbolicAddress::ReportOutOfBounds:        // GenerateOutOfBoundsExit
       case SymbolicAddress::ReportUnalignedAccess:    // GenerateUnalignedExit
       case SymbolicAddress::CallImport_Void:          // GenerateImportInterpExit
       case SymbolicAddress::CallImport_I32:
       case SymbolicAddress::CallImport_I64:
       case SymbolicAddress::CallImport_F64:
       case SymbolicAddress::CoerceInPlace_ToInt32:    // GenerateImportJitExit
       case SymbolicAddress::CoerceInPlace_ToNumber:
@@ -1000,18 +982,16 @@ wasm::EnsureBuiltinThunksInitialized()
     memset(thunks->codeBase + masm.bytesNeeded(), 0, allocSize - masm.bytesNeeded());
 
     masm.processCodeLabels(thunks->codeBase);
 
     MOZ_ASSERT(masm.callSites().empty());
     MOZ_ASSERT(masm.callSiteTargets().empty());
     MOZ_ASSERT(masm.callFarJumps().empty());
     MOZ_ASSERT(masm.trapSites().empty());
-    MOZ_ASSERT(masm.oldTrapSites().empty());
-    MOZ_ASSERT(masm.oldTrapFarJumps().empty());
     MOZ_ASSERT(masm.callFarJumps().empty());
     MOZ_ASSERT(masm.symbolicAccesses().empty());
 
     ExecutableAllocator::cacheFlush(thunks->codeBase, thunks->codeSize);
     if (!ExecutableAllocator::makeExecutable(thunks->codeBase, thunks->codeSize))
         return false;
 
     builtinThunks = thunks.release();
--- a/js/src/wasm/WasmCode.cpp
+++ b/js/src/wasm/WasmCode.cpp
@@ -691,18 +691,16 @@ LazyStubTier::createMany(const Uint32Vec
 
     masm.finish();
 
     MOZ_ASSERT(!masm.numCodeLabels());
     MOZ_ASSERT(masm.callSites().empty());
     MOZ_ASSERT(masm.callSiteTargets().empty());
     MOZ_ASSERT(masm.callFarJumps().empty());
     MOZ_ASSERT(masm.trapSites().empty());
-    MOZ_ASSERT(masm.oldTrapSites().empty());
-    MOZ_ASSERT(masm.oldTrapFarJumps().empty());
     MOZ_ASSERT(masm.callFarJumps().empty());
     MOZ_ASSERT(masm.symbolicAccesses().empty());
 
     if (masm.oom())
         return false;
 
     size_t codeLength = LazyStubSegment::AlignBytesNeeded(masm.bytesNeeded());
 
--- a/js/src/wasm/WasmFrameIter.cpp
+++ b/js/src/wasm/WasmFrameIter.cpp
@@ -759,17 +759,16 @@ ProfilingFrameIterator::initFromExitFP(c
         callerPC_ = fp->returnAddress;
         callerFP_ = fp->callerFP;
         AssertMatchesCallSite(callerPC_, callerFP_);
         break;
       case CodeRange::ImportJitExit:
       case CodeRange::ImportInterpExit:
       case CodeRange::BuiltinThunk:
       case CodeRange::TrapExit:
-      case CodeRange::OldTrapExit:
       case CodeRange::DebugTrap:
       case CodeRange::OutOfBoundsExit:
       case CodeRange::UnalignedExit:
       case CodeRange::Throw:
       case CodeRange::FarJumpIsland:
         MOZ_CRASH("Unexpected CodeRange kind");
     }
 
@@ -837,17 +836,16 @@ js::wasm::StartUnwinding(const RegisterS
     Frame* fixedFP = nullptr;
     void* fixedPC = nullptr;
     switch (codeRange->kind()) {
       case CodeRange::Function:
       case CodeRange::FarJumpIsland:
       case CodeRange::ImportJitExit:
       case CodeRange::ImportInterpExit:
       case CodeRange::BuiltinThunk:
-      case CodeRange::OldTrapExit:
       case CodeRange::DebugTrap:
 #if defined(JS_CODEGEN_MIPS32) || defined(JS_CODEGEN_MIPS64)
         if (offsetFromEntry < PushedFP || codeRange->isThunk()) {
             // On MIPS we rely on register state instead of state saved on
             // stack until the wasm::Frame is completely built.
             // On entry the return address is in ra (registers.lr) and
             // fp holds the caller's fp.
             fixedPC = (uint8_t*) registers.lr;
@@ -1095,17 +1093,16 @@ ProfilingFrameIterator::operator++()
     MOZ_ASSERT(code_ == &callerFP_->tls->instance->code());
 
     switch (codeRange_->kind()) {
       case CodeRange::Function:
       case CodeRange::ImportJitExit:
       case CodeRange::ImportInterpExit:
       case CodeRange::BuiltinThunk:
       case CodeRange::TrapExit:
-      case CodeRange::OldTrapExit:
       case CodeRange::DebugTrap:
       case CodeRange::OutOfBoundsExit:
       case CodeRange::UnalignedExit:
       case CodeRange::FarJumpIsland:
         stackAddress_ = callerFP_;
         callerPC_ = callerFP_->returnAddress;
         AssertMatchesCallSite(callerPC_, callerFP_->callerFP);
         callerFP_ = callerFP_->callerFP;
@@ -1124,17 +1121,16 @@ ProfilingFrameIterator::operator++()
 static const char*
 ThunkedNativeToDescription(SymbolicAddress func)
 {
     MOZ_ASSERT(NeedsBuiltinThunk(func));
     switch (func) {
       case SymbolicAddress::HandleDebugTrap:
       case SymbolicAddress::HandleThrow:
       case SymbolicAddress::HandleTrap:
-      case SymbolicAddress::OldReportTrap:
       case SymbolicAddress::ReportOutOfBounds:
       case SymbolicAddress::ReportUnalignedAccess:
       case SymbolicAddress::CallImport_Void:
       case SymbolicAddress::CallImport_I32:
       case SymbolicAddress::CallImport_I64:
       case SymbolicAddress::CallImport_F64:
       case SymbolicAddress::CoerceInPlace_ToInt32:
       case SymbolicAddress::CoerceInPlace_ToNumber:
@@ -1271,17 +1267,16 @@ ProfilingFrameIterator::label() const
     switch (codeRange_->kind()) {
       case CodeRange::Function:          return code_->profilingLabel(codeRange_->funcIndex());
       case CodeRange::InterpEntry:       MOZ_CRASH("should be an ExitReason");
       case CodeRange::JitEntry:          return "fast entry trampoline (in wasm)";
       case CodeRange::ImportJitExit:     return importJitDescription;
       case CodeRange::BuiltinThunk:      return builtinNativeDescription;
       case CodeRange::ImportInterpExit:  return importInterpDescription;
       case CodeRange::TrapExit:          return trapDescription;
-      case CodeRange::OldTrapExit:       return trapDescription;
       case CodeRange::DebugTrap:         return debugTrapDescription;
       case CodeRange::OutOfBoundsExit:   return "out-of-bounds stub (in wasm)";
       case CodeRange::UnalignedExit:     return "unaligned trap stub (in wasm)";
       case CodeRange::FarJumpIsland:     return "interstitial (in wasm)";
       case CodeRange::Throw:             MOZ_CRASH("does not have a frame");
     }
 
     MOZ_CRASH("bad code range kind");
--- a/js/src/wasm/WasmGenerator.cpp
+++ b/js/src/wasm/WasmGenerator.cpp
@@ -45,19 +45,17 @@ CompiledCode::swap(MacroAssembler& masm)
 {
     MOZ_ASSERT(bytes.empty());
     if (!masm.swapBuffer(bytes))
         return false;
 
     callSites.swap(masm.callSites());
     callSiteTargets.swap(masm.callSiteTargets());
     trapSites.swap(masm.trapSites());
-    oldTrapSites.swap(masm.oldTrapSites());
     callFarJumps.swap(masm.callFarJumps());
-    oldTrapFarJumps.swap(masm.oldTrapFarJumps());
     symbolicAccesses.swap(masm.symbolicAccesses());
     codeLabels.swap(masm.codeLabels());
     return true;
 }
 
 // ****************************************************************************
 // ModuleGenerator
 
@@ -72,28 +70,26 @@ ModuleGenerator::ModuleGenerator(const C
     cancelled_(cancelled),
     env_(env),
     linkDataTier_(nullptr),
     metadataTier_(nullptr),
     taskState_(mutexid::WasmCompileTaskState),
     lifo_(GENERATOR_LIFO_DEFAULT_CHUNK_SIZE),
     masmAlloc_(&lifo_),
     masm_(masmAlloc_),
-    oldTrapCodeOffsets_(),
     debugTrapCodeOffset_(),
     lastPatchedCallSite_(0),
     startOfUnpatchedCallsites_(0),
     parallel_(false),
     outstanding_(0),
     currentTask_(nullptr),
     batchedBytecode_(0),
     finishedFuncDefs_(false)
 {
     MOZ_ASSERT(IsCompilingWasm());
-    std::fill(oldTrapCodeOffsets_.begin(), oldTrapCodeOffsets_.end(), 0);
 }
 
 ModuleGenerator::~ModuleGenerator()
 {
     MOZ_ASSERT_IF(finishedFuncDefs_, !batchedBytecode_);
     MOZ_ASSERT_IF(finishedFuncDefs_, !currentTask_);
 
     if (parallel_) {
@@ -457,36 +453,16 @@ ModuleGenerator::linkCallSites()
                     return false;
                 if (!existingCallFarJumps.add(p, target.funcIndex(), offsets.begin))
                     return false;
             }
 
             masm_.patchCall(callerOffset, p->value());
             break;
           }
-          case CallSiteDesc::OldTrapExit: {
-            if (!existingTrapFarJumps[target.trap()]) {
-                // See MacroAssembler::wasmEmitOldTrapOutOfLineCode for why we must
-                // reload the TLS register on this path.
-                Offsets offsets;
-                offsets.begin = masm_.currentOffset();
-                masm_.loadPtr(Address(FramePointer, offsetof(Frame, tls)), WasmTlsReg);
-                if (!oldTrapFarJumps_.emplaceBack(target.trap(), masm_.farJumpWithPatch()))
-                    return false;
-                offsets.end = masm_.currentOffset();
-                if (masm_.oom())
-                    return false;
-                if (!metadataTier_->codeRanges.emplaceBack(CodeRange::FarJumpIsland, offsets))
-                    return false;
-                existingTrapFarJumps[target.trap()] = Some(offsets.begin);
-            }
-
-            masm_.patchCall(callerOffset, *existingTrapFarJumps[target.trap()]);
-            break;
-          }
           case CallSiteDesc::Breakpoint:
           case CallSiteDesc::EnterFrame:
           case CallSiteDesc::LeaveFrame: {
             Uint32Vector& jumps = metadataTier_->debugTrapFarJumpOffsets;
             if (jumps.empty() || !InRange(jumps.back(), callerOffset)) {
                 // See BaseCompiler::insertBreakablePoint for why we must
                 // reload the TLS register on this path.
                 Offsets offsets;
@@ -528,20 +504,16 @@ ModuleGenerator::noteCodeRange(uint32_t 
         // Nothing to do: jit entries are linked in the jump tables.
         break;
       case CodeRange::ImportJitExit:
         metadataTier_->funcImports[codeRange.funcIndex()].initJitExitOffset(codeRange.begin());
         break;
       case CodeRange::ImportInterpExit:
         metadataTier_->funcImports[codeRange.funcIndex()].initInterpExitOffset(codeRange.begin());
         break;
-      case CodeRange::OldTrapExit:
-        MOZ_ASSERT(!oldTrapCodeOffsets_[codeRange.trap()]);
-        oldTrapCodeOffsets_[codeRange.trap()] = codeRange.begin();
-        break;
       case CodeRange::DebugTrap:
         MOZ_ASSERT(!debugTrapCodeOffset_);
         debugTrapCodeOffset_ = codeRange.begin();
         break;
       case CodeRange::OutOfBoundsExit:
         MOZ_ASSERT(!linkDataTier_->outOfBoundsOffset);
         linkDataTier_->outOfBoundsOffset = codeRange.begin();
         break;
@@ -611,22 +583,16 @@ ModuleGenerator::linkCompiledCode(const 
         return false;
 
     for (Trap trap : MakeEnumeratedRange(Trap::Limit)) {
         auto trapSiteOp = [=](uint32_t, TrapSite* ts) { ts->offsetBy(offsetInModule); };
         if (!AppendForEach(&metadataTier_->trapSites[trap], code.trapSites[trap], trapSiteOp))
             return false;
     }
 
-    MOZ_ASSERT(code.oldTrapSites.empty());
-
-    auto trapFarJumpOp = [=](uint32_t, OldTrapFarJump* tfj) { tfj->offsetBy(offsetInModule); };
-    if (!AppendForEach(&oldTrapFarJumps_, code.oldTrapFarJumps, trapFarJumpOp))
-        return false;
-
     auto callFarJumpOp = [=](uint32_t, CallFarJump* cfj) { cfj->offsetBy(offsetInModule); };
     if (!AppendForEach(&callFarJumps_, code.callFarJumps, callFarJumpOp))
         return false;
 
     for (const SymbolicAccess& access : code.symbolicAccesses) {
         uint32_t patchAt = offsetInModule + access.patchAt.offset();
         if (!linkDataTier_->symbolicLinks[access.target].append(patchAt))
             return false;
@@ -818,29 +784,24 @@ ModuleGenerator::finishCode()
     // can emit tiny far-jump stubs, so there is an ordering dependency here.
 
     if (!linkCallSites())
         return false;
 
     for (CallFarJump far : callFarJumps_)
         masm_.patchFarJump(far.jump, funcCodeRange(far.funcIndex).funcNormalEntry());
 
-    for (OldTrapFarJump far : oldTrapFarJumps_)
-        masm_.patchFarJump(far.jump, oldTrapCodeOffsets_[far.trap]);
-
     for (CodeOffset farJump : debugTrapFarJumps_)
         masm_.patchFarJump(farJump, debugTrapCodeOffset_);
 
     // None of the linking or far-jump operations should emit masm metadata.
 
     MOZ_ASSERT(masm_.callSites().empty());
     MOZ_ASSERT(masm_.callSiteTargets().empty());
     MOZ_ASSERT(masm_.trapSites().empty());
-    MOZ_ASSERT(masm_.oldTrapSites().empty());
-    MOZ_ASSERT(masm_.oldTrapFarJumps().empty());
     MOZ_ASSERT(masm_.callFarJumps().empty());
     MOZ_ASSERT(masm_.symbolicAccesses().empty());
     MOZ_ASSERT(masm_.codeLabels().empty());
 
     masm_.finish();
     return !masm_.oom();
 }
 
--- a/js/src/wasm/WasmGenerator.h
+++ b/js/src/wasm/WasmGenerator.h
@@ -60,46 +60,40 @@ typedef Vector<FuncCompileInput, 8, Syst
 
 struct CompiledCode
 {
     Bytes                bytes;
     CodeRangeVector      codeRanges;
     CallSiteVector       callSites;
     CallSiteTargetVector callSiteTargets;
     TrapSiteVectorArray  trapSites;
-    OldTrapSiteVector    oldTrapSites;
-    OldTrapFarJumpVector oldTrapFarJumps;
     CallFarJumpVector    callFarJumps;
     SymbolicAccessVector symbolicAccesses;
     jit::CodeLabelVector codeLabels;
 
     MOZ_MUST_USE bool swap(jit::MacroAssembler& masm);
 
     void clear() {
         bytes.clear();
         codeRanges.clear();
         callSites.clear();
         callSiteTargets.clear();
         trapSites.clear();
-        oldTrapSites.clear();
-        oldTrapFarJumps.clear();
         callFarJumps.clear();
         symbolicAccesses.clear();
         codeLabels.clear();
         MOZ_ASSERT(empty());
     }
 
     bool empty() {
         return bytes.empty() &&
                codeRanges.empty() &&
                callSites.empty() &&
                callSiteTargets.empty() &&
                trapSites.empty() &&
-               oldTrapSites.empty() &&
-               oldTrapFarJumps.empty() &&
                callFarJumps.empty() &&
                symbolicAccesses.empty() &&
                codeLabels.empty();
     }
 };
 
 // The CompileTaskState of a ModuleGenerator contains the mutable state shared
 // between helper threads executing CompileTasks. Each CompileTask started on a
@@ -140,17 +134,16 @@ struct CompileTask
 // lifetime of a ModuleGenerator, a sequence of FunctionGenerators are created
 // and destroyed to compile the individual function bodies. After generating all
 // functions, ModuleGenerator::finish() must be called to complete the
 // compilation and extract the resulting wasm module.
 
 class MOZ_STACK_CLASS ModuleGenerator
 {
     typedef Vector<CompileTask, 0, SystemAllocPolicy> CompileTaskVector;
-    typedef EnumeratedArray<Trap, Trap::Limit, uint32_t> OldTrapOffsetArray;
     typedef Vector<jit::CodeOffset, 0, SystemAllocPolicy> CodeOffsetVector;
 
     // Constant parameters
     SharedCompileArgs const         compileArgs_;
     UniqueChars* const              error_;
     const Atomic<bool>* const       cancelled_;
     ModuleEnvironment* const        env_;
 
@@ -162,19 +155,17 @@ class MOZ_STACK_CLASS ModuleGenerator
 
     // Data scoped to the ModuleGenerator's lifetime
     ExclusiveCompileTaskState       taskState_;
     LifoAlloc                       lifo_;
     jit::JitContext                 jcx_;
     jit::TempAllocator              masmAlloc_;
     jit::WasmMacroAssembler         masm_;
     Uint32Vector                    funcToCodeRange_;
-    OldTrapOffsetArray              oldTrapCodeOffsets_;
     uint32_t                        debugTrapCodeOffset_;
-    OldTrapFarJumpVector            oldTrapFarJumps_;
     CallFarJumpVector               callFarJumps_;
     CallSiteTargetVector            callSiteTargets_;
     uint32_t                        lastPatchedCallSite_;
     uint32_t                        startOfUnpatchedCallsites_;
     CodeOffsetVector                debugTrapFarJumps_;
 
     // Parallel compilation
     bool                            parallel_;
--- a/js/src/wasm/WasmTypes.cpp
+++ b/js/src/wasm/WasmTypes.cpp
@@ -817,17 +817,16 @@ CodeRange::CodeRange(Kind kind, Callable
     end_(offsets.end),
     kind_(kind)
 {
     MOZ_ASSERT(begin_ < ret_);
     MOZ_ASSERT(ret_ < end_);
     PodZero(&u);
 #ifdef DEBUG
     switch (kind_) {
-      case OldTrapExit:
       case DebugTrap:
       case BuiltinThunk:
         break;
       default:
         MOZ_CRASH("should use more specific constructor");
     }
 #endif
 }
@@ -858,27 +857,16 @@ CodeRange::CodeRange(uint32_t funcIndex,
     MOZ_ASSERT(ret_ < end_);
     u.funcIndex_ = funcIndex;
     u.jitExit.beginToUntrustedFPStart_ = offsets.untrustedFPStart - begin_;
     u.jitExit.beginToUntrustedFPEnd_ = offsets.untrustedFPEnd - begin_;
     MOZ_ASSERT(jitExitUntrustedFPStart() == offsets.untrustedFPStart);
     MOZ_ASSERT(jitExitUntrustedFPEnd() == offsets.untrustedFPEnd);
 }
 
-CodeRange::CodeRange(Trap trap, CallableOffsets offsets)
-  : begin_(offsets.begin),
-    ret_(offsets.ret),
-    end_(offsets.end),
-    kind_(OldTrapExit)
-{
-    MOZ_ASSERT(begin_ < ret_);
-    MOZ_ASSERT(ret_ < end_);
-    u.trap_ = trap;
-}
-
 CodeRange::CodeRange(uint32_t funcIndex, uint32_t funcLineOrBytecode, FuncOffsets offsets)
   : begin_(offsets.begin),
     ret_(offsets.ret),
     end_(offsets.end),
     kind_(Function)
 {
     MOZ_ASSERT(begin_ < ret_);
     MOZ_ASSERT(ret_ < end_);
--- a/js/src/wasm/WasmTypes.h
+++ b/js/src/wasm/WasmTypes.h
@@ -1107,17 +1107,16 @@ class CodeRange
     enum Kind {
         Function,          // function definition
         InterpEntry,       // calls into wasm from C++
         JitEntry,          // calls into wasm from jit code
         ImportInterpExit,  // slow-path calling from wasm into C++ interp
         ImportJitExit,     // fast-path calling from wasm into jit code
         BuiltinThunk,      // fast-path calling from wasm into a C++ native
         TrapExit,          // calls C++ to report and jumps to throw stub
-        OldTrapExit,       // calls C++ to report and jumps to throw stub
         DebugTrap,         // calls C++ to handle debug event
         FarJumpIsland,     // inserted to connect otherwise out-of-range insns
         OutOfBoundsExit,   // stub jumped to by non-standard asm.js SIMD/Atomics
         UnalignedExit,     // stub jumped to by wasm Atomics and non-standard
                            // ARM unaligned trap
         Throw              // special stack-unwinding stub jumped to by other stubs
     };
 
@@ -1147,17 +1146,16 @@ class CodeRange
 
   public:
     CodeRange() = default;
     CodeRange(Kind kind, Offsets offsets);
     CodeRange(Kind kind, uint32_t funcIndex, Offsets offsets);
     CodeRange(Kind kind, CallableOffsets offsets);
     CodeRange(Kind kind, uint32_t funcIndex, CallableOffsets);
     CodeRange(uint32_t funcIndex, JitExitOffsets offsets);
-    CodeRange(Trap trap, CallableOffsets offsets);
     CodeRange(uint32_t funcIndex, uint32_t lineOrBytecode, FuncOffsets offsets);
 
     void offsetBy(uint32_t offset) {
         begin_ += offset;
         end_ += offset;
         if (hasReturn())
             ret_ += offset;
     }
@@ -1185,31 +1183,31 @@ class CodeRange
     }
     bool isImportInterpExit() const {
         return kind() == ImportInterpExit;
     }
     bool isImportJitExit() const {
         return kind() == ImportJitExit;
     }
     bool isTrapExit() const {
-        return kind() == OldTrapExit || kind() == TrapExit;
+        return kind() == TrapExit;
     }
     bool isDebugTrap() const {
         return kind() == DebugTrap;
     }
     bool isThunk() const {
         return kind() == FarJumpIsland;
     }
 
     // Function, import exits and trap exits have standard callable prologues
     // and epilogues. Asynchronous frame iteration needs to know the offset of
     // the return instruction to calculate the frame pointer.
 
     bool hasReturn() const {
-        return isFunction() || isImportExit() || kind() == OldTrapExit || isDebugTrap();
+        return isFunction() || isImportExit() || isDebugTrap();
     }
     uint32_t ret() const {
         MOZ_ASSERT(hasReturn());
         return ret_;
     }
 
     // Functions, export stubs and import stubs all have an associated function
     // index.
@@ -1301,17 +1299,16 @@ class CallSiteDesc
 {
     uint32_t lineOrBytecode_ : 29;
     uint32_t kind_ : 3;
   public:
     enum Kind {
         Func,       // pc-relative call to a specific function
         Dynamic,    // dynamic callee called via register
         Symbolic,   // call to a single symbolic callee
-        OldTrapExit,// call to a trap exit (being removed)
         EnterFrame, // call to a enter frame handler
         LeaveFrame, // call to a leave frame handler
         Breakpoint  // call to instruction breakpoint
     };
     CallSiteDesc() {}
     explicit CallSiteDesc(Kind kind)
       : lineOrBytecode_(0), kind_(kind)
     {
@@ -1424,17 +1421,16 @@ enum class SymbolicAddress
     NearbyIntF,
     ExpD,
     LogD,
     PowD,
     ATan2D,
     HandleDebugTrap,
     HandleThrow,
     HandleTrap,
-    OldReportTrap,
     ReportOutOfBounds,
     ReportUnalignedAccess,
     ReportInt64JSCall,
     CallImport_Void,
     CallImport_I32,
     CallImport_I64,
     CallImport_F64,
     CoerceInPlace_ToInt32,