summaryrefslogtreecommitdiff
path: root/core/ops_json.rs
AgeCommit message (Collapse)Author
2022-03-14feat(core): codegen ops (#13861)Divy Srivastava
Co-authored-by: Aaron O'Mullan <aaron.omullan@gmail.com>
2022-01-07chore: update copyright to 2022 (#13306)Ryan Dahl
Co-authored-by: Erfan Safari <erfanshield@outlook.com>
2021-12-29cleanup(core): use Extensions to register ops (#13224)Aaron O'Mullan
In examples and tests
2021-11-25feat(core): Add ability to "ref" and "unref" pending ops (#12889)Bartek Iwańczuk
This commit adds an ability to "ref" or "unref" pending ops. Up to this point Deno had a notion of "async ops" and "unref async ops"; the former keep event loop alive, while the latter do not block event loop from finishing. It was not possible to change between op types after dispatching, one had to decide which type to use before dispatch. Instead of storing ops in two separate "FuturesUnordered" collections, now ops are stored in a single collection, with supplemental "HashSet" storing ids of promises that were "unrefed". Two APIs were added to "Deno.core": "Deno.core.refOp(promiseId)" which allows to mark promise id to be "refed" and keep event loop alive (the default behavior) "Deno.core.unrefOp(promiseId)" which allows to mark promise id as "unrefed" which won't block event loop from exiting
2021-11-16refactor: re-export anyhow from deno_core (#12777)Ryan Dahl
2021-10-20feat(serde_v8): allow all values to deserialize to unit type (#12504)Aaron O'Mullan
2021-10-17fix(core): poll async ops eagerly (#12385)Bert Belder
Currently all async ops are polled lazily, which means that op initialization code is postponed until control is yielded to the event loop. This has some weird consequences, e.g. ```js let listener = Deno.listen(...); let conn_promise = listener.accept(); listener.close(); // `BadResource` is thrown. A reasonable error would be `Interrupted`. let conn = await conn_promise; ``` JavaScript promises are expected to be eagerly evaluated. This patch makes ops actually do that.
2021-10-10refactor(metrics): move to core (#12386)Aaron O'Mullan
Avoids overhead of wrapping ops (and allocs when inspecting async-op futures)
2021-08-31feat(core): facilitate op-disabling middleware (#11858)Aaron O'Mullan
* feat(core): facilitate op-disabling middleware By providing `void_op_sync()` and `void_op_async() as well as `core/examples/disable_ops.rs`
2021-06-25fix(runtime/signal): use op_async_unref for op_signal_poll (#11097)Yoshiya Hinosawa
2021-06-23docs(core): Use op name in example (#11094)Maxime Guerreiro
The first argument to opSync/opAsync is the op name. In the examples, the name is 'hello', and so it should be the first argument.
2021-06-22refactor: unify JavaScript script execution method (#11043)Bartek Iwańczuk
This commit renames "JsRuntime::execute" to "JsRuntime::execute_script". Additionally same renames were applied to methods on "deno_runtime::Worker" and "deno_runtime::WebWorker". A new macro was added to "deno_core" called "located_script_name" which returns the name of Rust file alongside line no and col no of that call site. This macro is useful in combination with "JsRuntime::execute_script" and allows to provide accurate place where "one-off" JavaScript scripts are executed for internal runtime functions. Co-authored-by: Nayeem Rahman <nayeemrmn99@gmail.com>
2021-05-26refactor: move JsRuntimeInspector to deno_core (#10763)Bartek Iwańczuk
This commit moves implementation of "JsRuntimeInspector" to "deno_core" crate. To achieve that following changes were made: * "Worker" and "WebWorker" no longer own instance of "JsRuntimeInspector", instead it is now owned by "deno_core::JsRuntime". * Consequently polling of inspector is no longer done in "Worker"/"WebWorker", instead it's done in "deno_core::JsRuntime::poll_event_loop". * "deno_core::JsRuntime::poll_event_loop" and "deno_core::JsRuntime::run_event_loop", now accept "wait_for_inspector" boolean that tells if event loop should still be "pending" if there are active inspector sessions - this change fixes the problem that inspector disconnects from the frontend and process exits once the code has stopped executing.
2021-05-06refactor(ops): replace `ZeroCopyBuf` arg by 2nd generic deserializable arg ↵Aaron O'Mullan
(#10448)
2021-04-25refactor(core): move op cache sync responsibility to rust space (#10340)Aaron O'Mullan
Even if bootstrapping the JS runtime is low level, it's an abstraction leak of core to require users to call `Deno.core.ops()` in JS space. So instead we're introducing a `JsRuntime::sync_ops_cache()` method, once we have runtime extensions a new runtime will ensure the ops cache is setup (for the provided extensions) and then loading/unloading plugins should be the only operations that require op cache syncs
2021-04-21refactor(core): simplify error handling (#10297)Aaron O'Mullan
- register builtin v8 errors in core.js so consumers don't have to - remove complexity of error args handling (consumers must provide a constructor with custom args, core simply provides msg arg)
2021-04-18cleanup(core): simplify op_async(), drop need for try_dispatch_op() (#10240)Aaron O'Mullan
2021-04-12refactor(deno): remove concept of bin & json ops (#10145)Aaron O'Mullan
2021-04-11core: avoid async op future reboxing to bundle PromiseId (#10123)Aaron O'Mullan
2021-04-09fix: async op error stacktraces (#10080)Nayeem Rahman
Co-authored-by: Aaron O'Mullan <aaron.omullan@gmail.com>
2021-04-02refactor(ops): remove variadic buffers (#9944)Aaron O'Mullan
2021-03-31refactor: new optimized op-layer using serde_v8 (#9843)Aaron O'Mullan
- Improves op performance. - Handle op-metadata (errors, promise IDs) explicitly in the op-layer vs per op-encoding (aka: out-of-payload). - Remove shared queue & custom "asyncHandlers", all async values are returned in batches via js_recv_cb. - The op-layer should be thought of as simple function calls with little indirection or translation besides the conceptually straightforward serde_v8 bijections. - Preserve concepts of json/bin/min as semantic groups of their inputs/outputs instead of their op-encoding strategy, preserving these groups will also facilitate partial transitions over to v8 Fast API for the "min" and "bin" groups
2021-03-20refactor: Move bin ops to deno_core and unify logic with json ops (#9457)Inteon
This commit moves implementation of bin ops to "deno_core" crates as well as unifying logic between bin ops and json ops to reuse as much code as possible (both in Rust and JavaScript).