Bug 1889091 - Part 3: Specialize calls to native functions with variadic parameters...
commit71c78973ac64aaefea1f1fd4b677e0bf07a00830
authorAndré Bargull <andre.bargull@gmail.com>
Sat, 6 Apr 2024 13:38:29 +0000 (6 13:38 +0000)
committerAndré Bargull <andre.bargull@gmail.com>
Sat, 6 Apr 2024 13:38:29 +0000 (6 13:38 +0000)
tree1e7eb30b6587c103a4f91c1b796c298ca0127298
parent64035a67a24d9ae8837d37125a4688197bd7ac64
Bug 1889091 - Part 3: Specialize calls to native functions with variadic parameters. r=jandem

The existing `LApplyArgsGeneric` and friends instructions push the arguments in
preparation for a JIT to JIT call, which means when calling a native function,
we first have reorder the arguments in `jit::InvokeFunction` before calling the
native function. This is slow when the number of arguments exceeds in inline
stack space of `GenericArgsBase::v_`, i.e. there are more than six arguments,
because we first have to heap allocate enough space to hold the arguments.

This commit adds specializations for `LApplyArgsGeneric` and other instructions
when the target function is known to be a native function. These new instructions
push the arguments in the correct order for JIT to C++ calls, so we no longer
have to reorder the arguments.

Depends on D206352

Differential Revision: https://phabricator.services.mozilla.com/D206353
18 files changed:
js/src/jit-test/tests/ion/apply-native-arguments-object.js [new file with mode: 0644]
js/src/jit-test/tests/ion/apply-native-arguments.js [new file with mode: 0644]
js/src/jit-test/tests/ion/apply-native-array.js [new file with mode: 0644]
js/src/jit-test/tests/ion/apply-native-spreadcall-arguments.js [new file with mode: 0644]
js/src/jit-test/tests/ion/apply-native-spreadcall-array.js [new file with mode: 0644]
js/src/jit-test/tests/ion/apply-native-spreadcall-rest.js [new file with mode: 0644]
js/src/jit-test/tests/ion/apply-native-spreadnew-arguments.js [new file with mode: 0644]
js/src/jit-test/tests/ion/apply-native-spreadnew-array.js [new file with mode: 0644]
js/src/jit-test/tests/ion/apply-native-spreadnew-newtarget.js [new file with mode: 0644]
js/src/jit-test/tests/ion/apply-native-spreadnew-rest.js [new file with mode: 0644]
js/src/jit/CodeGenerator.cpp
js/src/jit/CodeGenerator.h
js/src/jit/LIROps.yaml
js/src/jit/Lowering.cpp
js/src/jit/VMFunctionList-inl.h
js/src/jit/VMFunctions.cpp
js/src/jit/VMFunctions.h
js/src/jit/shared/LIR-shared.h