From fc7d4e3d39da5ac6033ce72b89614f8f182bfdaa Mon Sep 17 00:00:00 2001 From: Luke Wagner Date: Wed, 20 Jul 2016 12:56:53 -0500 Subject: [PATCH] Bug 1288222 - Baldr: factor out common global access code (r=bbouvier) MozReview-Commit-ID: 5NOGyihk8s --HG-- extra : rebase_source : 622fa7961d494a252ef2a7c5c04959904965ce96 --- js/src/asmjs/WasmBaselineCompile.cpp | 31 ++----------------- js/src/jit/CodeGenerator.cpp | 23 ++++++++++++++ js/src/jit/CodeGenerator.h | 2 ++ js/src/jit/MacroAssembler.h | 3 ++ js/src/jit/arm/CodeGenerator-arm.cpp | 26 ---------------- js/src/jit/arm/CodeGenerator-arm.h | 2 -- js/src/jit/arm/MacroAssembler-arm.h | 7 +++-- js/src/jit/arm64/CodeGenerator-arm64.cpp | 12 ------- js/src/jit/arm64/CodeGenerator-arm64.h | 2 -- js/src/jit/arm64/MacroAssembler-arm64.h | 8 ++--- .../mips-shared/CodeGenerator-mips-shared.cpp | 26 ---------------- .../mips-shared/CodeGenerator-mips-shared.h | 2 -- js/src/jit/mips32/MacroAssembler-mips32.h | 6 ++-- js/src/jit/mips64/MacroAssembler-mips64.h | 6 ++-- js/src/jit/none/MacroAssembler-none.h | 1 + js/src/jit/x64/Assembler-x64.h | 7 ++--- js/src/jit/x64/CodeGenerator-x64.cpp | 28 ----------------- js/src/jit/x64/CodeGenerator-x64.h | 2 -- js/src/jit/x86/Assembler-x86.h | 4 +-- js/src/jit/x86/CodeGenerator-x86.cpp | 29 ----------------- js/src/jit/x86/CodeGenerator-x86.h | 2 -- 21 files changed, 51 insertions(+), 178 deletions(-) diff --git a/js/src/asmjs/WasmBaselineCompile.cpp b/js/src/asmjs/WasmBaselineCompile.cpp index 16fd52f886e7..6c87e698ad8e 100644 --- a/js/src/asmjs/WasmBaselineCompile.cpp +++ b/js/src/asmjs/WasmBaselineCompile.cpp @@ -2057,25 +2057,11 @@ class BaseCompiler masm.move32(Imm32(sigIndex), WasmTableCallSigReg); } -#if defined(JS_CODEGEN_X64) - // CodeGeneratorX64::visitAsmJSLoadFuncPtr() { ScratchI32 scratch(*this); - CodeOffset label = masm.loadRipRelativeInt64(scratch); - masm.append(GlobalAccess(label, globalDataOffset)); - masm.loadPtr(Operand(scratch, ptrReg, ScalePointer, 0), ptrReg); + masm.loadWasmGlobalPtr(globalDataOffset, scratch); + masm.loadPtr(BaseIndex(scratch, ptrReg, ScalePointer, 0), ptrReg); } -#elif defined(JS_CODEGEN_X86) - // CodeGeneratorX86::visitAsmJSLoadFuncPtr() - { - ScratchI32 scratch(*this); - CodeOffset label = masm.movlWithPatch(PatchedAbsoluteAddress(), scratch); - masm.append(GlobalAccess(label, globalDataOffset)); - masm.loadPtr(Operand(scratch, ptrReg, ScalePointer), ptrReg); - } -#else - MOZ_CRASH("BaseCompiler platform hook: funcPtrCall"); -#endif callDynamic(ptrReg, call); } @@ -2085,18 +2071,7 @@ class BaseCompiler void ffiCall(unsigned globalDataOffset, const FunctionCall& call) { Register ptrReg = WasmTableCallPtrReg; - -#if defined(JS_CODEGEN_X64) - // CodeGeneratorX64::visitAsmJSLoadFFIFunc() - CodeOffset label = masm.loadRipRelativeInt64(ptrReg); - masm.append(GlobalAccess(label, globalDataOffset)); -#elif defined(JS_CODEGEN_X86) - // CodeGeneratorX86::visitAsmJSLoadFFIFunc() - CodeOffset label = masm.movlWithPatch(PatchedAbsoluteAddress(), ptrReg); - masm.append(GlobalAccess(label, globalDataOffset)); -#else - MOZ_CRASH("BaseCompiler platform hook: ffiCall"); -#endif + masm.loadWasmGlobalPtr(globalDataOffset, ptrReg); callDynamic(ptrReg, call); } diff --git a/js/src/jit/CodeGenerator.cpp b/js/src/jit/CodeGenerator.cpp index 39a9940ce9d9..7cb3afdac862 100644 --- a/js/src/jit/CodeGenerator.cpp +++ b/js/src/jit/CodeGenerator.cpp @@ -11228,6 +11228,29 @@ CodeGenerator::visitAsmJSVoidReturn(LAsmJSVoidReturn* lir) masm.jump(&returnLabel_); } +void +CodeGenerator::visitAsmJSLoadFuncPtr(LAsmJSLoadFuncPtr* ins) +{ + const MAsmJSLoadFuncPtr* mir = ins->mir(); + + Register index = ToRegister(ins->index()); + Register out = ToRegister(ins->output()); + + if (mir->hasLimit()) { + masm.branch32(Assembler::Condition::AboveOrEqual, index, Imm32(mir->limit()), + wasm::JumpTarget::OutOfBounds); + } + + masm.loadWasmGlobalPtr(mir->globalDataOffset(), out); + masm.loadPtr(BaseIndex(out, index, ScalePointer), out); +} + +void +CodeGenerator::visitAsmJSLoadFFIFunc(LAsmJSLoadFFIFunc* ins) +{ + masm.loadWasmGlobalPtr(ins->mir()->globalDataOffset(), ToRegister(ins->output())); +} + void CodeGenerator::emitAssertRangeI(const Range* r, Register input) { diff --git a/js/src/jit/CodeGenerator.h b/js/src/jit/CodeGenerator.h index 61fce95cf2da..f76832986449 100644 --- a/js/src/jit/CodeGenerator.h +++ b/js/src/jit/CodeGenerator.h @@ -363,6 +363,8 @@ class CodeGenerator final : public CodeGeneratorSpecific void visitAsmJSParameter(LAsmJSParameter* lir); void visitAsmJSReturn(LAsmJSReturn* ret); void visitAsmJSVoidReturn(LAsmJSVoidReturn* ret); + void visitAsmJSLoadFuncPtr(LAsmJSLoadFuncPtr* ins); + void visitAsmJSLoadFFIFunc(LAsmJSLoadFFIFunc* ins); void visitLexicalCheck(LLexicalCheck* ins); void visitThrowRuntimeLexicalError(LThrowRuntimeLexicalError* ins); void visitGlobalNameConflictsCheck(LGlobalNameConflictsCheck* ins); diff --git a/js/src/jit/MacroAssembler.h b/js/src/jit/MacroAssembler.h index f87231045c72..e7d7b6d89cde 100644 --- a/js/src/jit/MacroAssembler.h +++ b/js/src/jit/MacroAssembler.h @@ -1266,6 +1266,9 @@ class MacroAssembler : public MacroAssemblerSpecific void loadJitActivation(Register dest) { loadPtr(AbsoluteAddress(GetJitContext()->runtime->addressOfActivation()), dest); } + void loadWasmActivation(Register dest) { + loadWasmGlobalPtr(wasm::ActivationGlobalDataOffset, dest); + } template void loadTypedOrValue(const T& src, TypedOrValueRegister dest) { diff --git a/js/src/jit/arm/CodeGenerator-arm.cpp b/js/src/jit/arm/CodeGenerator-arm.cpp index ebbf0912ba99..db94ef879d57 100644 --- a/js/src/jit/arm/CodeGenerator-arm.cpp +++ b/js/src/jit/arm/CodeGenerator-arm.cpp @@ -2752,32 +2752,6 @@ CodeGeneratorARM::visitWasmStoreGlobalVar(LWasmStoreGlobalVar* ins) } } -void -CodeGeneratorARM::visitAsmJSLoadFuncPtr(LAsmJSLoadFuncPtr* ins) -{ - const MAsmJSLoadFuncPtr* mir = ins->mir(); - - Register index = ToRegister(ins->index()); - Register out = ToRegister(ins->output()); - - if (mir->hasLimit()) { - masm.branch32(Assembler::Condition::AboveOrEqual, index, Imm32(mir->limit()), - wasm::JumpTarget::OutOfBounds); - } - - masm.ma_ldr(Address(GlobalReg, mir->globalDataOffset() - AsmJSGlobalRegBias), out); - masm.ma_ldr(DTRAddr(out, DtrRegImmShift(index, LSL, 2)), out); -} - -void -CodeGeneratorARM::visitAsmJSLoadFFIFunc(LAsmJSLoadFFIFunc* ins) -{ - const MAsmJSLoadFFIFunc* mir = ins->mir(); - - masm.ma_ldr(Address(GlobalReg, mir->globalDataOffset() - AsmJSGlobalRegBias), - ToRegister(ins->output())); -} - void CodeGeneratorARM::visitNegI(LNegI* ins) { diff --git a/js/src/jit/arm/CodeGenerator-arm.h b/js/src/jit/arm/CodeGenerator-arm.h index 7369bc55605d..3dcd1a3618a0 100644 --- a/js/src/jit/arm/CodeGenerator-arm.h +++ b/js/src/jit/arm/CodeGenerator-arm.h @@ -217,8 +217,6 @@ class CodeGeneratorARM : public CodeGeneratorShared void visitAsmJSAtomicBinopHeap(LAsmJSAtomicBinopHeap* ins); void visitAsmJSAtomicBinopHeapForEffect(LAsmJSAtomicBinopHeapForEffect* ins); void visitAsmJSAtomicBinopCallout(LAsmJSAtomicBinopCallout* ins); - void visitAsmJSLoadFuncPtr(LAsmJSLoadFuncPtr* ins); - void visitAsmJSLoadFFIFunc(LAsmJSLoadFFIFunc* ins); void visitAsmJSPassStackArg(LAsmJSPassStackArg* ins); void visitWasmTruncateToInt32(LWasmTruncateToInt32* ins); void visitOutOfLineWasmTruncateCheck(OutOfLineWasmTruncateCheck* ool); diff --git a/js/src/jit/arm/MacroAssembler-arm.h b/js/src/jit/arm/MacroAssembler-arm.h index b11b0c96a92b..650e83c030e4 100644 --- a/js/src/jit/arm/MacroAssembler-arm.h +++ b/js/src/jit/arm/MacroAssembler-arm.h @@ -1438,12 +1438,13 @@ class MacroAssemblerARMCompat : public MacroAssemblerARM as_vmov(VFPRegister(dest).singleOverlay(), VFPRegister(src).singleOverlay(), cc); } - void loadWasmActivation(Register dest) { - loadPtr(Address(GlobalReg, wasm::ActivationGlobalDataOffset - AsmJSGlobalRegBias), dest); + void loadWasmGlobalPtr(uint32_t globalDataOffset, Register dest) { + loadPtr(Address(GlobalReg, globalDataOffset - AsmJSGlobalRegBias), dest); } void loadAsmJSHeapRegisterFromGlobalData() { - loadPtr(Address(GlobalReg, wasm::HeapGlobalDataOffset - AsmJSGlobalRegBias), HeapReg); + loadWasmGlobalPtr(wasm::HeapGlobalDataOffset, HeapReg); } + // Instrumentation for entering and leaving the profiler. void profilerEnterFrame(Register framePtr, Register scratch); void profilerExitFrame(); diff --git a/js/src/jit/arm64/CodeGenerator-arm64.cpp b/js/src/jit/arm64/CodeGenerator-arm64.cpp index db8358fce8ae..d14e14bb6a37 100644 --- a/js/src/jit/arm64/CodeGenerator-arm64.cpp +++ b/js/src/jit/arm64/CodeGenerator-arm64.cpp @@ -703,18 +703,6 @@ CodeGeneratorARM64::visitWasmStoreGlobalVar(LWasmStoreGlobalVar* ins) MOZ_CRASH("visitWasmStoreGlobalVar"); } -void -CodeGeneratorARM64::visitAsmJSLoadFuncPtr(LAsmJSLoadFuncPtr* ins) -{ - MOZ_CRASH("visitAsmJSLoadFuncPtr"); -} - -void -CodeGeneratorARM64::visitAsmJSLoadFFIFunc(LAsmJSLoadFFIFunc* ins) -{ - MOZ_CRASH("visitAsmJSLoadFFIFunc"); -} - void CodeGeneratorARM64::visitNegI(LNegI* ins) { diff --git a/js/src/jit/arm64/CodeGenerator-arm64.h b/js/src/jit/arm64/CodeGenerator-arm64.h index 2e0101ee1c9d..d1e9295c04ca 100644 --- a/js/src/jit/arm64/CodeGenerator-arm64.h +++ b/js/src/jit/arm64/CodeGenerator-arm64.h @@ -203,8 +203,6 @@ class CodeGeneratorARM64 : public CodeGeneratorShared void visitAsmJSStoreHeap(LAsmJSStoreHeap* ins); void visitAsmJSCompareExchangeHeap(LAsmJSCompareExchangeHeap* ins); void visitAsmJSAtomicBinopHeap(LAsmJSAtomicBinopHeap* ins); - void visitAsmJSLoadFuncPtr(LAsmJSLoadFuncPtr* ins); - void visitAsmJSLoadFFIFunc(LAsmJSLoadFFIFunc* ins); void visitAsmJSPassStackArg(LAsmJSPassStackArg* ins); void visitWasmLoadGlobalVar(LWasmLoadGlobalVar* ins); diff --git a/js/src/jit/arm64/MacroAssembler-arm64.h b/js/src/jit/arm64/MacroAssembler-arm64.h index 6a87aa0128f8..014a2fcfedbd 100644 --- a/js/src/jit/arm64/MacroAssembler-arm64.h +++ b/js/src/jit/arm64/MacroAssembler-arm64.h @@ -2305,12 +2305,12 @@ class MacroAssemblerCompat : public vixl::MacroAssembler #endif } - void loadWasmActivation(Register dest) { - loadPtr(Address(GlobalReg, wasm::ActivationGlobalDataOffset - AsmJSGlobalRegBias), dest); + void loadWasmGlobalPtr(uint32_t globalDataOffset, Register dest) { + loadPtr(Address(GlobalReg, globalDataOffset - AsmJSGlobalRegBias), dest); } void loadAsmJSHeapRegisterFromGlobalData() { - loadPtr(Address(GlobalReg, wasm::HeapGlobalDataOffset - AsmJSGlobalRegBias), HeapReg); - loadPtr(Address(GlobalReg, wasm::HeapGlobalDataOffset - AsmJSGlobalRegBias + 8), HeapLenReg); + loadWasmGlobalPtr(wasm::HeapGlobalDataOffset, HeapReg); + loadWasmGlobalPtr(wasm::HeapGlobalDataOffset + 8, HeapLenReg); } // Overwrites the payload bits of a dest register containing a Value. diff --git a/js/src/jit/mips-shared/CodeGenerator-mips-shared.cpp b/js/src/jit/mips-shared/CodeGenerator-mips-shared.cpp index 8a8fa746057e..0315cad9bd98 100644 --- a/js/src/jit/mips-shared/CodeGenerator-mips-shared.cpp +++ b/js/src/jit/mips-shared/CodeGenerator-mips-shared.cpp @@ -2262,32 +2262,6 @@ CodeGeneratorMIPSShared::visitWasmStoreGlobalVar(LWasmStoreGlobalVar* ins) masm.storeDouble(ToFloatRegister(ins->value()), Address(GlobalReg, addr)); } -void -CodeGeneratorMIPSShared::visitAsmJSLoadFuncPtr(LAsmJSLoadFuncPtr* ins) -{ - const MAsmJSLoadFuncPtr* mir = ins->mir(); - - Register index = ToRegister(ins->index()); - Register out = ToRegister(ins->output()); - unsigned addr = mir->globalDataOffset() - AsmJSGlobalRegBias; - - if (mir->hasLimit()) { - masm.branch32(Assembler::Condition::AboveOrEqual, index, Imm32(mir->limit()), - wasm::JumpTarget::OutOfBounds); - } - - BaseIndex source(GlobalReg, index, ScalePointer, addr); - masm.loadPtr(source, out); -} - -void -CodeGeneratorMIPSShared::visitAsmJSLoadFFIFunc(LAsmJSLoadFFIFunc* ins) -{ - const MAsmJSLoadFFIFunc* mir = ins->mir(); - masm.loadPtr(Address(GlobalReg, mir->globalDataOffset() - AsmJSGlobalRegBias), - ToRegister(ins->output())); -} - void CodeGeneratorMIPSShared::visitNegI(LNegI* ins) { diff --git a/js/src/jit/mips-shared/CodeGenerator-mips-shared.h b/js/src/jit/mips-shared/CodeGenerator-mips-shared.h index 67c880b54154..3d9eb25951ae 100644 --- a/js/src/jit/mips-shared/CodeGenerator-mips-shared.h +++ b/js/src/jit/mips-shared/CodeGenerator-mips-shared.h @@ -204,8 +204,6 @@ class CodeGeneratorMIPSShared : public CodeGeneratorShared void visitAsmJSAtomicExchangeHeap(LAsmJSAtomicExchangeHeap* ins); void visitAsmJSAtomicBinopHeap(LAsmJSAtomicBinopHeap* ins); void visitAsmJSAtomicBinopHeapForEffect(LAsmJSAtomicBinopHeapForEffect* ins); - void visitAsmJSLoadFuncPtr(LAsmJSLoadFuncPtr* ins); - void visitAsmJSLoadFFIFunc(LAsmJSLoadFFIFunc* ins); void visitAsmJSPassStackArg(LAsmJSPassStackArg* ins); void visitAsmSelect(LAsmSelect* ins); diff --git a/js/src/jit/mips32/MacroAssembler-mips32.h b/js/src/jit/mips32/MacroAssembler-mips32.h index c77cba685e56..3b19b85a9e40 100644 --- a/js/src/jit/mips32/MacroAssembler-mips32.h +++ b/js/src/jit/mips32/MacroAssembler-mips32.h @@ -998,12 +998,12 @@ class MacroAssemblerMIPSCompat : public MacroAssemblerMIPS as_movs(dest, src); } - void loadWasmActivation(Register dest) { - loadPtr(Address(GlobalReg, wasm::ActivationGlobalDataOffset - AsmJSGlobalRegBias), dest); + void loadWasmGlobalPtr(uint32_t globalDataOffset, Register dest) { + loadPtr(Address(GlobalReg, globalDataOffset - AsmJSGlobalRegBias), dest); } void loadAsmJSHeapRegisterFromGlobalData() { MOZ_ASSERT(Imm16::IsInSignedRange(wasm::HeapGlobalDataOffset - AsmJSGlobalRegBias)); - loadPtr(Address(GlobalReg, wasm::HeapGlobalDataOffset - AsmJSGlobalRegBias), HeapReg); + loadWasmGlobalPtr(wasm::HeapGlobalDataOffset, HeapReg); } // Instrumentation for entering and leaving the profiler. diff --git a/js/src/jit/mips64/MacroAssembler-mips64.h b/js/src/jit/mips64/MacroAssembler-mips64.h index 883cae7f0e11..1ee57e11291b 100644 --- a/js/src/jit/mips64/MacroAssembler-mips64.h +++ b/js/src/jit/mips64/MacroAssembler-mips64.h @@ -1000,12 +1000,12 @@ class MacroAssemblerMIPS64Compat : public MacroAssemblerMIPS64 as_movs(dest, src); } - void loadWasmActivation(Register dest) { - loadPtr(Address(GlobalReg, wasm::ActivationGlobalDataOffset - AsmJSGlobalRegBias), dest); + void loadWasmGlobalPtr(uint32_t globalDataOffset, Register dest) { + loadPtr(Address(GlobalReg, globalDataOffset - AsmJSGlobalRegBias), dest); } void loadAsmJSHeapRegisterFromGlobalData() { MOZ_ASSERT(Imm16::IsInSignedRange(wasm::HeapGlobalDataOffset - AsmJSGlobalRegBias)); - loadPtr(Address(GlobalReg, wasm::HeapGlobalDataOffset - AsmJSGlobalRegBias), HeapReg); + loadWasmGlobalPtr(wasm::HeapGlobalDataOffset, dest); } // Instrumentation for entering and leaving the profiler. diff --git a/js/src/jit/none/MacroAssembler-none.h b/js/src/jit/none/MacroAssembler-none.h index c03ed333a76a..b5ebacab5956 100644 --- a/js/src/jit/none/MacroAssembler-none.h +++ b/js/src/jit/none/MacroAssembler-none.h @@ -405,6 +405,7 @@ class MacroAssemblerNone : public Assembler void buildFakeExitFrame(Register, uint32_t*) { MOZ_CRASH(); } bool buildOOLFakeExitFrame(void*) { MOZ_CRASH(); } + void loadWasmGlobalPtr(uint32_t, Register) { MOZ_CRASH(); } void loadWasmActivation(Register) { MOZ_CRASH(); } void loadAsmJSHeapRegisterFromGlobalData() { MOZ_CRASH(); } diff --git a/js/src/jit/x64/Assembler-x64.h b/js/src/jit/x64/Assembler-x64.h index cf4e760ac83c..8b21e86b502c 100644 --- a/js/src/jit/x64/Assembler-x64.h +++ b/js/src/jit/x64/Assembler-x64.h @@ -825,13 +825,12 @@ class Assembler : public AssemblerX86Shared return CodeOffset(masm.leaq_rip(dest.encoding()).offset()); } - void loadWasmActivation(Register dest) { + void loadWasmGlobalPtr(uint32_t globalDataOffset, Register dest) { CodeOffset label = loadRipRelativeInt64(dest); - append(wasm::GlobalAccess(label, wasm::ActivationGlobalDataOffset)); + append(wasm::GlobalAccess(label, globalDataOffset)); } void loadAsmJSHeapRegisterFromGlobalData() { - CodeOffset label = loadRipRelativeInt64(HeapReg); - append(wasm::GlobalAccess(label, wasm::HeapGlobalDataOffset)); + loadWasmGlobalPtr(wasm::HeapGlobalDataOffset, HeapReg); } void cmpq(Register rhs, Register lhs) { diff --git a/js/src/jit/x64/CodeGenerator-x64.cpp b/js/src/jit/x64/CodeGenerator-x64.cpp index 077bb17a0f6d..4db8ca69973d 100644 --- a/js/src/jit/x64/CodeGenerator-x64.cpp +++ b/js/src/jit/x64/CodeGenerator-x64.cpp @@ -1246,34 +1246,6 @@ CodeGeneratorX64::visitWasmStoreGlobalVar(LWasmStoreGlobalVar* ins) masm.append(wasm::GlobalAccess(label, mir->globalDataOffset())); } -void -CodeGeneratorX64::visitAsmJSLoadFuncPtr(LAsmJSLoadFuncPtr* ins) -{ - const MAsmJSLoadFuncPtr* mir = ins->mir(); - - Register index = ToRegister(ins->index()); - Register out = ToRegister(ins->output()); - - if (mir->hasLimit()) { - masm.branch32(Assembler::Condition::AboveOrEqual, index, Imm32(mir->limit()), - wasm::JumpTarget::OutOfBounds); - } - - CodeOffset label = masm.loadRipRelativeInt64(out); - masm.append(wasm::GlobalAccess(label, mir->globalDataOffset())); - - masm.loadPtr(Operand(out, index, ScalePointer, 0), out); -} - -void -CodeGeneratorX64::visitAsmJSLoadFFIFunc(LAsmJSLoadFFIFunc* ins) -{ - MAsmJSLoadFFIFunc* mir = ins->mir(); - - CodeOffset label = masm.loadRipRelativeInt64(ToRegister(ins->output())); - masm.append(wasm::GlobalAccess(label, mir->globalDataOffset())); -} - void CodeGeneratorX64::visitTruncateDToInt32(LTruncateDToInt32* ins) { diff --git a/js/src/jit/x64/CodeGenerator-x64.h b/js/src/jit/x64/CodeGenerator-x64.h index fd7f18cae319..f4f8b7adc038 100644 --- a/js/src/jit/x64/CodeGenerator-x64.h +++ b/js/src/jit/x64/CodeGenerator-x64.h @@ -85,8 +85,6 @@ class CodeGeneratorX64 : public CodeGeneratorX86Shared void visitAsmJSAtomicExchangeHeap(LAsmJSAtomicExchangeHeap* ins); void visitAsmJSAtomicBinopHeap(LAsmJSAtomicBinopHeap* ins); void visitAsmJSAtomicBinopHeapForEffect(LAsmJSAtomicBinopHeapForEffect* ins); - void visitAsmJSLoadFuncPtr(LAsmJSLoadFuncPtr* ins); - void visitAsmJSLoadFFIFunc(LAsmJSLoadFFIFunc* ins); void visitAsmJSUInt32ToDouble(LAsmJSUInt32ToDouble* lir); void visitAsmJSUInt32ToFloat32(LAsmJSUInt32ToFloat32* lir); void visitAsmReinterpretFromI64(LAsmReinterpretFromI64* lir); diff --git a/js/src/jit/x86/Assembler-x86.h b/js/src/jit/x86/Assembler-x86.h index 536e97b442b5..f8cf59a442a0 100644 --- a/js/src/jit/x86/Assembler-x86.h +++ b/js/src/jit/x86/Assembler-x86.h @@ -920,9 +920,9 @@ class Assembler : public AssemblerX86Shared return CodeOffset(masm.currentOffset()); } - void loadWasmActivation(Register dest) { + void loadWasmGlobalPtr(uint32_t globalDataOffset, Register dest) { CodeOffset label = movlWithPatch(PatchedAbsoluteAddress(), dest); - append(wasm::GlobalAccess(label, wasm::ActivationGlobalDataOffset)); + append(wasm::GlobalAccess(label, globalDataOffset)); } void loadAsmJSHeapRegisterFromGlobalData() { // x86 doesn't have a pinned heap register. diff --git a/js/src/jit/x86/CodeGenerator-x86.cpp b/js/src/jit/x86/CodeGenerator-x86.cpp index a035289bd559..06869c37712e 100644 --- a/js/src/jit/x86/CodeGenerator-x86.cpp +++ b/js/src/jit/x86/CodeGenerator-x86.cpp @@ -901,35 +901,6 @@ CodeGeneratorX86::visitWasmStoreGlobalVar(LWasmStoreGlobalVar* ins) masm.append(wasm::GlobalAccess(label, mir->globalDataOffset())); } -void -CodeGeneratorX86::visitAsmJSLoadFuncPtr(LAsmJSLoadFuncPtr* ins) -{ - const MAsmJSLoadFuncPtr* mir = ins->mir(); - - Register index = ToRegister(ins->index()); - Register out = ToRegister(ins->output()); - - if (mir->hasLimit()) { - masm.branch32(Assembler::Condition::AboveOrEqual, index, Imm32(mir->limit()), - wasm::JumpTarget::OutOfBounds); - } - - CodeOffset label = masm.movlWithPatch(PatchedAbsoluteAddress(), out); - masm.append(wasm::GlobalAccess(label, mir->globalDataOffset())); - - masm.loadPtr(Operand(out, index, ScalePointer), out); -} - -void -CodeGeneratorX86::visitAsmJSLoadFFIFunc(LAsmJSLoadFFIFunc* ins) -{ - MAsmJSLoadFFIFunc* mir = ins->mir(); - - Register out = ToRegister(ins->output()); - CodeOffset label = masm.movlWithPatch(PatchedAbsoluteAddress(), out); - masm.append(wasm::GlobalAccess(label, mir->globalDataOffset())); -} - namespace js { namespace jit { diff --git a/js/src/jit/x86/CodeGenerator-x86.h b/js/src/jit/x86/CodeGenerator-x86.h index 6b9482bb9f38..6e271c11003d 100644 --- a/js/src/jit/x86/CodeGenerator-x86.h +++ b/js/src/jit/x86/CodeGenerator-x86.h @@ -68,8 +68,6 @@ class CodeGeneratorX86 : public CodeGeneratorX86Shared void visitAsmJSAtomicExchangeHeap(LAsmJSAtomicExchangeHeap* ins); void visitAsmJSAtomicBinopHeap(LAsmJSAtomicBinopHeap* ins); void visitAsmJSAtomicBinopHeapForEffect(LAsmJSAtomicBinopHeapForEffect* ins); - void visitAsmJSLoadFuncPtr(LAsmJSLoadFuncPtr* ins); - void visitAsmJSLoadFFIFunc(LAsmJSLoadFFIFunc* ins); void visitWasmTruncateToInt32(LWasmTruncateToInt32* ins); void visitOutOfLineTruncate(OutOfLineTruncate* ool);