summaryrefslogtreecommitdiffstats
path: root/devtools/client/shared/vendor
diff options
context:
space:
mode:
Diffstat (limited to 'devtools/client/shared/vendor')
-rw-r--r--devtools/client/shared/vendor/WASMPARSER_UPGRADING4
-rw-r--r--devtools/client/shared/vendor/WasmDis.js54
-rw-r--r--devtools/client/shared/vendor/WasmParser.js81
3 files changed, 118 insertions, 21 deletions
diff --git a/devtools/client/shared/vendor/WASMPARSER_UPGRADING b/devtools/client/shared/vendor/WASMPARSER_UPGRADING
index 05a9e8abd3..f756c45dd2 100644
--- a/devtools/client/shared/vendor/WASMPARSER_UPGRADING
+++ b/devtools/client/shared/vendor/WASMPARSER_UPGRADING
@@ -1,13 +1,13 @@
# wasmparser version
-Current version is: 5.9.0
+Current version is: 5.11.0
# Upgrade process
1. Pull latest release from npm and extract WasmDis.js and WasmParser.js, e.g.
```
-curl https://registry.npmjs.org/wasmparser/-/wasmparser-5.9.0.tgz | tar -zx --strip-components 3 package/dist/cjs/{WasmDis,WasmParser}.js
+curl https://registry.npmjs.org/wasmparser/-/wasmparser-5.11.0.tgz | tar -zx --strip-components 3 package/dist/cjs/{WasmDis,WasmParser}.js
```
2. Remove reference to source maps (last line)
diff --git a/devtools/client/shared/vendor/WasmDis.js b/devtools/client/shared/vendor/WasmDis.js
index a412de6b39..be6849d1c8 100644
--- a/devtools/client/shared/vendor/WasmDis.js
+++ b/devtools/client/shared/vendor/WasmDis.js
@@ -256,7 +256,7 @@ var DefaultNameResolver = /** @class */ (function () {
return "$elem".concat(index);
};
DefaultNameResolver.prototype.getTagName = function (index, isRef) {
- return "$event".concat(index);
+ return "$tag".concat(index);
};
DefaultNameResolver.prototype.getFunctionName = function (index, isImport, isRef) {
return (isImport ? "$import" : "$func") + index;
@@ -476,6 +476,8 @@ var WasmDisassembler = /** @class */ (function () {
return "eq";
case -20 /* TypeKind.i31ref */:
return "i31";
+ case -23 /* TypeKind.exnref */:
+ return "exnref";
case -21 /* TypeKind.structref */:
return "struct";
case -22 /* TypeKind.arrayref */:
@@ -486,8 +488,13 @@ var WasmDisassembler = /** @class */ (function () {
return "noextern";
case -15 /* TypeKind.nullref */:
return "none";
+ case -12 /* TypeKind.nullexnref */:
+ return "noexnref";
}
};
+ WasmDisassembler.prototype.refTypeToString = function (typeIndex, nullable) {
+ return this.typeToString(new WasmParser_js_1.RefType(nullable ? -29 /* TypeKind.ref_null */ : -28 /* TypeKind.ref */, typeIndex));
+ };
WasmDisassembler.prototype.typeToString = function (type) {
switch (type.kind) {
case -1 /* TypeKind.i32 */:
@@ -508,6 +515,8 @@ var WasmDisassembler = /** @class */ (function () {
return "funcref";
case -17 /* TypeKind.externref */:
return "externref";
+ case -23 /* TypeKind.exnref */:
+ return "exnref";
case -18 /* TypeKind.anyref */:
return "anyref";
case -19 /* TypeKind.eqref */:
@@ -522,6 +531,8 @@ var WasmDisassembler = /** @class */ (function () {
return "nullfuncref";
case -14 /* TypeKind.nullexternref */:
return "nullexternref";
+ case -12 /* TypeKind.nullexnref */:
+ return "nullexnref";
case -15 /* TypeKind.nullref */:
return "nullref";
case -28 /* TypeKind.ref */:
@@ -647,6 +658,7 @@ var WasmDisassembler = /** @class */ (function () {
case 3 /* OperatorCode.loop */:
case 4 /* OperatorCode.if */:
case 6 /* OperatorCode.try */:
+ case 31 /* OperatorCode.try_table */:
if (this._labelMode !== LabelMode.Depth) {
var backrefLabel_1 = {
line: this._lines.length,
@@ -665,6 +677,31 @@ var WasmDisassembler = /** @class */ (function () {
this._backrefLabels.push(backrefLabel_1);
}
this.printBlockType(operator.blockType);
+ if (operator.tryTable) {
+ for (var i = 0; i < operator.tryTable.length; i++) {
+ this.appendBuffer(" (");
+ switch (operator.tryTable[i].kind) {
+ case WasmParser_js_1.CatchHandlerKind.Catch:
+ this.appendBuffer("catch ");
+ break;
+ case WasmParser_js_1.CatchHandlerKind.CatchRef:
+ this.appendBuffer("catch_ref ");
+ break;
+ case WasmParser_js_1.CatchHandlerKind.CatchAll:
+ this.appendBuffer("catch_all ");
+ break;
+ case WasmParser_js_1.CatchHandlerKind.CatchAllRef:
+ this.appendBuffer("catch_all_ref ");
+ break;
+ }
+ if (operator.tryTable[i].tagIndex != null) {
+ var tagName = this._nameResolver.getTagName(operator.tryTable[i].tagIndex, true);
+ this.appendBuffer("".concat(tagName, " "));
+ }
+ this.appendBuffer(this.useLabel(operator.tryTable[i].depth + 1));
+ this.appendBuffer(")");
+ }
+ }
break;
case 11 /* OperatorCode.end */:
if (this._labelMode === LabelMode.Depth) {
@@ -947,9 +984,17 @@ var WasmDisassembler = /** @class */ (function () {
break;
}
case 64278 /* OperatorCode.ref_cast */:
+ case 64276 /* OperatorCode.ref_test */: {
+ var refType = this.refTypeToString(operator.refType, false);
+ this.appendBuffer(" ".concat(refType));
+ break;
+ }
case 64279 /* OperatorCode.ref_cast_null */:
- case 64276 /* OperatorCode.ref_test */:
- case 64277 /* OperatorCode.ref_test_null */:
+ case 64277 /* OperatorCode.ref_test_null */: {
+ var refType = this.refTypeToString(operator.refType, true);
+ this.appendBuffer(" ".concat(refType));
+ break;
+ }
case 64257 /* OperatorCode.struct_new_default */:
case 64256 /* OperatorCode.struct_new */:
case 64263 /* OperatorCode.array_new_default */:
@@ -1496,7 +1541,6 @@ var WasmDisassembler = /** @class */ (function () {
case 5 /* OperatorCode.else */:
case 7 /* OperatorCode.catch */:
case 25 /* OperatorCode.catch_all */:
- case 10 /* OperatorCode.unwind */:
case 24 /* OperatorCode.delegate */:
this.decreaseIndent();
break;
@@ -1510,9 +1554,9 @@ var WasmDisassembler = /** @class */ (function () {
case 3 /* OperatorCode.loop */:
case 5 /* OperatorCode.else */:
case 6 /* OperatorCode.try */:
+ case 31 /* OperatorCode.try_table */:
case 7 /* OperatorCode.catch */:
case 25 /* OperatorCode.catch_all */:
- case 10 /* OperatorCode.unwind */:
this.increaseIndent();
break;
}
diff --git a/devtools/client/shared/vendor/WasmParser.js b/devtools/client/shared/vendor/WasmParser.js
index 68397b8eeb..efa5b9a4e6 100644
--- a/devtools/client/shared/vendor/WasmParser.js
+++ b/devtools/client/shared/vendor/WasmParser.js
@@ -29,7 +29,7 @@ var __extends = (this && this.__extends) || (function () {
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
-exports.bytesToString = exports.BinaryReader = exports.Int64 = exports.TagAttribute = exports.ElementMode = exports.DataMode = exports.BinaryReaderState = exports.NameType = exports.LinkingType = exports.RelocType = exports.RefType = exports.Type = exports.FuncDef = exports.FieldDef = exports.TypeKind = exports.ExternalKind = exports.OperatorCodeNames = exports.OperatorCode = exports.SectionCode = void 0;
+exports.bytesToString = exports.BinaryReader = exports.Int64 = exports.TagAttribute = exports.ElementMode = exports.DataMode = exports.BinaryReaderState = exports.NameType = exports.LinkingType = exports.RelocType = exports.CatchHandler = exports.CatchHandlerKind = exports.RefType = exports.Type = exports.FuncDef = exports.FieldDef = exports.TypeKind = exports.ExternalKind = exports.OperatorCodeNames = exports.OperatorCode = exports.SectionCode = void 0;
// See https://github.com/WebAssembly/design/blob/master/BinaryEncoding.md
var WASM_MAGIC_NUMBER = 0x6d736100;
var WASM_SUPPORTED_EXPERIMENTAL_VERSION = 0xd;
@@ -64,7 +64,7 @@ var OperatorCode;
OperatorCode[OperatorCode["catch"] = 7] = "catch";
OperatorCode[OperatorCode["throw"] = 8] = "throw";
OperatorCode[OperatorCode["rethrow"] = 9] = "rethrow";
- OperatorCode[OperatorCode["unwind"] = 10] = "unwind";
+ OperatorCode[OperatorCode["throw_ref"] = 10] = "throw_ref";
OperatorCode[OperatorCode["end"] = 11] = "end";
OperatorCode[OperatorCode["br"] = 12] = "br";
OperatorCode[OperatorCode["br_if"] = 13] = "br_if";
@@ -82,6 +82,7 @@ var OperatorCode;
OperatorCode[OperatorCode["drop"] = 26] = "drop";
OperatorCode[OperatorCode["select"] = 27] = "select";
OperatorCode[OperatorCode["select_with_type"] = 28] = "select_with_type";
+ OperatorCode[OperatorCode["try_table"] = 31] = "try_table";
OperatorCode[OperatorCode["local_get"] = 32] = "local_get";
OperatorCode[OperatorCode["local_set"] = 33] = "local_set";
OperatorCode[OperatorCode["local_tee"] = 34] = "local_tee";
@@ -597,8 +598,8 @@ var OperatorCode;
OperatorCode[OperatorCode["f64x2_relaxed_min"] = 1036559] = "f64x2_relaxed_min";
OperatorCode[OperatorCode["f64x2_relaxed_max"] = 1036560] = "f64x2_relaxed_max";
OperatorCode[OperatorCode["i16x8_relaxed_q15mulr_s"] = 1036561] = "i16x8_relaxed_q15mulr_s";
- OperatorCode[OperatorCode["i16x8_dot_i8x16_i7x16_s"] = 1036562] = "i16x8_dot_i8x16_i7x16_s";
- OperatorCode[OperatorCode["i32x4_dot_i8x16_i7x16_add_s"] = 1036563] = "i32x4_dot_i8x16_i7x16_add_s";
+ OperatorCode[OperatorCode["i16x8_relaxed_dot_i8x16_i7x16_s"] = 1036562] = "i16x8_relaxed_dot_i8x16_i7x16_s";
+ OperatorCode[OperatorCode["i32x4_relaxed_dot_i8x16_i7x16_add_s"] = 1036563] = "i32x4_relaxed_dot_i8x16_i7x16_add_s";
// GC proposal.
OperatorCode[OperatorCode["struct_new"] = 64256] = "struct_new";
OperatorCode[OperatorCode["struct_new_default"] = 64257] = "struct_new_default";
@@ -643,7 +644,7 @@ exports.OperatorCodeNames = [
"catch",
"throw",
"rethrow",
- "unwind",
+ "throw_ref",
"end",
"br",
"br_if",
@@ -664,7 +665,7 @@ exports.OperatorCodeNames = [
"select",
undefined,
undefined,
- undefined,
+ "try_table",
"local.get",
"local.set",
"local.tee",
@@ -1187,8 +1188,8 @@ exports.OperatorCodeNames = [
"f64x2.relaxed_min",
"f64x2.relaxed_max",
"i16x8.relaxed_q15mulr_s",
- "i16x8.dot_i8x16_i7x16_s",
- "i32x4.dot_i8x16_i7x16_add_s",
+ "i16x8.relaxed_dot_i8x16_i7x16_s",
+ "i32x4.relaxed_dot_i8x16_i7x16_add_s",
].forEach(function (s, i) {
exports.OperatorCodeNames[0xfd000 | i] = s;
});
@@ -1297,9 +1298,9 @@ exports.OperatorCodeNames = [
"array.init_data",
"array.init_elem",
"ref.test",
- "ref.test null",
+ "ref.test",
+ "ref.cast",
"ref.cast",
- "ref.cast null",
"br_on_cast",
"br_on_cast_fail",
"any.convert_extern",
@@ -1328,6 +1329,7 @@ var TypeKind;
TypeKind[TypeKind["v128"] = -5] = "v128";
TypeKind[TypeKind["i8"] = -8] = "i8";
TypeKind[TypeKind["i16"] = -9] = "i16";
+ TypeKind[TypeKind["nullexnref"] = -12] = "nullexnref";
TypeKind[TypeKind["nullfuncref"] = -13] = "nullfuncref";
TypeKind[TypeKind["nullref"] = -15] = "nullref";
TypeKind[TypeKind["nullexternref"] = -14] = "nullexternref";
@@ -1338,6 +1340,7 @@ var TypeKind;
TypeKind[TypeKind["i31ref"] = -20] = "i31ref";
TypeKind[TypeKind["structref"] = -21] = "structref";
TypeKind[TypeKind["arrayref"] = -22] = "arrayref";
+ TypeKind[TypeKind["exnref"] = -23] = "exnref";
TypeKind[TypeKind["ref"] = -28] = "ref";
TypeKind[TypeKind["ref_null"] = -29] = "ref_null";
TypeKind[TypeKind["func"] = -32] = "func";
@@ -1388,6 +1391,7 @@ var Type = exports.Type = /** @class */ (function () {
// Convenience singletons.
Type.funcref = new Type(-16 /* TypeKind.funcref */);
Type.externref = new Type(-17 /* TypeKind.externref */);
+ Type.exnref = new Type(-23 /* TypeKind.exnref */);
return Type;
}());
var RefType = /** @class */ (function (_super) {
@@ -1411,6 +1415,19 @@ var RefType = /** @class */ (function (_super) {
return RefType;
}(Type));
exports.RefType = RefType;
+var CatchHandlerKind;
+(function (CatchHandlerKind) {
+ CatchHandlerKind[CatchHandlerKind["Catch"] = 0] = "Catch";
+ CatchHandlerKind[CatchHandlerKind["CatchRef"] = 1] = "CatchRef";
+ CatchHandlerKind[CatchHandlerKind["CatchAll"] = 2] = "CatchAll";
+ CatchHandlerKind[CatchHandlerKind["CatchAllRef"] = 3] = "CatchAllRef";
+})(CatchHandlerKind = exports.CatchHandlerKind || (exports.CatchHandlerKind = {}));
+var CatchHandler = /** @class */ (function () {
+ function CatchHandler() {
+ }
+ return CatchHandler;
+}());
+exports.CatchHandler = CatchHandler;
var RelocType;
(function (RelocType) {
RelocType[RelocType["FunctionIndex_LEB"] = 0] = "FunctionIndex_LEB";
@@ -1814,11 +1831,13 @@ var BinaryReader = /** @class */ (function () {
case -9 /* TypeKind.i16 */:
case -16 /* TypeKind.funcref */:
case -17 /* TypeKind.externref */:
+ case -23 /* TypeKind.exnref */:
case -18 /* TypeKind.anyref */:
case -19 /* TypeKind.eqref */:
case -20 /* TypeKind.i31ref */:
case -14 /* TypeKind.nullexternref */:
case -13 /* TypeKind.nullfuncref */:
+ case -12 /* TypeKind.nullexnref */:
case -21 /* TypeKind.structref */:
case -22 /* TypeKind.arrayref */:
case -15 /* TypeKind.nullref */:
@@ -1989,6 +2008,7 @@ var BinaryReader = /** @class */ (function () {
case -9 /* TypeKind.i16 */:
case -16 /* TypeKind.funcref */:
case -17 /* TypeKind.externref */:
+ case -23 /* TypeKind.exnref */:
case -18 /* TypeKind.anyref */:
case -19 /* TypeKind.eqref */:
this.result = {
@@ -2936,8 +2956,8 @@ var BinaryReader = /** @class */ (function () {
case 1036559 /* OperatorCode.f64x2_relaxed_min */:
case 1036560 /* OperatorCode.f64x2_relaxed_max */:
case 1036561 /* OperatorCode.i16x8_relaxed_q15mulr_s */:
- case 1036562 /* OperatorCode.i16x8_dot_i8x16_i7x16_s */:
- case 1036563 /* OperatorCode.i32x4_dot_i8x16_i7x16_add_s */:
+ case 1036562 /* OperatorCode.i16x8_relaxed_dot_i8x16_i7x16_s */:
+ case 1036563 /* OperatorCode.i32x4_relaxed_dot_i8x16_i7x16_add_s */:
break;
default:
this.error = new Error("Unknown operator: 0x".concat(code.toString(16).padStart(4, "0")));
@@ -3109,7 +3129,7 @@ var BinaryReader = /** @class */ (function () {
}
break;
}
- var code, blockType, selectType, refType, brDepth, brTable, relativeDepth, funcIndex, typeIndex, tableIndex, localIndex, globalIndex, tagIndex, memoryAddress, literal, reserved;
+ var code, blockType, selectType, refType, brDepth, brTable, tryTable, relativeDepth, funcIndex, typeIndex, tableIndex, localIndex, globalIndex, tagIndex, memoryAddress, literal, reserved;
if (this.state === 26 /* BinaryReaderState.INIT_EXPRESSION_OPERATOR */ &&
this._sectionId === 9 /* SectionCode.Element */ &&
isExternvalElementSegmentType(this._segmentType)) {
@@ -3171,6 +3191,38 @@ var BinaryReader = /** @class */ (function () {
case 8 /* OperatorCode.throw */:
tagIndex = this.readVarInt32();
break;
+ case 31 /* OperatorCode.try_table */:
+ blockType = this.readType();
+ var tableCount = this.readVarUint32();
+ if (!this.hasBytes(2 * tableCount)) {
+ // We need at least (2 * tableCount) bytes
+ this._pos = pos;
+ return false;
+ }
+ tryTable = [];
+ for (var i = 0; i < tableCount; i++) {
+ if (!this.hasVarIntBytes()) {
+ this._pos = pos;
+ return false;
+ }
+ var kind = this.readVarUint32();
+ var tagIndex;
+ if (kind == CatchHandlerKind.Catch ||
+ kind == CatchHandlerKind.CatchRef) {
+ if (!this.hasVarIntBytes()) {
+ this._pos = pos;
+ return false;
+ }
+ tagIndex = this.readVarUint32();
+ }
+ if (!this.hasVarIntBytes()) {
+ this._pos = pos;
+ return false;
+ }
+ var depth = this.readVarUint32();
+ tryTable.push({ kind: kind, depth: depth, tagIndex: tagIndex });
+ }
+ break;
case 208 /* OperatorCode.ref_null */:
refType = this.readHeapType();
break;
@@ -3278,7 +3330,6 @@ var BinaryReader = /** @class */ (function () {
case 0 /* OperatorCode.unreachable */:
case 1 /* OperatorCode.nop */:
case 5 /* OperatorCode.else */:
- case 10 /* OperatorCode.unwind */:
case 11 /* OperatorCode.end */:
case 15 /* OperatorCode.return */:
case 25 /* OperatorCode.catch_all */:
@@ -3415,6 +3466,7 @@ var BinaryReader = /** @class */ (function () {
case 209 /* OperatorCode.ref_is_null */:
case 212 /* OperatorCode.ref_as_non_null */:
case 211 /* OperatorCode.ref_eq */:
+ case 10 /* OperatorCode.throw_ref */:
break;
default:
this.error = new Error("Unknown operator: ".concat(code));
@@ -3430,6 +3482,7 @@ var BinaryReader = /** @class */ (function () {
srcType: undefined,
brDepth: brDepth,
brTable: brTable,
+ tryTable: tryTable,
relativeDepth: relativeDepth,
tableIndex: tableIndex,
funcIndex: funcIndex,