deno
deno copied to clipboard
[wip] feat(ops): reland V8 Fast Calls
Relands auto fast api template generation for ops.
This patch seems to be triggering a race condition in V8. Crashes occur at Context::new and Isolate::dispose. Seems related to https://github.com/denoland/rusty_v8/issues/714
Any idea if this can be merged now or is it still flaking?
Regarding the op_func.call(...args) usage: Would the normal calling convention of ops.op_func(...args) work if the ops object was created as an External from the OpCtx? (IIRC it's that pointer that we need for ops, right?) ie. Does the "this" object matter for Fast API data receiving?
I would presume it does not matter and I remember reading something about how there's a "Holder" object for Fast API functions which is not the same thing as the "this" argument which is sometimes called "holder" in V8 code. Anyway, there are two possibilities that I can see:
- Either the
thisargument is relevant, in which caseopsshould be created as av8::Externalto retain theops.op_func(...args)calling convention. - Or (more likely) the
thisargument is irrelevant, in which case I would presume that Fast Calls get thedataobject anyway, and theops.op_func.call(...args)calling convention is unnecessary.
@divy I presume you've tested that the .call() method usage is truly necessary? How hard would it be to test the ops as v8::External case?
I finally managed to understand that the fast bindings are generated to an extra function bound into the original function but... Why? Does the references snapshotting somehow not work with direct binding to the normal op call function?
This is awesome - great work @littledivy