MCPcopy Create free account
hub / github.com/nodejs/node / CheckValuesOfType

Function CheckValuesOfType

deps/v8/test/mjsunit/wasm/cont-bind.js:70–124  ·  view source on GitHub ↗
(types, block_sig, simd_local)

Source from the content-addressed store, hash-verified

68}
69
70function CheckValuesOfType(types, block_sig, simd_local) {
71 let body = [
72 kExprBlock, block_sig, // OK.
73 kExprBlock, block_sig, // Trap.
74 ];
75 for (type of types) {
76 switch (type) {
77 case kWasmI32:
78 body.push(...wasmI32Const(12),
79 kExprI32Eq,
80 kExprBrIf, 1);
81 break;
82 case kWasmI64:
83 body.push(...wasmI64Const(34),
84 kExprI64Eq,
85 kExprBrIf, 1);
86 break;
87 case kWasmF32:
88 body.push(...wasmF32Const(56),
89 kExprF32Eq,
90 kExprBrIf, 1);
91 break;
92 case kWasmF64:
93 body.push(...wasmF64Const(56),
94 kExprF64Eq,
95 kExprBrIf, 1);
96 break;
97 case kWasmS128:
98 body.push(
99 kExprLocalTee, simd_local,
100 kSimdPrefix, kExprF64x2ExtractLane, 0,
101 ...wasmF64Const(Math.PI),
102 kExprF64Eq,
103 kExprBrIf, 1,
104 kExprLocalGet, simd_local,
105 kSimdPrefix, kExprF64x2ExtractLane, 0,
106 ...wasmF64Const(Math.E),
107 kExprF64Eq,
108 kExprBrIf, 1);
109 break;
110 case kWasmExternRef:
111 // Just save it, check it outside of the function.
112 body.push(kExprGlobalSet, g_ref.index,
113 kExprBr, 1);
114 break;
115 }
116 }
117 body.push(
118 kExprBr, 1, // All equal, escape to outer block.
119 kExprEnd,
120 kExprUnreachable,
121 kExprEnd,
122 );
123 return body;
124}
125
126let gc_index = builder.addImport("m", "gc", kSig_v_v);
127let identity_i32 = builder.addFunction("identity_i32", kSig_i_i)

Callers 1

cont-bind.jsFile · 0.85

Calls 5

wasmI64ConstFunction · 0.85
wasmI32ConstFunction · 0.70
wasmF32ConstFunction · 0.70
wasmF64ConstFunction · 0.70
pushMethod · 0.45

Tested by

no test coverage detected