- Throwing errors is not available on fast API but can be done through the fallback to slow API.
- Not all parameter and return types are supported in fast API calls. For a full list, please look into v8-fast-api-calls.h.
- Each unique fast API function signature should be defined inside the node_external_reference.h file.
- To test fast APIs, run the tests in a loop with a decent iterations count to trigger V8 for optimization and to prefer the fast API over the slow one.
- The fast callback must be idempotent up to the point where error and fallback conditions are checked because otherwise, executing the slow callback might produce visible side effects twice.
Fallback to the slow path
true value to
fallback option will force V8 to run the slow path with the same arguments.
In V8, the options fallback struct is defined as FastApiCallbackOptions under the v8-fast-api-calls.h file.
Example of C++ fallback
- On the C++ side:
- Update node_external_reference.h
Since our implementation used int(const v8::FastApiCallbackOptions& options) signature, we need to add it to external references if it is not available and in