( rawFn, view, argInfos, argOffsets, nargs, retGetter)
| 287 | // hot path reads a single variable per arg. This is admittedly pretty weird |
| 288 | // but it's the result of lots of perf-hunting. |
| 289 | function buildNumericWrapper( |
| 290 | rawFn, view, argInfos, argOffsets, nargs, retGetter) { |
| 291 | // `IsSBEligibleSignature` on the native side rejects 0-arg signatures, |
| 292 | // so this branch is unreachable today. It's kept as defense-in-depth |
| 293 | // for when that filter changes or for programmatic callers that hand a |
| 294 | // 0-arg signature through `wrapWithSharedBuffer` directly. |
| 295 | /* c8 ignore start */ |
| 296 | if (nargs === 0) { |
| 297 | if (retGetter === null) { |
| 298 | return function() { |
| 299 | if (arguments.length !== 0) { |
| 300 | throwFFIArgCountError(0, arguments.length); |
| 301 | } |
| 302 | rawFn(); |
| 303 | }; |
| 304 | } |
| 305 | return function() { |
| 306 | if (arguments.length !== 0) { |
| 307 | throwFFIArgCountError(0, arguments.length); |
| 308 | } |
| 309 | rawFn(); |
| 310 | return retGetter(view, 0, true); |
| 311 | }; |
| 312 | } |
| 313 | /* c8 ignore stop */ |
| 314 | if (nargs === 1) { |
| 315 | const i0 = argInfos[0]; |
| 316 | const o0 = argOffsets[0]; |
| 317 | if (retGetter === null) { |
| 318 | return function(a0) { |
| 319 | if (arguments.length !== 1) { |
| 320 | throwFFIArgCountError(1, arguments.length); |
| 321 | } |
| 322 | writeNumericArg(view, i0, o0, a0, 0); |
| 323 | rawFn(); |
| 324 | }; |
| 325 | } |
| 326 | return function(a0) { |
| 327 | if (arguments.length !== 1) { |
| 328 | throwFFIArgCountError(1, arguments.length); |
| 329 | } |
| 330 | writeNumericArg(view, i0, o0, a0, 0); |
| 331 | rawFn(); |
| 332 | return retGetter(view, 0, true); |
| 333 | }; |
| 334 | } |
| 335 | if (nargs === 2) { |
| 336 | const i0 = argInfos[0]; |
| 337 | const i1 = argInfos[1]; |
| 338 | const o0 = argOffsets[0]; |
| 339 | const o1 = argOffsets[1]; |
| 340 | if (retGetter === null) { |
| 341 | return function(a0, a1) { |
| 342 | if (arguments.length !== 2) { |
| 343 | throwFFIArgCountError(2, arguments.length); |
| 344 | } |
| 345 | writeNumericArg(view, i0, o0, a0, 0); |
| 346 | writeNumericArg(view, i1, o1, a1, 1); |
no test coverage detected
searching dependent graphs…