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

Function wasmS128Const

deps/v8/test/mjsunit/wasm/wasm-module-builder.js:2484–2506  ·  view source on GitHub ↗
(f)

Source from the content-addressed store, hash-verified

2482}
2483
2484function wasmS128Const(f) {
2485 // Write in little-endian order at offset 0.
2486 if (Array.isArray(f)) {
2487 if (f.length != 16) throw new Error('S128Const needs 16 bytes');
2488 return [kSimdPrefix, kExprS128Const, ...f];
2489 }
2490 let result = [kSimdPrefix, kExprS128Const];
2491 if (arguments.length === 2) {
2492 for (let j = 0; j < 2; j++) {
2493 data_view.setFloat64(0, arguments[j], true);
2494 for (let i = 0; i < 8; i++) result.push(byte_view[i]);
2495 }
2496 } else if (arguments.length === 4) {
2497 for (let j = 0; j < 4; j++) {
2498 data_view.setFloat32(0, arguments[j], true);
2499 for (let i = 0; i < 4; i++) result.push(byte_view[i]);
2500 }
2501 } else {
2502 throw new Error('S128Const needs an array of bytes, or two f64 values, ' +
2503 'or four f32 values');
2504 }
2505 return result;
2506}
2507
2508let wasmEncodeHeapType = function(type) {
2509 let result = wasmSignedLeb(type.heap_type, kMaxVarInt32Size);

Callers 11

GenerateValuesOfTypeFunction · 0.85
MakeBodyFunction · 0.85
ShuffleTestFunction · 0.85
regress-13732.jsFile · 0.85
GenerateInputFunction · 0.85

Calls 1

pushMethod · 0.45

Tested by

no test coverage detected