Skip to content

Commit

Permalink
Backed out 6 changesets (bug 1794841) for causing build bustages CLOS…
Browse files Browse the repository at this point in the history
…ED TREE

Backed out changeset fba05a94b614 (bug 1794841)
Backed out changeset 83fa047989c7 (bug 1794841)
Backed out changeset 2a4c88ddd548 (bug 1794841)
Backed out changeset 9fa0cc213d62 (bug 1794841)
Backed out changeset b3722221b4be (bug 1794841)
Backed out changeset 2daef03ea536 (bug 1794841)
  • Loading branch information
Cristian Tuns committed Oct 17, 2022
1 parent f5b8a2c commit 73d2d70
Show file tree
Hide file tree
Showing 34 changed files with 356 additions and 202 deletions.
2 changes: 1 addition & 1 deletion js/src/jit/CacheIR.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9525,7 +9525,7 @@ AttachDecision CallIRGenerator::tryAttachWasmCall(HandleFunction calleeFunc) {
#endif
ABIArgGenerator abi;
for (const auto& valType : sig.args()) {
MIRType mirType = valType.toMIRType();
MIRType mirType = ToMIRType(valType);
ABIArg abiArg = abi.next(mirType);
if (mirType != MIRType::Int64) {
continue;
Expand Down
4 changes: 2 additions & 2 deletions js/src/jit/CodeGenerator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17300,15 +17300,15 @@ void CodeGenerator::emitIonToWasmCallBase(LIonToWasmCallBase<NumDefs>* lir) {
case wasm::ValType::I64:
case wasm::ValType::F32:
case wasm::ValType::F64:
argMir = sig.args()[i].toMIRType();
argMir = ToMIRType(sig.args()[i]);
break;
case wasm::ValType::V128:
MOZ_CRASH("unexpected argument type when calling from ion to wasm");
case wasm::ValType::Ref:
switch (sig.args()[i].refTypeKind()) {
case wasm::RefType::Extern:
// AnyRef is boxed on the JS side, so passed as a pointer here.
argMir = sig.args()[i].toMIRType();
argMir = ToMIRType(sig.args()[i]);
break;
case wasm::RefType::Func:
case wasm::RefType::Eq:
Expand Down
2 changes: 1 addition & 1 deletion js/src/jit/MIR.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6772,7 +6772,7 @@ MIonToWasmCall* MIonToWasmCall::New(TempAllocator& alloc,
if (results.length() > 0 && !results[0].isEncodedAsJSValueOnEscape()) {
MOZ_ASSERT(results.length() == 1,
"multiple returns not implemented for inlined Wasm calls");
resultType = results[0].toMIRType();
resultType = ToMIRType(results[0]);
}

auto* ins = new (alloc) MIonToWasmCall(instanceObj, resultType, funcExport);
Expand Down
9 changes: 5 additions & 4 deletions js/src/wasm/AsmJS.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1159,6 +1159,8 @@ class MOZ_STACK_CLASS ModuleValidatorShared {
uint32_t mask_;
bool defined_;

Table(Table&& rhs) = delete;

public:
Table(uint32_t sigIndex, TaggedParserAtomIndex name, uint32_t firstUse,
uint32_t mask)
Expand All @@ -1168,8 +1170,6 @@ class MOZ_STACK_CLASS ModuleValidatorShared {
mask_(mask),
defined_(false) {}

Table(Table&& rhs) = delete;

uint32_t sigIndex() const { return sigIndex_; }
TaggedParserAtomIndex name() const { return name_; }
uint32_t firstUse() const { return firstUse_; }
Expand Down Expand Up @@ -1413,7 +1413,8 @@ class MOZ_STACK_CLASS ModuleValidatorShared {
sigSet_(cx),
funcImportMap_(cx),
arrayViews_(cx),
compilerEnv_(CompileMode::Once, Tier::Optimized, DebugEnabled::False),
compilerEnv_(CompileMode::Once, Tier::Optimized, OptimizedBackend::Ion,
DebugEnabled::False),
moduleEnv_(FeatureArgs(), ModuleKind::AsmJS) {
compilerEnv_.computeParameters();
memory_.minLength = RoundUpToNextValidAsmJSHeapLength(0);
Expand Down Expand Up @@ -6951,7 +6952,7 @@ static bool TryInstantiate(JSContext* cx, CallArgs args, const Module& module,
}

imports.get().memory =
WasmMemoryObject::create(cx, buffer, /* isHuge= */ false, nullptr);
WasmMemoryObject::create(cx, buffer, /* hugeMemory= */ false, nullptr);
if (!imports.get().memory) {
return false;
}
Expand Down
7 changes: 7 additions & 0 deletions js/src/wasm/WasmBCClass-inl.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,13 @@ const Local& BaseCompiler::localFromSlot(uint32_t slot, MIRType type) {
return localInfo_[slot];
}

uint32_t BaseCompiler::readCallSiteLineOrBytecode() {
if (!func_.callSiteLineNums.empty()) {
return func_.callSiteLineNums[lastReadCallSite_++];
}
return iter_.lastOpcodeOffset();
}

BytecodeOffset BaseCompiler::bytecodeOffset() const {
return iter_.bytecodeOffset();
}
Expand Down
34 changes: 23 additions & 11 deletions js/src/wasm/WasmBCClass.h
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,9 @@ struct AccessCheck {

// Encapsulate all the information about a function call.
struct FunctionCall {
FunctionCall()
: restoreRegisterStateAndRealm(false),
explicit FunctionCall(uint32_t lineOrBytecode)
: lineOrBytecode(lineOrBytecode),
restoreRegisterStateAndRealm(false),
usesSystemAbi(false),
#ifdef JS_CODEGEN_ARM
hardFP(true),
Expand All @@ -138,6 +139,7 @@ struct FunctionCall {
stackArgAreaSize(0) {
}

uint32_t lineOrBytecode;
WasmABIArgGenerator abi;
bool restoreRegisterStateAndRealm;
bool usesSystemAbi;
Expand Down Expand Up @@ -274,6 +276,10 @@ struct BaseCompiler final {
// Flag indicating that the compiler is currently in a dead code region.
bool deadCode_;

// Running count of call sites, used only to assert that the compiler is in a
// sensible state once compilation has completed.
size_t lastReadCallSite_;

///////////////////////////////////////////////////////////////////////////
//
// State for bounds check elimination.
Expand Down Expand Up @@ -1190,7 +1196,7 @@ struct BaseCompiler final {
template <typename RegIndexType>
void atomicRMW64(MemoryAccessDesc* access, ValType type, AtomicOp op);

void atomicXchg(MemoryAccessDesc* access, ValType type);
void atomicXchg(MemoryAccessDesc* desc, ValType type);
template <typename RegIndexType>
void atomicXchg64(MemoryAccessDesc* access, WantResult wantResult);
template <typename RegIndexType>
Expand Down Expand Up @@ -1237,15 +1243,18 @@ struct BaseCompiler final {
//
// Sundry helpers.

// Retrieve the current bytecodeOffset.
// Get the line number or bytecode offset, depending on what's available.
inline uint32_t readCallSiteLineOrBytecode();

// Retrieve the current bytecodeOffset
inline BytecodeOffset bytecodeOffset() const;

// Generate a trap instruction for the current bytecodeOffset.
inline void trap(Trap t) const;

// Abstracted helper for throwing, used for throw, rethrow, and rethrowing
// at the end of a series of catch blocks (if none matched the exception).
[[nodiscard]] bool throwFrom(RegRef exn);
[[nodiscard]] bool throwFrom(RegRef exn, uint32_t lineOrBytecode);

// Load the specified tag object from the Instance.
void loadTag(RegPtr instanceData, uint32_t tagIndex, RegRef tagDst);
Expand Down Expand Up @@ -1565,7 +1574,8 @@ struct BaseCompiler final {
//
// (see WasmBuiltins.cpp). In short, the most recently pushed value is the
// rightmost argument to the function.
[[nodiscard]] bool emitInstanceCall(const SymbolicAddressSignature& builtin);
[[nodiscard]] bool emitInstanceCall(uint32_t lineOrBytecode,
const SymbolicAddressSignature& builtin);

[[nodiscard]] bool emitMemoryGrow();
[[nodiscard]] bool emitMemorySize();
Expand All @@ -1586,19 +1596,21 @@ struct BaseCompiler final {
AtomicOp op);
[[nodiscard]] bool emitAtomicStore(ValType type, Scalar::Type viewType);
[[nodiscard]] bool emitWait(ValType type, uint32_t byteSize);
[[nodiscard]] bool atomicWait(ValType type, MemoryAccessDesc* access);
[[nodiscard]] bool atomicWait(ValType type, MemoryAccessDesc* access,
uint32_t lineOrBytecode);
[[nodiscard]] bool emitWake();
[[nodiscard]] bool atomicWake(MemoryAccessDesc* access);
[[nodiscard]] bool atomicWake(MemoryAccessDesc* access,
uint32_t lineOrBytecode);
[[nodiscard]] bool emitFence();
[[nodiscard]] bool emitAtomicXchg(ValType type, Scalar::Type viewType);
[[nodiscard]] bool emitMemInit();
[[nodiscard]] bool emitMemCopy();
[[nodiscard]] bool memCopyCall();
[[nodiscard]] bool memCopyCall(uint32_t lineOrBytecode);
void memCopyInlineM32();
[[nodiscard]] bool emitTableCopy();
[[nodiscard]] bool emitDataOrElemDrop(bool isData);
[[nodiscard]] bool emitMemFill();
[[nodiscard]] bool memFillCall();
[[nodiscard]] bool memFillCall(uint32_t lineOrBytecode);
void memFillInlineM32();
[[nodiscard]] bool emitTableInit();
[[nodiscard]] bool emitTableFill();
Expand Down Expand Up @@ -1634,7 +1646,7 @@ struct BaseCompiler final {
void emitGcNullCheck(RegRef rp);
RegPtr emitGcArrayGetData(RegRef rp);
RegI32 emitGcArrayGetNumElements(RegRef rp);
void emitGcArrayBoundsCheck(RegI32 index, RegI32 numElements);
void emitGcArrayBoundsCheck(RegI32 index, RegI32 length);
template <typename T>
void emitGcGet(FieldType type, FieldExtension extension, const T& src);
template <typename T>
Expand Down
9 changes: 6 additions & 3 deletions js/src/wasm/WasmBCCodegen-inl.h
Original file line number Diff line number Diff line change
Expand Up @@ -478,18 +478,20 @@ void BaseCompiler::emitBinop(void (*op)(CompilerType1& compiler, RegType rs,
template <typename R>
bool BaseCompiler::emitInstanceCallOp(const SymbolicAddressSignature& fn,
R reader) {
uint32_t lineOrBytecode = readCallSiteLineOrBytecode();
if (!reader()) {
return false;
}
if (deadCode_) {
return true;
}
return emitInstanceCall(fn);
return emitInstanceCall(lineOrBytecode, fn);
}

template <typename A1, typename R>
bool BaseCompiler::emitInstanceCallOp(const SymbolicAddressSignature& fn,
R reader) {
uint32_t lineOrBytecode = readCallSiteLineOrBytecode();
A1 arg = 0;
if (!reader(&arg)) {
return false;
Expand All @@ -498,12 +500,13 @@ bool BaseCompiler::emitInstanceCallOp(const SymbolicAddressSignature& fn,
return true;
}
push(arg);
return emitInstanceCall(fn);
return emitInstanceCall(lineOrBytecode, fn);
}

template <typename A1, typename A2, typename R>
bool BaseCompiler::emitInstanceCallOp(const SymbolicAddressSignature& fn,
R reader) {
uint32_t lineOrBytecode = readCallSiteLineOrBytecode();
A1 arg1 = 0;
A2 arg2 = 0;
if (!reader(&arg1, &arg2)) {
Expand All @@ -515,7 +518,7 @@ bool BaseCompiler::emitInstanceCallOp(const SymbolicAddressSignature& fn,
// Note order of arguments must be the same as for the reader.
push(arg1);
push(arg2);
return emitInstanceCall(fn);
return emitInstanceCall(lineOrBytecode, fn);
}

} // namespace wasm
Expand Down
2 changes: 1 addition & 1 deletion js/src/wasm/WasmBCFrame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ void BaseLocalIter::settle() {
// TODO/AnyRef-boxing: With boxed immediates and strings, the
// debugger must be made aware that AnyRef != Pointer.
ASSERT_ANYREF_IS_JSOBJECT;
mirType_ = locals_[index_].toMIRType();
mirType_ = ToMIRType(locals_[index_]);
frameOffset_ = pushLocal(MIRTypeToSize(mirType_));
break;
default:
Expand Down
15 changes: 10 additions & 5 deletions js/src/wasm/WasmBCMemory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2121,7 +2121,8 @@ void BaseCompiler::atomicCmpXchg64(MemoryAccessDesc* access, ValType type) {
//
// Synchronization.

bool BaseCompiler::atomicWait(ValType type, MemoryAccessDesc* access) {
bool BaseCompiler::atomicWait(ValType type, MemoryAccessDesc* access,
uint32_t lineOrBytecode) {
switch (type.kind()) {
case ValType::I32: {
RegI64 timeout = popI64();
Expand All @@ -2140,7 +2141,8 @@ bool BaseCompiler::atomicWait(ValType type, MemoryAccessDesc* access) {
pushI32(val);
pushI64(timeout);

if (!emitInstanceCall(isMem32() ? SASigWaitI32M32 : SASigWaitI32M64)) {
if (!emitInstanceCall(lineOrBytecode,
isMem32() ? SASigWaitI32M32 : SASigWaitI32M64)) {
return false;
}
break;
Expand Down Expand Up @@ -2176,7 +2178,8 @@ bool BaseCompiler::atomicWait(ValType type, MemoryAccessDesc* access) {
pushI64(val);
pushI64(timeout);

if (!emitInstanceCall(isMem32() ? SASigWaitI64M32 : SASigWaitI64M64)) {
if (!emitInstanceCall(lineOrBytecode,
isMem32() ? SASigWaitI64M32 : SASigWaitI64M64)) {
return false;
}
break;
Expand All @@ -2188,7 +2191,8 @@ bool BaseCompiler::atomicWait(ValType type, MemoryAccessDesc* access) {
return true;
}

bool BaseCompiler::atomicWake(MemoryAccessDesc* access) {
bool BaseCompiler::atomicWake(MemoryAccessDesc* access,
uint32_t lineOrBytecode) {
RegI32 count = popI32();

if (isMem32()) {
Expand All @@ -2202,7 +2206,8 @@ bool BaseCompiler::atomicWake(MemoryAccessDesc* access) {
}

pushI32(count);
return emitInstanceCall(isMem32() ? SASigWakeM32 : SASigWakeM64);
return emitInstanceCall(lineOrBytecode,
isMem32() ? SASigWakeM32 : SASigWakeM64);
}

//////////////////////////////////////////////////////////////////////////////
Expand Down
Loading

0 comments on commit 73d2d70

Please sign in to comment.