diff options
author | 2022-05-02 03:46:57 -0700 | |
---|---|---|
committer | 2022-05-02 03:46:57 -0700 | |
commit | 15466865e07b623dceeb51f54aa6b47eb4881b43 (patch) | |
tree | becff0515750264a6c560a65519ba9bf913be726 /src/javascript | |
parent | 125a4c747b24fde0cc7f19d23c5f6b7c78244329 (diff) | |
download | bun-15466865e07b623dceeb51f54aa6b47eb4881b43.tar.gz bun-15466865e07b623dceeb51f54aa6b47eb4881b43.tar.zst bun-15466865e07b623dceeb51f54aa6b47eb4881b43.zip |
add a comment
Diffstat (limited to 'src/javascript')
-rw-r--r-- | src/javascript/jsc/bindings/JSFFIFunction.h | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/javascript/jsc/bindings/JSFFIFunction.h b/src/javascript/jsc/bindings/JSFFIFunction.h index 1037785eb..8f65bf632 100644 --- a/src/javascript/jsc/bindings/JSFFIFunction.h +++ b/src/javascript/jsc/bindings/JSFFIFunction.h @@ -23,6 +23,19 @@ using namespace JSC; using FFIFunction = JSC::EncodedJSValue (*)(JSC::JSGlobalObject* globalObject, JSC::CallFrame* callFrame); +/** + * Call a C function with low overhead, modeled after JSC::JSNativeStdFunction + * + * The C function is expected to know how to get the arguments out of the JSC::CallFrame and + * return a JSC::EncodedJSValue. To do that, the argumentOffset is inlined at compile-time + * into Bun's binary and again inlined into the C function. + * + * This is used by functions compiled with TinyCC + * + * It was about 20% faster than using the JavaScriptCore C API for functions with 1 argument + * + * Note: there is no wrapper function here + */ class JSFFIFunction final : public JSC::JSFunction { public: using Base = JSFunction; |