MCPcopy Index your code
hub / github.com/nodejs/node / TestGetArgHelper

Function TestGetArgHelper

deps/v8/test/mjsunit/wasm/exceptions-api.js:198–223  ·  view source on GitHub ↗
(types_str, types, values)

Source from the content-addressed store, hash-verified

196})();
197
198function TestGetArgHelper(types_str, types, values) {
199 let tag = new WebAssembly.Tag({parameters: types_str});
200 let exception = new WebAssembly.Exception(tag, values);
201 for (i = 0; i < types.length; ++i) {
202 assertEquals(exception.getArg(tag, i), values[i]);
203 }
204
205 let builder = new WasmModuleBuilder();
206 let sig = makeSig(types, []);
207 let tag_index = builder.addImportedTag("m", "t", sig);
208 let body = [];
209 for (i = 0; i < types.length; ++i) {
210 body.push(kExprLocalGet, i);
211 }
212 body.push(kExprThrow, tag_index);
213 builder.addFunction("throw", sig)
214 .addBody(body).exportFunc();
215 let instance = builder.instantiate({'m': {'t': tag}});
216 try {
217 instance.exports.throw(...values);
218 } catch (e) {
219 for (i = 0; i < types.length; ++i) {
220 assertEquals(e.getArg(tag, i), values[i]);
221 }
222 }
223}
224
225(function TestGetArg() {
226 print(arguments.callee.name);

Callers 1

exceptions-api.jsFile · 0.85

Calls 9

addImportedTagMethod · 0.95
addFunctionMethod · 0.95
instantiateMethod · 0.95
makeSigFunction · 0.70
assertEqualsFunction · 0.50
pushMethod · 0.45
exportFuncMethod · 0.45
addBodyMethod · 0.45
throwMethod · 0.45

Tested by

no test coverage detected