Loading js/src/asmjs/WasmCode.h +0 −24 Original line number Diff line number Diff line Loading @@ -223,30 +223,6 @@ class FuncImport typedef Vector<FuncImport, 0, SystemAllocPolicy> FuncImportVector; // TableDesc contains the metadata describing a table as well as the // module-specific offset of the table's base pointer in global memory. // The element kind of this table. Currently, wasm only has "any function" and // asm.js only "typed function". enum class TableKind { AnyFunction, TypedFunction }; struct TableDesc { TableKind kind; bool external; uint32_t globalDataOffset; uint32_t initial; uint32_t maximum; TableDesc() { PodZero(this); } }; WASM_DECLARE_POD_VECTOR(TableDesc, TableDescVector) // A CodeRange describes a single contiguous range of code within a wasm // module's code segment. A CodeRange describes what the code does and, for // function bodies, the name and source coordinates of the function. Loading js/src/asmjs/WasmIonCompile.cpp +6 −6 Original line number Diff line number Diff line Loading @@ -980,7 +980,7 @@ class FunctionCompiler CallSiteDesc desc(call.lineOrBytecode_, CallSiteDesc::Relative); MIRType ret = ToMIRType(sig.ret()); auto callee = MWasmCall::Callee::internal(funcIndex); auto callee = CalleeDesc::internal(funcIndex); auto* ins = MWasmCall::New(alloc(), desc, callee, call.regArgs_, ret, call.spIncrement_); if (!ins) return false; Loading @@ -1000,7 +1000,7 @@ class FunctionCompiler const SigWithId& sig = mg_.sigs[sigIndex]; MWasmCall::Callee callee; CalleeDesc callee; if (mg_.isAsmJS()) { const TableDesc& table = mg_.tables[mg_.asmJSSigToTableIndex[sigIndex]]; MOZ_ASSERT(sig.id.kind() == SigIdDesc::Kind::None); Loading @@ -1012,13 +1012,13 @@ class FunctionCompiler curBlock_->add(maskedIndex); index = maskedIndex; callee = MWasmCall::Callee::asmJSTable(table.globalDataOffset); callee = CalleeDesc::asmJSTable(table); } else { const TableDesc& table = mg_.tables[0]; MOZ_ASSERT(sig.id.kind() != SigIdDesc::Kind::None); MOZ_ASSERT(mg_.tables.length() == 1); callee = MWasmCall::Callee::wasmTable(table.globalDataOffset, table.initial, sig.id); callee = CalleeDesc::wasmTable(table, sig.id); } CallSiteDesc desc(call.lineOrBytecode_, CallSiteDesc::Register); Loading @@ -1045,7 +1045,7 @@ class FunctionCompiler CallSiteDesc desc(call.lineOrBytecode_, CallSiteDesc::Register); MIRType ret = ToMIRType(exprRet); auto callee = MWasmCall::Callee::import(globalDataOffset, call.tlsStackOffset_); auto callee = CalleeDesc::import(globalDataOffset, call.tlsStackOffset_); auto* ins = MWasmCall::New(alloc(), desc, callee, call.regArgs_, ret, call.spIncrement_); if (!ins) return false; Loading @@ -1065,7 +1065,7 @@ class FunctionCompiler CallSiteDesc desc(call.lineOrBytecode_, CallSiteDesc::Register); MIRType ret = ToMIRType(valRet); auto callee = MWasmCall::Callee(builtin); auto callee = CalleeDesc::builtin(builtin); auto* ins = MWasmCall::New(alloc(), desc, callee, call.regArgs_, ret, call.spIncrement_); if (!ins) return false; Loading js/src/asmjs/WasmTypes.h +117 −0 Original line number Diff line number Diff line Loading @@ -1040,6 +1040,123 @@ enum ModuleKind AsmJS }; // TableDesc describes a table as well as the offset of the table's base pointer // in global memory. Currently, wasm only has "any function" and asm.js only // "typed function". enum class TableKind { AnyFunction, TypedFunction }; struct TableDesc { TableKind kind; bool external; uint32_t globalDataOffset; uint32_t initial; uint32_t maximum; TableDesc() { PodZero(this); } }; WASM_DECLARE_POD_VECTOR(TableDesc, TableDescVector) // CalleeDesc describes how to compile one of the variety of asm.js/wasm calls. // This is hoisted into WasmTypes.h for sharing between Ion and Baseline. class CalleeDesc { public: enum Which { Internal, Import, WasmTable, AsmJSTable, Builtin }; private: Which which_; union U { U() {} uint32_t internalFuncIndex_; struct { uint32_t globalDataOffset_; uint32_t tlsStackOffset_; } import; struct { TableDesc desc_; SigIdDesc sigId_; } table; SymbolicAddress builtin_; } u; public: CalleeDesc() {} static CalleeDesc internal(uint32_t callee) { CalleeDesc c; c.which_ = Internal; c.u.internalFuncIndex_ = callee; return c; } static CalleeDesc import(uint32_t globalDataOffset, uint32_t tlsStackOffset) { CalleeDesc c; c.which_ = Import; c.u.import.globalDataOffset_ = globalDataOffset; c.u.import.tlsStackOffset_ = tlsStackOffset; return c; } static CalleeDesc wasmTable(const TableDesc& desc, SigIdDesc sigId) { CalleeDesc c; c.which_ = WasmTable; c.u.table.desc_ = desc; c.u.table.sigId_ = sigId; return c; } static CalleeDesc asmJSTable(const TableDesc& desc) { CalleeDesc c; c.which_ = AsmJSTable; c.u.table.desc_ = desc; return c; } static CalleeDesc builtin(SymbolicAddress callee) { CalleeDesc c; c.which_ = Builtin; c.u.builtin_ = callee; return c; } Which which() const { return which_; } uint32_t internalFuncIndex() const { MOZ_ASSERT(which_ == Internal); return u.internalFuncIndex_; } uint32_t importGlobalDataOffset() const { MOZ_ASSERT(which_ == Import); return u.import.globalDataOffset_; } uint32_t importTlsStackOffset() const { MOZ_ASSERT(which_ == Import); return u.import.tlsStackOffset_; } bool isTable() const { return which_ == WasmTable || which_ == AsmJSTable; } uint32_t tableGlobalDataOffset() const { MOZ_ASSERT(isTable()); return u.table.desc_.globalDataOffset; } uint32_t wasmTableLength() const { MOZ_ASSERT(which_ == WasmTable); return u.table.desc_.initial; } SigIdDesc wasmTableSigId() const { MOZ_ASSERT(which_ == WasmTable); return u.table.sigId_; } SymbolicAddress builtin() const { MOZ_ASSERT(which_ == Builtin); return u.builtin_; } }; // ExportArg holds the unboxed operands to the wasm entry trampoline which can // be called through an ExportFuncPtr. Loading js/src/jit/MIR.cpp +1 −1 Original line number Diff line number Diff line Loading @@ -5358,7 +5358,7 @@ MAsmJSUnsignedToFloat32::foldsTo(TempAllocator& alloc) } MWasmCall* MWasmCall::New(TempAllocator& alloc, const wasm::CallSiteDesc& desc, Callee callee, MWasmCall::New(TempAllocator& alloc, const wasm::CallSiteDesc& desc, const wasm::CalleeDesc& callee, const Args& args, MIRType resultType, size_t spIncrement, MDefinition* tableIndex) { Loading js/src/jit/MIR.h +6 −95 Original line number Diff line number Diff line Loading @@ -13518,101 +13518,12 @@ class MWasmCall final : public MVariadicInstruction, public NoTypePolicy::Data { public: class Callee { public: enum Which { Internal, Import, WasmTable, AsmJSTable, Builtin }; private: Which which_; union U { U() {} uint32_t internalFuncIndex_; struct { uint32_t globalDataOffset_; uint32_t tlsStackOffset_; } import; struct { uint32_t globalDataOffset_; uint32_t length_; wasm::SigIdDesc sigId_; } table; wasm::SymbolicAddress builtin_; } u; public: Callee() {} static Callee internal(uint32_t callee) { Callee c; c.which_ = Internal; c.u.internalFuncIndex_ = callee; return c; } static Callee import(uint32_t globalDataOffset, uint32_t tlsStackOffset) { Callee c; c.which_ = Import; c.u.import.globalDataOffset_ = globalDataOffset; c.u.import.tlsStackOffset_ = tlsStackOffset; return c; } static Callee wasmTable(uint32_t globalDataOffset, uint32_t length, wasm::SigIdDesc sigId) { Callee c; c.which_ = WasmTable; c.u.table.globalDataOffset_ = globalDataOffset; c.u.table.length_ = length; c.u.table.sigId_ = sigId; return c; } static Callee asmJSTable(uint32_t globalDataOffset) { Callee c; c.which_ = AsmJSTable; c.u.table.globalDataOffset_ = globalDataOffset; return c; } explicit Callee(wasm::SymbolicAddress callee) : which_(Builtin) { u.builtin_ = callee; } Which which() const { return which_; } uint32_t internalFuncIndex() const { MOZ_ASSERT(which_ == Internal); return u.internalFuncIndex_; } uint32_t importGlobalDataOffset() const { MOZ_ASSERT(which_ == Import); return u.import.globalDataOffset_; } uint32_t importTlsStackOffset() const { MOZ_ASSERT(which_ == Import); return u.import.tlsStackOffset_; } bool isTable() const { return which_ == WasmTable || which_ == AsmJSTable; } uint32_t tableGlobalDataOffset() const { MOZ_ASSERT(isTable()); return u.table.globalDataOffset_; } uint32_t wasmTableLength() const { MOZ_ASSERT(which_ == WasmTable); return u.table.length_; } wasm::SigIdDesc wasmTableSigId() const { MOZ_ASSERT(which_ == WasmTable); return u.table.sigId_; } wasm::SymbolicAddress builtin() const { MOZ_ASSERT(which_ == Builtin); return u.builtin_; } }; private: wasm::CallSiteDesc desc_; Callee callee_; wasm::CalleeDesc callee_; FixedList<AnyRegister> argRegs_; size_t spIncrement_; MWasmCall(const wasm::CallSiteDesc& desc, Callee callee, size_t spIncrement) MWasmCall(const wasm::CallSiteDesc& desc, const wasm::CalleeDesc& callee, size_t spIncrement) : desc_(desc), callee_(callee), spIncrement_(spIncrement) Loading @@ -13628,9 +13539,9 @@ class MWasmCall final }; typedef Vector<Arg, 8, SystemAllocPolicy> Args; static MWasmCall* New(TempAllocator& alloc, const wasm::CallSiteDesc& desc, Callee callee, const Args& args, MIRType resultType, size_t spIncrement, MDefinition* tableIndex = nullptr); static MWasmCall* New(TempAllocator& alloc, const wasm::CallSiteDesc& desc, const wasm::CalleeDesc& callee, const Args& args, MIRType resultType, size_t spIncrement, MDefinition* tableIndex = nullptr); size_t numArgs() const { return argRegs_.length(); Loading @@ -13642,7 +13553,7 @@ class MWasmCall final const wasm::CallSiteDesc& desc() const { return desc_; } Callee callee() const { const wasm::CalleeDesc &callee() const { return callee_; } size_t spIncrement() const { Loading Loading
js/src/asmjs/WasmCode.h +0 −24 Original line number Diff line number Diff line Loading @@ -223,30 +223,6 @@ class FuncImport typedef Vector<FuncImport, 0, SystemAllocPolicy> FuncImportVector; // TableDesc contains the metadata describing a table as well as the // module-specific offset of the table's base pointer in global memory. // The element kind of this table. Currently, wasm only has "any function" and // asm.js only "typed function". enum class TableKind { AnyFunction, TypedFunction }; struct TableDesc { TableKind kind; bool external; uint32_t globalDataOffset; uint32_t initial; uint32_t maximum; TableDesc() { PodZero(this); } }; WASM_DECLARE_POD_VECTOR(TableDesc, TableDescVector) // A CodeRange describes a single contiguous range of code within a wasm // module's code segment. A CodeRange describes what the code does and, for // function bodies, the name and source coordinates of the function. Loading
js/src/asmjs/WasmIonCompile.cpp +6 −6 Original line number Diff line number Diff line Loading @@ -980,7 +980,7 @@ class FunctionCompiler CallSiteDesc desc(call.lineOrBytecode_, CallSiteDesc::Relative); MIRType ret = ToMIRType(sig.ret()); auto callee = MWasmCall::Callee::internal(funcIndex); auto callee = CalleeDesc::internal(funcIndex); auto* ins = MWasmCall::New(alloc(), desc, callee, call.regArgs_, ret, call.spIncrement_); if (!ins) return false; Loading @@ -1000,7 +1000,7 @@ class FunctionCompiler const SigWithId& sig = mg_.sigs[sigIndex]; MWasmCall::Callee callee; CalleeDesc callee; if (mg_.isAsmJS()) { const TableDesc& table = mg_.tables[mg_.asmJSSigToTableIndex[sigIndex]]; MOZ_ASSERT(sig.id.kind() == SigIdDesc::Kind::None); Loading @@ -1012,13 +1012,13 @@ class FunctionCompiler curBlock_->add(maskedIndex); index = maskedIndex; callee = MWasmCall::Callee::asmJSTable(table.globalDataOffset); callee = CalleeDesc::asmJSTable(table); } else { const TableDesc& table = mg_.tables[0]; MOZ_ASSERT(sig.id.kind() != SigIdDesc::Kind::None); MOZ_ASSERT(mg_.tables.length() == 1); callee = MWasmCall::Callee::wasmTable(table.globalDataOffset, table.initial, sig.id); callee = CalleeDesc::wasmTable(table, sig.id); } CallSiteDesc desc(call.lineOrBytecode_, CallSiteDesc::Register); Loading @@ -1045,7 +1045,7 @@ class FunctionCompiler CallSiteDesc desc(call.lineOrBytecode_, CallSiteDesc::Register); MIRType ret = ToMIRType(exprRet); auto callee = MWasmCall::Callee::import(globalDataOffset, call.tlsStackOffset_); auto callee = CalleeDesc::import(globalDataOffset, call.tlsStackOffset_); auto* ins = MWasmCall::New(alloc(), desc, callee, call.regArgs_, ret, call.spIncrement_); if (!ins) return false; Loading @@ -1065,7 +1065,7 @@ class FunctionCompiler CallSiteDesc desc(call.lineOrBytecode_, CallSiteDesc::Register); MIRType ret = ToMIRType(valRet); auto callee = MWasmCall::Callee(builtin); auto callee = CalleeDesc::builtin(builtin); auto* ins = MWasmCall::New(alloc(), desc, callee, call.regArgs_, ret, call.spIncrement_); if (!ins) return false; Loading
js/src/asmjs/WasmTypes.h +117 −0 Original line number Diff line number Diff line Loading @@ -1040,6 +1040,123 @@ enum ModuleKind AsmJS }; // TableDesc describes a table as well as the offset of the table's base pointer // in global memory. Currently, wasm only has "any function" and asm.js only // "typed function". enum class TableKind { AnyFunction, TypedFunction }; struct TableDesc { TableKind kind; bool external; uint32_t globalDataOffset; uint32_t initial; uint32_t maximum; TableDesc() { PodZero(this); } }; WASM_DECLARE_POD_VECTOR(TableDesc, TableDescVector) // CalleeDesc describes how to compile one of the variety of asm.js/wasm calls. // This is hoisted into WasmTypes.h for sharing between Ion and Baseline. class CalleeDesc { public: enum Which { Internal, Import, WasmTable, AsmJSTable, Builtin }; private: Which which_; union U { U() {} uint32_t internalFuncIndex_; struct { uint32_t globalDataOffset_; uint32_t tlsStackOffset_; } import; struct { TableDesc desc_; SigIdDesc sigId_; } table; SymbolicAddress builtin_; } u; public: CalleeDesc() {} static CalleeDesc internal(uint32_t callee) { CalleeDesc c; c.which_ = Internal; c.u.internalFuncIndex_ = callee; return c; } static CalleeDesc import(uint32_t globalDataOffset, uint32_t tlsStackOffset) { CalleeDesc c; c.which_ = Import; c.u.import.globalDataOffset_ = globalDataOffset; c.u.import.tlsStackOffset_ = tlsStackOffset; return c; } static CalleeDesc wasmTable(const TableDesc& desc, SigIdDesc sigId) { CalleeDesc c; c.which_ = WasmTable; c.u.table.desc_ = desc; c.u.table.sigId_ = sigId; return c; } static CalleeDesc asmJSTable(const TableDesc& desc) { CalleeDesc c; c.which_ = AsmJSTable; c.u.table.desc_ = desc; return c; } static CalleeDesc builtin(SymbolicAddress callee) { CalleeDesc c; c.which_ = Builtin; c.u.builtin_ = callee; return c; } Which which() const { return which_; } uint32_t internalFuncIndex() const { MOZ_ASSERT(which_ == Internal); return u.internalFuncIndex_; } uint32_t importGlobalDataOffset() const { MOZ_ASSERT(which_ == Import); return u.import.globalDataOffset_; } uint32_t importTlsStackOffset() const { MOZ_ASSERT(which_ == Import); return u.import.tlsStackOffset_; } bool isTable() const { return which_ == WasmTable || which_ == AsmJSTable; } uint32_t tableGlobalDataOffset() const { MOZ_ASSERT(isTable()); return u.table.desc_.globalDataOffset; } uint32_t wasmTableLength() const { MOZ_ASSERT(which_ == WasmTable); return u.table.desc_.initial; } SigIdDesc wasmTableSigId() const { MOZ_ASSERT(which_ == WasmTable); return u.table.sigId_; } SymbolicAddress builtin() const { MOZ_ASSERT(which_ == Builtin); return u.builtin_; } }; // ExportArg holds the unboxed operands to the wasm entry trampoline which can // be called through an ExportFuncPtr. Loading
js/src/jit/MIR.cpp +1 −1 Original line number Diff line number Diff line Loading @@ -5358,7 +5358,7 @@ MAsmJSUnsignedToFloat32::foldsTo(TempAllocator& alloc) } MWasmCall* MWasmCall::New(TempAllocator& alloc, const wasm::CallSiteDesc& desc, Callee callee, MWasmCall::New(TempAllocator& alloc, const wasm::CallSiteDesc& desc, const wasm::CalleeDesc& callee, const Args& args, MIRType resultType, size_t spIncrement, MDefinition* tableIndex) { Loading
js/src/jit/MIR.h +6 −95 Original line number Diff line number Diff line Loading @@ -13518,101 +13518,12 @@ class MWasmCall final : public MVariadicInstruction, public NoTypePolicy::Data { public: class Callee { public: enum Which { Internal, Import, WasmTable, AsmJSTable, Builtin }; private: Which which_; union U { U() {} uint32_t internalFuncIndex_; struct { uint32_t globalDataOffset_; uint32_t tlsStackOffset_; } import; struct { uint32_t globalDataOffset_; uint32_t length_; wasm::SigIdDesc sigId_; } table; wasm::SymbolicAddress builtin_; } u; public: Callee() {} static Callee internal(uint32_t callee) { Callee c; c.which_ = Internal; c.u.internalFuncIndex_ = callee; return c; } static Callee import(uint32_t globalDataOffset, uint32_t tlsStackOffset) { Callee c; c.which_ = Import; c.u.import.globalDataOffset_ = globalDataOffset; c.u.import.tlsStackOffset_ = tlsStackOffset; return c; } static Callee wasmTable(uint32_t globalDataOffset, uint32_t length, wasm::SigIdDesc sigId) { Callee c; c.which_ = WasmTable; c.u.table.globalDataOffset_ = globalDataOffset; c.u.table.length_ = length; c.u.table.sigId_ = sigId; return c; } static Callee asmJSTable(uint32_t globalDataOffset) { Callee c; c.which_ = AsmJSTable; c.u.table.globalDataOffset_ = globalDataOffset; return c; } explicit Callee(wasm::SymbolicAddress callee) : which_(Builtin) { u.builtin_ = callee; } Which which() const { return which_; } uint32_t internalFuncIndex() const { MOZ_ASSERT(which_ == Internal); return u.internalFuncIndex_; } uint32_t importGlobalDataOffset() const { MOZ_ASSERT(which_ == Import); return u.import.globalDataOffset_; } uint32_t importTlsStackOffset() const { MOZ_ASSERT(which_ == Import); return u.import.tlsStackOffset_; } bool isTable() const { return which_ == WasmTable || which_ == AsmJSTable; } uint32_t tableGlobalDataOffset() const { MOZ_ASSERT(isTable()); return u.table.globalDataOffset_; } uint32_t wasmTableLength() const { MOZ_ASSERT(which_ == WasmTable); return u.table.length_; } wasm::SigIdDesc wasmTableSigId() const { MOZ_ASSERT(which_ == WasmTable); return u.table.sigId_; } wasm::SymbolicAddress builtin() const { MOZ_ASSERT(which_ == Builtin); return u.builtin_; } }; private: wasm::CallSiteDesc desc_; Callee callee_; wasm::CalleeDesc callee_; FixedList<AnyRegister> argRegs_; size_t spIncrement_; MWasmCall(const wasm::CallSiteDesc& desc, Callee callee, size_t spIncrement) MWasmCall(const wasm::CallSiteDesc& desc, const wasm::CalleeDesc& callee, size_t spIncrement) : desc_(desc), callee_(callee), spIncrement_(spIncrement) Loading @@ -13628,9 +13539,9 @@ class MWasmCall final }; typedef Vector<Arg, 8, SystemAllocPolicy> Args; static MWasmCall* New(TempAllocator& alloc, const wasm::CallSiteDesc& desc, Callee callee, const Args& args, MIRType resultType, size_t spIncrement, MDefinition* tableIndex = nullptr); static MWasmCall* New(TempAllocator& alloc, const wasm::CallSiteDesc& desc, const wasm::CalleeDesc& callee, const Args& args, MIRType resultType, size_t spIncrement, MDefinition* tableIndex = nullptr); size_t numArgs() const { return argRegs_.length(); Loading @@ -13642,7 +13553,7 @@ class MWasmCall final const wasm::CallSiteDesc& desc() const { return desc_; } Callee callee() const { const wasm::CalleeDesc &callee() const { return callee_; } size_t spIncrement() const { Loading