|
@@ -3,7 +3,7 @@
|
|
|
# Date 1527526769 -7200
|
|
|
# Mon May 28 18:59:29 2018 +0200
|
|
|
# Node ID 9e3fb74a11eefbed803b9e8705c18ad754a1fe23
|
|
|
-# Parent 6f06798229551bb9b0b3b772dd10bbad253678b8
|
|
|
+# Parent 7c3c2d6c17d7563fa2ea242ee2ae08be4685370e
|
|
|
Bug 1459900 - Ref types with a simple type calculus. r=luke
|
|
|
|
|
|
We generalize ExprType and StackType in the same way as ValType, in
|
|
@@ -185,7 +185,7 @@ new file mode 100644
|
|
|
diff --git a/js/src/jit-test/tests/wasm/gc/structs.js b/js/src/jit-test/tests/wasm/gc/structs.js
|
|
|
--- a/js/src/jit-test/tests/wasm/gc/structs.js
|
|
|
+++ b/js/src/jit-test/tests/wasm/gc/structs.js
|
|
|
-@@ -87,16 +87,25 @@ wasmEvalText(`
|
|
|
+@@ -78,16 +78,25 @@ wasmEvalText(`
|
|
|
|
|
|
// Empty structs are OK.
|
|
|
|
|
@@ -468,7 +468,7 @@ diff --git a/js/src/wasm/WasmAST.h b/js/src/wasm/WasmAST.h
|
|
|
{
|
|
|
void* operator new(size_t numBytes, LifoAlloc& astLifo) throw() {
|
|
|
return astLifo.alloc(numBytes);
|
|
|
-@@ -147,53 +308,68 @@ class AstTypeDef : public AstBase
|
|
|
+@@ -154,53 +315,68 @@ class AstTypeDef : public AstNode
|
|
|
inline const AstFuncType& asFuncType() const;
|
|
|
inline const AstStructType& asStructType() const;
|
|
|
};
|
|
@@ -544,7 +544,7 @@ diff --git a/js/src/wasm/WasmAST.h b/js/src/wasm/WasmAST.h
|
|
|
};
|
|
|
|
|
|
class AstStructType : public AstTypeDef
|
|
|
-@@ -223,16 +399,19 @@ class AstStructType : public AstTypeDef
|
|
|
+@@ -230,16 +406,19 @@ class AstStructType : public AstTypeDef
|
|
|
return name_;
|
|
|
}
|
|
|
const AstNameVector& fieldNames() const {
|
|
@@ -564,7 +564,7 @@ diff --git a/js/src/wasm/WasmAST.h b/js/src/wasm/WasmAST.h
|
|
|
MOZ_ASSERT(isFuncType());
|
|
|
return *static_cast<AstFuncType*>(this);
|
|
|
}
|
|
|
-@@ -314,31 +493,31 @@ enum class AstExprKind
|
|
|
+@@ -308,31 +487,31 @@ enum class AstExprKind
|
|
|
Unreachable,
|
|
|
Wait,
|
|
|
Wake
|
|
@@ -602,7 +602,7 @@ diff --git a/js/src/wasm/WasmAST.h b/js/src/wasm/WasmAST.h
|
|
|
}
|
|
|
};
|
|
|
|
|
|
-@@ -479,17 +658,17 @@ class AstTeeLocal : public AstExpr
|
|
|
+@@ -473,17 +652,17 @@ class AstTeeLocal : public AstExpr
|
|
|
class AstBlock : public AstExpr
|
|
|
{
|
|
|
Op op_;
|
|
@@ -621,7 +621,7 @@ diff --git a/js/src/wasm/WasmAST.h b/js/src/wasm/WasmAST.h
|
|
|
|
|
|
Op op() const { return op_; }
|
|
|
AstName name() const { return name_; }
|
|
|
-@@ -500,17 +679,17 @@ class AstBranch : public AstExpr
|
|
|
+@@ -494,17 +673,17 @@ class AstBranch : public AstExpr
|
|
|
{
|
|
|
Op op_;
|
|
|
AstExpr* cond_;
|
|
@@ -640,7 +640,7 @@ diff --git a/js/src/wasm/WasmAST.h b/js/src/wasm/WasmAST.h
|
|
|
value_(value)
|
|
|
{}
|
|
|
|
|
|
-@@ -523,34 +702,34 @@ class AstBranch : public AstExpr
|
|
|
+@@ -517,34 +696,34 @@ class AstBranch : public AstExpr
|
|
|
class AstCall : public AstExpr
|
|
|
{
|
|
|
Op op_;
|
|
@@ -677,7 +677,7 @@ diff --git a/js/src/wasm/WasmAST.h b/js/src/wasm/WasmAST.h
|
|
|
};
|
|
|
|
|
|
class AstReturn : public AstExpr
|
|
|
-@@ -570,17 +749,17 @@ class AstIf : public AstExpr
|
|
|
+@@ -564,17 +743,17 @@ class AstIf : public AstExpr
|
|
|
{
|
|
|
AstExpr* cond_;
|
|
|
AstName name_;
|
|
@@ -696,12 +696,12 @@ diff --git a/js/src/wasm/WasmAST.h b/js/src/wasm/WasmAST.h
|
|
|
elseExprs_(std::move(elseExprs))
|
|
|
{}
|
|
|
|
|
|
-@@ -871,42 +1050,44 @@ class AstFunc : public AstNode
|
|
|
+@@ -863,40 +1042,42 @@ class AstFunc : public AstNode
|
|
|
+ : name_(name),
|
|
|
funcType_(ft),
|
|
|
vars_(std::move(vars)),
|
|
|
localNames_(std::move(locals)),
|
|
|
- body_(std::move(body)),
|
|
|
- endOffset_(AstNodeUnknownOffset)
|
|
|
+ body_(std::move(body))
|
|
|
{}
|
|
|
AstRef& funcType() { return funcType_; }
|
|
|
const AstValTypeVector& vars() const { return vars_; }
|
|
@@ -709,8 +709,6 @@ diff --git a/js/src/wasm/WasmAST.h b/js/src/wasm/WasmAST.h
|
|
|
const AstNameVector& locals() const { return localNames_; }
|
|
|
const AstExprVector& body() const { return body_; }
|
|
|
AstName name() const { return name_; }
|
|
|
- uint32_t endOffset() const { return endOffset_; }
|
|
|
- void setEndOffset(uint32_t offset) { endOffset_ = offset; }
|
|
|
};
|
|
|
|
|
|
class AstGlobal : public AstNode
|
|
@@ -744,7 +742,7 @@ diff --git a/js/src/wasm/WasmAST.h b/js/src/wasm/WasmAST.h
|
|
|
typedef AstVector<AstGlobal*> AstGlobalVector;
|
|
|
|
|
|
class AstImport : public AstNode
|
|
|
-@@ -944,16 +1125,20 @@ class AstImport : public AstNode
|
|
|
+@@ -934,16 +1115,20 @@ class AstImport : public AstNode
|
|
|
Limits limits() const {
|
|
|
MOZ_ASSERT(kind_ == DefinitionKind::Memory || kind_ == DefinitionKind::Table);
|
|
|
return limits_;
|
|
@@ -765,7 +763,7 @@ diff --git a/js/src/wasm/WasmAST.h b/js/src/wasm/WasmAST.h
|
|
|
DefinitionKind kind_;
|
|
|
AstRef ref_;
|
|
|
|
|
|
-@@ -1300,23 +1485,23 @@ class AstExtraConversionOperator final :
|
|
|
+@@ -1290,23 +1475,23 @@ class AstExtraConversionOperator final :
|
|
|
|
|
|
MiscOp op() const { return op_; }
|
|
|
AstExpr* operand() const { return operand_; }
|
|
@@ -795,7 +793,7 @@ diff --git a/js/src/wasm/WasmAST.h b/js/src/wasm/WasmAST.h
|
|
|
diff --git a/js/src/wasm/WasmBaselineCompile.cpp b/js/src/wasm/WasmBaselineCompile.cpp
|
|
|
--- a/js/src/wasm/WasmBaselineCompile.cpp
|
|
|
+++ b/js/src/wasm/WasmBaselineCompile.cpp
|
|
|
-@@ -1051,16 +1051,17 @@ BaseLocalIter::settle()
|
|
|
+@@ -1052,16 +1052,17 @@ BaseLocalIter::settle()
|
|
|
|
|
|
MOZ_ASSERT(argsIter_.done());
|
|
|
if (index_ < locals_.length()) {
|
|
@@ -813,7 +811,7 @@ diff --git a/js/src/wasm/WasmBaselineCompile.cpp b/js/src/wasm/WasmBaselineCompi
|
|
|
MOZ_CRASH("Compiler bug: Unexpected local type");
|
|
|
}
|
|
|
return;
|
|
|
-@@ -2125,69 +2126,85 @@ class BaseCompiler final : public BaseCo
|
|
|
+@@ -2126,69 +2127,85 @@ class BaseCompiler final : public BaseCo
|
|
|
}
|
|
|
|
|
|
void moveF32(RegF32 src, RegF32 dest) {
|
|
@@ -907,7 +905,7 @@ diff --git a/js/src/wasm/WasmBaselineCompile.cpp b/js/src/wasm/WasmBaselineCompi
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-@@ -3094,17 +3111,17 @@ class BaseCompiler final : public BaseCo
|
|
|
+@@ -3095,17 +3112,17 @@ class BaseCompiler final : public BaseCo
|
|
|
// JoinReg is live out of the block. But on the way out, we
|
|
|
// currently pop the JoinReg before freeing regs to be discarded,
|
|
|
// so there is a real risk of some pointless shuffling there. If
|
|
@@ -926,7 +924,7 @@ diff --git a/js/src/wasm/WasmBaselineCompile.cpp b/js/src/wasm/WasmBaselineCompi
|
|
|
MOZ_ASSERT(k == Stk::RegisterI32 || k == Stk::ConstI32 || k == Stk::MemI32 ||
|
|
|
k == Stk::LocalI32);
|
|
|
return Some(AnyReg(popI32(joinRegI32_)));
|
|
|
-@@ -3122,16 +3139,17 @@ class BaseCompiler final : public BaseCo
|
|
|
+@@ -3123,16 +3140,17 @@ class BaseCompiler final : public BaseCo
|
|
|
return Some(AnyReg(popF64(joinRegF64_)));
|
|
|
}
|
|
|
case ExprType::F32: {
|
|
@@ -944,7 +942,7 @@ diff --git a/js/src/wasm/WasmBaselineCompile.cpp b/js/src/wasm/WasmBaselineCompi
|
|
|
}
|
|
|
default: {
|
|
|
MOZ_CRASH("Compiler bug: unexpected expression type");
|
|
|
-@@ -3141,33 +3159,34 @@ class BaseCompiler final : public BaseCo
|
|
|
+@@ -3142,33 +3160,34 @@ class BaseCompiler final : public BaseCo
|
|
|
|
|
|
// If we ever start not sync-ing on entry to Block (but instead try to sync
|
|
|
// lazily) then this may start asserting because it does not spill the
|
|
@@ -980,7 +978,7 @@ diff --git a/js/src/wasm/WasmBaselineCompile.cpp b/js/src/wasm/WasmBaselineCompi
|
|
|
return Nothing();
|
|
|
default:
|
|
|
MOZ_CRASH("Compiler bug: unexpected type");
|
|
|
-@@ -3414,58 +3433,60 @@ class BaseCompiler final : public BaseCo
|
|
|
+@@ -3415,58 +3434,60 @@ class BaseCompiler final : public BaseCo
|
|
|
if (env_.debugEnabled())
|
|
|
insertBreakablePoint(CallSiteDesc::EnterFrame);
|
|
|
}
|
|
@@ -1043,7 +1041,7 @@ diff --git a/js/src/wasm/WasmBaselineCompile.cpp b/js/src/wasm/WasmBaselineCompi
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-@@ -3728,16 +3749,17 @@ class BaseCompiler final : public BaseCo
|
|
|
+@@ -3733,16 +3754,17 @@ class BaseCompiler final : public BaseCo
|
|
|
MOZ_CRASH("Unexpected parameter passing discipline");
|
|
|
}
|
|
|
#endif
|
|
@@ -1061,7 +1059,7 @@ diff --git a/js/src/wasm/WasmBaselineCompile.cpp b/js/src/wasm/WasmBaselineCompi
|
|
|
masm.storePtr(scratch, Address(masm.getStackPointer(), argLoc.offsetFromArgBase()));
|
|
|
} else {
|
|
|
loadRef(arg, RegPtr(argLoc.gpr()));
|
|
|
-@@ -7679,17 +7701,17 @@ BaseCompiler::emitDrop()
|
|
|
+@@ -7684,17 +7706,17 @@ BaseCompiler::emitDrop()
|
|
|
|
|
|
dropValue();
|
|
|
return true;
|
|
@@ -1080,7 +1078,7 @@ diff --git a/js/src/wasm/WasmBaselineCompile.cpp b/js/src/wasm/WasmBaselineCompi
|
|
|
RegI32 rv = popI32(RegI32(ReturnReg));
|
|
|
returnCleanup(popStack);
|
|
|
freeI32(rv);
|
|
|
-@@ -7708,16 +7730,17 @@ BaseCompiler::doReturn(ExprType type, bo
|
|
|
+@@ -7713,16 +7735,17 @@ BaseCompiler::doReturn(ExprType type, bo
|
|
|
break;
|
|
|
}
|
|
|
case ExprType::F32: {
|
|
@@ -1098,7 +1096,7 @@ diff --git a/js/src/wasm/WasmBaselineCompile.cpp b/js/src/wasm/WasmBaselineCompi
|
|
|
}
|
|
|
default: {
|
|
|
MOZ_CRASH("Function return type");
|
|
|
-@@ -7754,17 +7777,17 @@ BaseCompiler::emitCallArgs(const ValType
|
|
|
+@@ -7759,17 +7782,17 @@ BaseCompiler::emitCallArgs(const ValType
|
|
|
|
|
|
masm.loadWasmTlsRegFromFrame();
|
|
|
return true;
|
|
@@ -1117,7 +1115,7 @@ diff --git a/js/src/wasm/WasmBaselineCompile.cpp b/js/src/wasm/WasmBaselineCompi
|
|
|
pushI32(rv);
|
|
|
break;
|
|
|
}
|
|
|
-@@ -7778,16 +7801,17 @@ BaseCompiler::pushReturnedIfNonVoid(cons
|
|
|
+@@ -7783,16 +7806,17 @@ BaseCompiler::pushReturnedIfNonVoid(cons
|
|
|
pushF32(rv);
|
|
|
break;
|
|
|
}
|
|
@@ -1135,7 +1133,7 @@ diff --git a/js/src/wasm/WasmBaselineCompile.cpp b/js/src/wasm/WasmBaselineCompi
|
|
|
default:
|
|
|
MOZ_CRASH("Function return type");
|
|
|
}
|
|
|
-@@ -8108,16 +8132,17 @@ BaseCompiler::emitGetLocal()
|
|
|
+@@ -8113,16 +8137,17 @@ BaseCompiler::emitGetLocal()
|
|
|
pushLocalI64(slot);
|
|
|
break;
|
|
|
case ValType::F64:
|
|
@@ -1153,7 +1151,7 @@ diff --git a/js/src/wasm/WasmBaselineCompile.cpp b/js/src/wasm/WasmBaselineCompi
|
|
|
}
|
|
|
|
|
|
return true;
|
|
|
-@@ -8167,16 +8192,17 @@ BaseCompiler::emitSetOrTeeLocal(uint32_t
|
|
|
+@@ -8172,16 +8197,17 @@ BaseCompiler::emitSetOrTeeLocal(uint32_t
|
|
|
syncLocal(slot);
|
|
|
fr.storeLocalF32(rv, localFromSlot(slot, MIRType::Float32));
|
|
|
if (isSetLocal)
|
|
@@ -1171,7 +1169,7 @@ diff --git a/js/src/wasm/WasmBaselineCompile.cpp b/js/src/wasm/WasmBaselineCompi
|
|
|
freeRef(rv);
|
|
|
else
|
|
|
pushRef(rv);
|
|
|
-@@ -8697,16 +8723,17 @@ BaseCompiler::emitSelect()
|
|
|
+@@ -8702,16 +8728,17 @@ BaseCompiler::emitSelect()
|
|
|
pop2xF64(&r, &rs);
|
|
|
emitBranchPerform(&b);
|
|
|
moveF64(rs, r);
|
|
@@ -1189,7 +1187,7 @@ diff --git a/js/src/wasm/WasmBaselineCompile.cpp b/js/src/wasm/WasmBaselineCompi
|
|
|
masm.bind(&done);
|
|
|
freeRef(rs);
|
|
|
pushRef(r);
|
|
|
-@@ -8867,17 +8894,18 @@ BaseCompiler::emitCurrentMemory()
|
|
|
+@@ -8872,17 +8899,18 @@ BaseCompiler::emitCurrentMemory()
|
|
|
|
|
|
emitInstanceCall(lineOrBytecode, SigP_, ExprType::I32, SymbolicAddress::CurrentMemory);
|
|
|
return true;
|
|
@@ -1209,7 +1207,7 @@ diff --git a/js/src/wasm/WasmBaselineCompile.cpp b/js/src/wasm/WasmBaselineCompi
|
|
|
pushRef(NULLREF_VALUE);
|
|
|
return true;
|
|
|
}
|
|
|
-@@ -10206,17 +10234,17 @@ js::wasm::BaselineCompileFunctions(const
|
|
|
+@@ -10211,17 +10239,17 @@ js::wasm::BaselineCompileFunctions(const
|
|
|
for (const FuncCompileInput& func : inputs) {
|
|
|
Decoder d(func.begin, func.end, func.lineOrBytecode, error);
|
|
|
|
|
@@ -1254,7 +1252,7 @@ diff --git a/js/src/wasm/WasmBinaryConstants.h b/js/src/wasm/WasmBinaryConstants
|
|
|
diff --git a/js/src/wasm/WasmBuiltins.cpp b/js/src/wasm/WasmBuiltins.cpp
|
|
|
--- a/js/src/wasm/WasmBuiltins.cpp
|
|
|
+++ b/js/src/wasm/WasmBuiltins.cpp
|
|
|
-@@ -1039,17 +1039,17 @@ wasm::SymbolicAddressTarget(SymbolicAddr
|
|
|
+@@ -1043,17 +1043,17 @@ wasm::SymbolicAddressTarget(SymbolicAddr
|
|
|
|
|
|
static Maybe<ABIFunctionType>
|
|
|
ToBuiltinABIFunctionType(const FuncType& funcType)
|
|
@@ -1276,7 +1274,7 @@ diff --git a/js/src/wasm/WasmBuiltins.cpp b/js/src/wasm/WasmBuiltins.cpp
|
|
|
diff --git a/js/src/wasm/WasmDebug.cpp b/js/src/wasm/WasmDebug.cpp
|
|
|
--- a/js/src/wasm/WasmDebug.cpp
|
|
|
+++ b/js/src/wasm/WasmDebug.cpp
|
|
|
-@@ -537,17 +537,17 @@ DebugState::debugGetLocalTypes(uint32_t
|
|
|
+@@ -377,17 +377,17 @@ DebugState::debugGetLocalTypes(uint32_t
|
|
|
|
|
|
// Decode local var types from wasm binary function body.
|
|
|
const CodeRange& range = codeRanges(Tier::Debug)[debugFuncToCodeRangeIndex(funcIndex)];
|
|
@@ -1298,7 +1296,7 @@ diff --git a/js/src/wasm/WasmDebug.cpp b/js/src/wasm/WasmDebug.cpp
|
|
|
diff --git a/js/src/wasm/WasmInstance.cpp b/js/src/wasm/WasmInstance.cpp
|
|
|
--- a/js/src/wasm/WasmInstance.cpp
|
|
|
+++ b/js/src/wasm/WasmInstance.cpp
|
|
|
-@@ -128,16 +128,17 @@ Instance::callImport(JSContext* cx, uint
|
|
|
+@@ -130,16 +130,17 @@ Instance::callImport(JSContext* cx, uint
|
|
|
args[i].set(Int32Value(*(int32_t*)&argv[i]));
|
|
|
break;
|
|
|
case ValType::F32:
|
|
@@ -1316,7 +1314,7 @@ diff --git a/js/src/wasm/WasmInstance.cpp b/js/src/wasm/WasmInstance.cpp
|
|
|
case ValType::I8x16:
|
|
|
case ValType::I16x8:
|
|
|
case ValType::I32x4:
|
|
|
-@@ -200,16 +201,17 @@ Instance::callImport(JSContext* cx, uint
|
|
|
+@@ -204,16 +205,17 @@ Instance::callImport(JSContext* cx, uint
|
|
|
|
|
|
size_t numKnownArgs = Min(importArgs.length(), importFun->nargs());
|
|
|
for (uint32_t i = 0; i < numKnownArgs; i++) {
|
|
@@ -1334,7 +1332,7 @@ diff --git a/js/src/wasm/WasmInstance.cpp b/js/src/wasm/WasmInstance.cpp
|
|
|
case ValType::F32x4: MOZ_CRASH("NYI");
|
|
|
case ValType::B8x16: MOZ_CRASH("NYI");
|
|
|
case ValType::B16x8: MOZ_CRASH("NYI");
|
|
|
-@@ -781,16 +783,17 @@ Instance::callExport(JSContext* cx, uint
|
|
|
+@@ -793,16 +795,17 @@ Instance::callExport(JSContext* cx, uint
|
|
|
case ValType::F32:
|
|
|
if (!RoundFloat32(cx, v, (float*)&exportArgs[i]))
|
|
|
return false;
|
|
@@ -1352,7 +1350,7 @@ diff --git a/js/src/wasm/WasmInstance.cpp b/js/src/wasm/WasmInstance.cpp
|
|
|
case ValType::I8x16: {
|
|
|
SimdConstant simd;
|
|
|
if (!ToSimdConstant<Int8x16>(cx, v, &simd))
|
|
|
-@@ -872,31 +875,32 @@ Instance::callExport(JSContext* cx, uint
|
|
|
+@@ -884,31 +887,32 @@ Instance::callExport(JSContext* cx, uint
|
|
|
args.rval().set(ObjectValue(*obj));
|
|
|
return true;
|
|
|
}
|
|
@@ -1975,7 +1973,7 @@ diff --git a/js/src/wasm/WasmStubs.cpp b/js/src/wasm/WasmStubs.cpp
|
|
|
case ExprType::I16x8:
|
|
|
case ExprType::I32x4:
|
|
|
case ExprType::B8x16:
|
|
|
-@@ -1169,17 +1173,17 @@ GenerateImportInterpExit(MacroAssembler&
|
|
|
+@@ -1172,17 +1176,17 @@ GenerateImportInterpExit(MacroAssembler&
|
|
|
masm.computeEffectiveAddress(argv, scratch);
|
|
|
masm.storePtr(scratch, Address(masm.getStackPointer(), i->offsetFromArgBase()));
|
|
|
}
|
|
@@ -1994,7 +1992,7 @@ diff --git a/js/src/wasm/WasmStubs.cpp b/js/src/wasm/WasmStubs.cpp
|
|
|
masm.call(SymbolicAddress::CallImport_I32);
|
|
|
masm.branchTest32(Assembler::Zero, ReturnReg, ReturnReg, throwLabel);
|
|
|
masm.load32(argv, ReturnReg);
|
|
|
-@@ -1194,16 +1198,17 @@ GenerateImportInterpExit(MacroAssembler&
|
|
|
+@@ -1197,16 +1201,17 @@ GenerateImportInterpExit(MacroAssembler&
|
|
|
masm.loadDouble(argv, ReturnDoubleReg);
|
|
|
masm.convertDoubleToFloat32(ReturnDoubleReg, ReturnFloat32Reg);
|
|
|
break;
|
|
@@ -2012,7 +2010,7 @@ diff --git a/js/src/wasm/WasmStubs.cpp b/js/src/wasm/WasmStubs.cpp
|
|
|
case ExprType::I8x16:
|
|
|
case ExprType::I16x8:
|
|
|
case ExprType::I32x4:
|
|
|
-@@ -1359,31 +1364,34 @@ GenerateImportJitExit(MacroAssembler& ma
|
|
|
+@@ -1362,31 +1367,34 @@ GenerateImportJitExit(MacroAssembler& ma
|
|
|
Label ok;
|
|
|
masm.branchTestMagic(Assembler::NotEqual, JSReturnOperand, &ok);
|
|
|
masm.breakpoint();
|
|
@@ -2048,7 +2046,7 @@ diff --git a/js/src/wasm/WasmStubs.cpp b/js/src/wasm/WasmStubs.cpp
|
|
|
case ExprType::I32x4:
|
|
|
case ExprType::F32x4:
|
|
|
case ExprType::B8x16:
|
|
|
-@@ -1440,17 +1448,17 @@ GenerateImportJitExit(MacroAssembler& ma
|
|
|
+@@ -1443,17 +1451,17 @@ GenerateImportJitExit(MacroAssembler& ma
|
|
|
masm.storePtr(scratch, Address(masm.getStackPointer(), i->offsetFromArgBase()));
|
|
|
}
|
|
|
i++;
|
|
@@ -2106,7 +2104,7 @@ diff --git a/js/src/wasm/WasmTextToBinary.cpp b/js/src/wasm/WasmTextToBinary.cpp
|
|
|
case Table:
|
|
|
case Text:
|
|
|
case Then:
|
|
|
-@@ -1690,22 +1692,22 @@ WasmTokenStream::next()
|
|
|
+@@ -1694,22 +1696,22 @@ WasmTokenStream::next()
|
|
|
return WasmToken(WasmToken::Param, begin, cur_);
|
|
|
break;
|
|
|
|
|
@@ -2133,7 +2131,7 @@ diff --git a/js/src/wasm/WasmTextToBinary.cpp b/js/src/wasm/WasmTextToBinary.cpp
|
|
|
return WasmToken(WasmToken::TernaryOpcode, Op::Select, begin, cur_);
|
|
|
if (consume(u"set_global"))
|
|
|
return WasmToken(WasmToken::SetGlobal, begin, cur_);
|
|
|
-@@ -1827,23 +1829,65 @@ ParseExprList(WasmParseContext& c, AstEx
|
|
|
+@@ -1831,23 +1833,65 @@ ParseExprList(WasmParseContext& c, AstEx
|
|
|
|
|
|
break;
|
|
|
}
|
|
@@ -2203,7 +2201,7 @@ diff --git a/js/src/wasm/WasmTextToBinary.cpp b/js/src/wasm/WasmTextToBinary.cpp
|
|
|
MaybeMatchName(WasmParseContext& c, const AstName& name)
|
|
|
{
|
|
|
WasmToken tok;
|
|
|
-@@ -1878,17 +1922,17 @@ ParseBlock(WasmParseContext& c, Op op, b
|
|
|
+@@ -1882,17 +1926,17 @@ ParseBlock(WasmParseContext& c, Op op, b
|
|
|
if (op == Op::Loop) {
|
|
|
AstName maybeName = c.ts.getIfName();
|
|
|
if (!maybeName.empty()) {
|
|
@@ -2222,7 +2220,7 @@ diff --git a/js/src/wasm/WasmTextToBinary.cpp b/js/src/wasm/WasmTextToBinary.cpp
|
|
|
|
|
|
if (!inParens) {
|
|
|
if (!c.ts.match(WasmToken::End, c.error))
|
|
|
-@@ -2485,17 +2529,17 @@ ParseDrop(WasmParseContext& c, bool inPa
|
|
|
+@@ -2489,17 +2533,17 @@ ParseDrop(WasmParseContext& c, bool inPa
|
|
|
return new(c.lifo) AstDrop(*value);
|
|
|
}
|
|
|
|
|
@@ -2241,7 +2239,7 @@ diff --git a/js/src/wasm/WasmTextToBinary.cpp b/js/src/wasm/WasmTextToBinary.cpp
|
|
|
return nullptr;
|
|
|
|
|
|
if (inParens) {
|
|
|
-@@ -3011,23 +3055,27 @@ ParseMemFill(WasmParseContext& c, bool i
|
|
|
+@@ -3015,23 +3059,27 @@ ParseMemFill(WasmParseContext& c, bool i
|
|
|
return new(c.lifo) AstMemFill(start, val, len);
|
|
|
}
|
|
|
#endif
|
|
@@ -2273,7 +2271,7 @@ diff --git a/js/src/wasm/WasmTextToBinary.cpp b/js/src/wasm/WasmTextToBinary.cpp
|
|
|
if (!CheckRecursionLimitDontReport(c.stackLimit))
|
|
|
return nullptr;
|
|
|
switch (token.kind()) {
|
|
|
-@@ -3121,51 +3169,54 @@ ParseExprInsideParens(WasmParseContext&
|
|
|
+@@ -3125,51 +3173,54 @@ ParseExprInsideParens(WasmParseContext&
|
|
|
WasmToken token = c.ts.get();
|
|
|
|
|
|
return ParseExprBody(c, token, true);
|
|
@@ -2342,7 +2340,7 @@ diff --git a/js/src/wasm/WasmTextToBinary.cpp b/js/src/wasm/WasmTextToBinary.cpp
|
|
|
return c.ts.match(WasmToken::Text, &import->module, c.error) &&
|
|
|
c.ts.match(WasmToken::Text, &import->field, c.error);
|
|
|
}
|
|
|
-@@ -3197,17 +3248,17 @@ MaybeParseTypeUse(WasmParseContext& c, A
|
|
|
+@@ -3201,17 +3252,17 @@ MaybeParseTypeUse(WasmParseContext& c, A
|
|
|
}
|
|
|
return true;
|
|
|
}
|
|
@@ -2361,7 +2359,7 @@ diff --git a/js/src/wasm/WasmTextToBinary.cpp b/js/src/wasm/WasmTextToBinary.cpp
|
|
|
if (!ParseValueTypeList(c, &args))
|
|
|
return false;
|
|
|
break;
|
|
|
-@@ -3292,17 +3343,17 @@ ParseFunc(WasmParseContext& c, AstModule
|
|
|
+@@ -3296,17 +3347,17 @@ ParseFunc(WasmParseContext& c, AstModule
|
|
|
}
|
|
|
|
|
|
AstRef funcTypeRef;
|
|
@@ -2380,7 +2378,7 @@ diff --git a/js/src/wasm/WasmTextToBinary.cpp b/js/src/wasm/WasmTextToBinary.cpp
|
|
|
return false;
|
|
|
break;
|
|
|
case WasmToken::Param:
|
|
|
-@@ -3338,43 +3389,43 @@ ParseFunc(WasmParseContext& c, AstModule
|
|
|
+@@ -3342,43 +3393,43 @@ ParseFunc(WasmParseContext& c, AstModule
|
|
|
funcTypeRef.setIndex(funcTypeIndex);
|
|
|
}
|
|
|
|
|
@@ -2428,7 +2426,7 @@ diff --git a/js/src/wasm/WasmTextToBinary.cpp b/js/src/wasm/WasmTextToBinary.cpp
|
|
|
}
|
|
|
|
|
|
static AstTypeDef*
|
|
|
-@@ -3576,32 +3627,38 @@ ParseStartFunc(WasmParseContext& c, Wasm
|
|
|
+@@ -3580,32 +3631,38 @@ ParseStartFunc(WasmParseContext& c, Wasm
|
|
|
c.ts.generateError(token, c.error);
|
|
|
return false;
|
|
|
}
|
|
@@ -2481,7 +2479,7 @@ diff --git a/js/src/wasm/WasmTextToBinary.cpp b/js/src/wasm/WasmTextToBinary.cpp
|
|
|
// Only AnyFunc is allowed at the moment.
|
|
|
return c.ts.match(WasmToken::AnyFunc, c.error);
|
|
|
}
|
|
|
-@@ -3652,25 +3709,25 @@ ParseImport(WasmParseContext& c, AstModu
|
|
|
+@@ -3656,25 +3713,25 @@ ParseImport(WasmParseContext& c, AstModu
|
|
|
return nullptr;
|
|
|
return new(c.lifo) AstImport(name, moduleName.text(), fieldName.text(),
|
|
|
DefinitionKind::Table, table);
|
|
@@ -2510,7 +2508,7 @@ diff --git a/js/src/wasm/WasmTextToBinary.cpp b/js/src/wasm/WasmTextToBinary.cpp
|
|
|
AstRef funcTypeRef;
|
|
|
if (!ParseFuncType(c, &funcTypeRef, module))
|
|
|
return nullptr;
|
|
|
-@@ -3879,62 +3936,61 @@ ParseElemSegment(WasmParseContext& c)
|
|
|
+@@ -3883,62 +3940,61 @@ ParseElemSegment(WasmParseContext& c)
|
|
|
return new(c.lifo) AstElemSegment(offset, std::move(elems));
|
|
|
}
|
|
|
|
|
@@ -2578,7 +2576,7 @@ diff --git a/js/src/wasm/WasmTextToBinary.cpp b/js/src/wasm/WasmTextToBinary.cpp
|
|
|
{
|
|
|
// By convention with EncodeBinaryModule, a binary module only contains a
|
|
|
// data section containing the raw bytes contained in the module.
|
|
|
-@@ -4181,16 +4237,38 @@ class Resolver
|
|
|
+@@ -4185,16 +4241,38 @@ class Resolver
|
|
|
*error_ = JS_smprintf("%s", message);
|
|
|
return false;
|
|
|
}
|
|
@@ -2617,7 +2615,7 @@ diff --git a/js/src/wasm/WasmTextToBinary.cpp b/js/src/wasm/WasmTextToBinary.cpp
|
|
|
for (size_t i = 0; i < v.length(); i++) {
|
|
|
if (!ResolveExpr(r, *v[i]))
|
|
|
return false;
|
|
|
-@@ -4199,16 +4277,19 @@ ResolveExprList(Resolver& r, const AstEx
|
|
|
+@@ -4203,16 +4281,19 @@ ResolveExprList(Resolver& r, const AstEx
|
|
|
}
|
|
|
|
|
|
static bool
|
|
@@ -2637,7 +2635,7 @@ diff --git a/js/src/wasm/WasmTextToBinary.cpp b/js/src/wasm/WasmTextToBinary.cpp
|
|
|
}
|
|
|
|
|
|
static bool
|
|
|
-@@ -4374,16 +4455,18 @@ ResolveExtraConversionOperator(Resolver&
|
|
|
+@@ -4378,16 +4459,18 @@ ResolveExtraConversionOperator(Resolver&
|
|
|
{
|
|
|
return ResolveExpr(r, *b.operand());
|
|
|
}
|
|
@@ -2656,7 +2654,7 @@ diff --git a/js/src/wasm/WasmTextToBinary.cpp b/js/src/wasm/WasmTextToBinary.cpp
|
|
|
return false;
|
|
|
if (i.hasElse()) {
|
|
|
if (!ResolveExprList(r, i.elseExprs()))
|
|
|
-@@ -4492,25 +4575,32 @@ ResolveMemFill(Resolver& r, AstMemFill&
|
|
|
+@@ -4496,25 +4579,32 @@ ResolveMemFill(Resolver& r, AstMemFill&
|
|
|
{
|
|
|
return ResolveExpr(r, s.start()) &&
|
|
|
ResolveExpr(r, s.val()) &&
|
|
@@ -2690,7 +2688,7 @@ diff --git a/js/src/wasm/WasmTextToBinary.cpp b/js/src/wasm/WasmTextToBinary.cpp
|
|
|
return ResolveBlock(r, expr.as<AstBlock>());
|
|
|
case AstExprKind::Branch:
|
|
|
return ResolveBranch(r, expr.as<AstBranch>());
|
|
|
-@@ -4578,29 +4668,54 @@ ResolveExpr(Resolver& r, AstExpr& expr)
|
|
|
+@@ -4582,29 +4672,54 @@ ResolveExpr(Resolver& r, AstExpr& expr)
|
|
|
MOZ_CRASH("Bad expr kind");
|
|
|
}
|
|
|
|
|
@@ -2745,7 +2743,7 @@ diff --git a/js/src/wasm/WasmTextToBinary.cpp b/js/src/wasm/WasmTextToBinary.cpp
|
|
|
return false;
|
|
|
|
|
|
size_t numTypes = module->types().length();
|
|
|
-@@ -4608,17 +4723,30 @@ ResolveModule(LifoAlloc& lifo, AstModule
|
|
|
+@@ -4612,17 +4727,30 @@ ResolveModule(LifoAlloc& lifo, AstModule
|
|
|
AstTypeDef* td = module->types()[i];
|
|
|
if (td->isFuncType()) {
|
|
|
AstFuncType* funcType = static_cast<AstFuncType*>(td);
|
|
@@ -2777,7 +2775,7 @@ diff --git a/js/src/wasm/WasmTextToBinary.cpp b/js/src/wasm/WasmTextToBinary.cpp
|
|
|
size_t lastMemoryIndex = 0;
|
|
|
size_t lastTableIndex = 0;
|
|
|
for (AstImport* imp : module->imports()) {
|
|
|
-@@ -4627,16 +4755,18 @@ ResolveModule(LifoAlloc& lifo, AstModule
|
|
|
+@@ -4631,16 +4759,18 @@ ResolveModule(LifoAlloc& lifo, AstModule
|
|
|
if (!r.registerFuncName(imp->name(), lastFuncIndex++))
|
|
|
return r.fail("duplicate import");
|
|
|
if (!r.resolveSignature(imp->funcType()))
|
|
@@ -2796,7 +2794,7 @@ diff --git a/js/src/wasm/WasmTextToBinary.cpp b/js/src/wasm/WasmTextToBinary.cpp
|
|
|
case DefinitionKind::Table:
|
|
|
if (!r.registerTableName(imp->name(), lastTableIndex++))
|
|
|
return r.fail("duplicate import");
|
|
|
-@@ -4646,19 +4776,21 @@ ResolveModule(LifoAlloc& lifo, AstModule
|
|
|
+@@ -4650,19 +4780,21 @@ ResolveModule(LifoAlloc& lifo, AstModule
|
|
|
|
|
|
for (AstFunc* func : module->funcs()) {
|
|
|
if (!r.resolveSignature(func->funcType()))
|
|
@@ -2819,7 +2817,7 @@ diff --git a/js/src/wasm/WasmTextToBinary.cpp b/js/src/wasm/WasmTextToBinary.cpp
|
|
|
if (table.imported)
|
|
|
continue;
|
|
|
if (!r.registerTableName(table.name, lastTableIndex++))
|
|
|
-@@ -4737,17 +4869,17 @@ EncodeExprList(Encoder& e, const AstExpr
|
|
|
+@@ -4741,17 +4873,17 @@ EncodeExprList(Encoder& e, const AstExpr
|
|
|
}
|
|
|
|
|
|
static bool
|
|
@@ -2838,7 +2836,7 @@ diff --git a/js/src/wasm/WasmTextToBinary.cpp b/js/src/wasm/WasmTextToBinary.cpp
|
|
|
if (!e.writeOp(Op::End))
|
|
|
return false;
|
|
|
|
|
|
-@@ -4947,17 +5079,17 @@ EncodeExtraConversionOperator(Encoder& e
|
|
|
+@@ -4951,17 +5083,17 @@ EncodeExtraConversionOperator(Encoder& e
|
|
|
#endif
|
|
|
|
|
|
static bool
|
|
@@ -2857,7 +2855,7 @@ diff --git a/js/src/wasm/WasmTextToBinary.cpp b/js/src/wasm/WasmTextToBinary.cpp
|
|
|
if (i.hasElse()) {
|
|
|
if (!e.writeOp(Op::Else))
|
|
|
return false;
|
|
|
-@@ -5141,17 +5273,17 @@ EncodeMemFill(Encoder& e, AstMemFill& s)
|
|
|
+@@ -5145,17 +5277,17 @@ EncodeMemFill(Encoder& e, AstMemFill& s)
|
|
|
e.writeOp(MiscOp::MemFill);
|
|
|
}
|
|
|
#endif
|
|
@@ -2876,7 +2874,7 @@ diff --git a/js/src/wasm/WasmTextToBinary.cpp b/js/src/wasm/WasmTextToBinary.cpp
|
|
|
switch (expr.kind()) {
|
|
|
case AstExprKind::Pop:
|
|
|
return true;
|
|
|
-@@ -5255,38 +5387,38 @@ EncodeTypeSection(Encoder& e, AstModule&
|
|
|
+@@ -5259,38 +5391,38 @@ EncodeTypeSection(Encoder& e, AstModule&
|
|
|
if (td->isFuncType()) {
|
|
|
AstFuncType* funcType = static_cast<AstFuncType*>(td);
|
|
|
if (!e.writeVarU32(uint32_t(TypeCode::Func)))
|
|
@@ -2922,7 +2920,7 @@ diff --git a/js/src/wasm/WasmTextToBinary.cpp b/js/src/wasm/WasmTextToBinary.cpp
|
|
|
}
|
|
|
|
|
|
e.finishSection(offset);
|
|
|
-@@ -5548,18 +5680,20 @@ EncodeFunctionBody(Encoder& e, AstFunc&
|
|
|
+@@ -5552,18 +5684,20 @@ EncodeFunctionBody(Encoder& e, Uint32Vec
|
|
|
{
|
|
|
size_t bodySizeAt;
|
|
|
if (!e.writePatchableVarU32(&bodySizeAt))
|
|
@@ -2941,14 +2939,14 @@ diff --git a/js/src/wasm/WasmTextToBinary.cpp b/js/src/wasm/WasmTextToBinary.cpp
|
|
|
return false;
|
|
|
|
|
|
for (AstExpr* expr : func.body()) {
|
|
|
+ if (!offsets->append(e.currentOffset()))
|
|
|
+ return false;
|
|
|
if (!EncodeExpr(e, *expr))
|
|
|
return false;
|
|
|
- }
|
|
|
-
|
|
|
diff --git a/js/src/wasm/WasmTypes.cpp b/js/src/wasm/WasmTypes.cpp
|
|
|
--- a/js/src/wasm/WasmTypes.cpp
|
|
|
+++ b/js/src/wasm/WasmTypes.cpp
|
|
|
-@@ -75,19 +75,20 @@ Val::writePayload(uint8_t* dst) const
|
|
|
+@@ -76,19 +76,20 @@ Val::writePayload(uint8_t* dst) const
|
|
|
case ValType::I16x8:
|
|
|
case ValType::I32x4:
|
|
|
case ValType::F32x4:
|
|
@@ -2970,7 +2968,7 @@ diff --git a/js/src/wasm/WasmTypes.cpp b/js/src/wasm/WasmTypes.cpp
|
|
|
{
|
|
|
switch (callee) {
|
|
|
case SymbolicAddress::FloorD:
|
|
|
-@@ -198,16 +199,17 @@ IsImmediateType(ValType vt)
|
|
|
+@@ -199,16 +200,17 @@ IsImmediateType(ValType vt)
|
|
|
return true;
|
|
|
case ValType::I8x16:
|
|
|
case ValType::I16x8:
|
|
@@ -2988,7 +2986,7 @@ diff --git a/js/src/wasm/WasmTypes.cpp b/js/src/wasm/WasmTypes.cpp
|
|
|
static unsigned
|
|
|
EncodeImmediateType(ValType vt)
|
|
|
{
|
|
|
-@@ -225,16 +227,17 @@ EncodeImmediateType(ValType vt)
|
|
|
+@@ -226,16 +228,17 @@ EncodeImmediateType(ValType vt)
|
|
|
return 4;
|
|
|
case ValType::I8x16:
|
|
|
case ValType::I16x8:
|
|
@@ -3006,7 +3004,7 @@ diff --git a/js/src/wasm/WasmTypes.cpp b/js/src/wasm/WasmTypes.cpp
|
|
|
/* static */ bool
|
|
|
FuncTypeIdDesc::isGlobal(const FuncType& funcType)
|
|
|
{
|
|
|
-@@ -694,33 +697,34 @@ DebugFrame::getLocal(uint32_t localIndex
|
|
|
+@@ -695,33 +698,34 @@ DebugFrame::getLocal(uint32_t localIndex
|
|
|
return true;
|
|
|
}
|
|
|
|
|
@@ -4161,7 +4159,7 @@ diff --git a/js/src/wasm/WasmValidate.cpp b/js/src/wasm/WasmValidate.cpp
|
|
|
diff --git a/js/src/wasm/WasmValidate.h b/js/src/wasm/WasmValidate.h
|
|
|
--- a/js/src/wasm/WasmValidate.h
|
|
|
+++ b/js/src/wasm/WasmValidate.h
|
|
|
-@@ -264,23 +264,31 @@ class Encoder
|
|
|
+@@ -261,23 +261,31 @@ class Encoder
|
|
|
MOZ_MUST_USE bool writeVarU64(uint64_t i) {
|
|
|
return writeVarU<uint64_t>(i);
|
|
|
}
|
|
@@ -4197,7 +4195,7 @@ diff --git a/js/src/wasm/WasmValidate.h b/js/src/wasm/WasmValidate.h
|
|
|
}
|
|
|
MOZ_MUST_USE bool writeOp(MiscOp op) {
|
|
|
static_assert(size_t(MiscOp::Limit) <= 256, "fits");
|
|
|
-@@ -542,23 +550,39 @@ class Decoder
|
|
|
+@@ -539,23 +547,39 @@ class Decoder
|
|
|
return readVarS<int32_t>(out);
|
|
|
}
|
|
|
MOZ_MUST_USE bool readVarU64(uint64_t* out) {
|
|
@@ -4241,7 +4239,7 @@ diff --git a/js/src/wasm/WasmValidate.h b/js/src/wasm/WasmValidate.h
|
|
|
return false;
|
|
|
op->b0 = u8;
|
|
|
if (MOZ_LIKELY(!IsPrefixByte(u8)))
|
|
|
-@@ -666,19 +690,16 @@ class Decoder
|
|
|
+@@ -663,19 +687,16 @@ class Decoder
|
|
|
uint64_t uncheckedReadVarU64() {
|
|
|
return uncheckedReadVarU<uint64_t>();
|
|
|
}
|
|
@@ -4261,7 +4259,7 @@ diff --git a/js/src/wasm/WasmValidate.h b/js/src/wasm/WasmValidate.h
|
|
|
: Op(uncheckedReadFixedU8() + UINT8_MAX);
|
|
|
}
|
|
|
void uncheckedReadFixedI8x16(I8x16* i8x16) {
|
|
|
-@@ -704,18 +725,27 @@ class Decoder
|
|
|
+@@ -701,18 +722,27 @@ class Decoder
|
|
|
};
|
|
|
|
|
|
// The local entries are part of function bodies and thus serialized by both
|