summaryrefslogtreecommitdiff
path: root/core
AgeCommit message (Collapse)Author
2022-08-11perf(ops): Monomorphic sync op calls (#15337)Aapo Alasuutari
Welcome to better optimised op calls! Currently opSync is called with parameters of every type and count. This most definitely makes the call megamorphic. Additionally, it seems that spread params leads to V8 not being able to optimise the calls quite as well (apparently Fast Calls cannot be used with spread params). Monomorphising op calls should lead to some improved performance. Now that unwrapping of sync ops results is done on Rust side, this is pretty simple: ``` opSync("op_foo", param1, param2); // -> turns to ops.op_foo(param1, param2); ``` This means sync op calls are now just directly calling the native binding function. When V8 Fast API Calls are enabled, this will enable those to be called on the optimised path. Monomorphising async ops likely requires using callbacks and is left as an exercise to the reader.
2022-08-11refactor(core): unwrap sync ops in rust (#15449)Nayeem Rahman
2022-08-10feat(core): Add support for async ops in realms (#14734)Andreu Botella
Pull request #14019 enabled initial support for realms, but it did not include support for async ops anywhere other than the main realm. The main issue was that the `js_recv_cb` callback, which resolves promises corresponding to async ops, was only set for the main realm, so async ops in other realms would never resolve. Furthermore, promise ID's are specific to each realm, which meant that async ops from other realms would result in a wrong promise from the main realm being resolved. This change creates a `ContextState` struct, similar to `JsRuntimeState` but stored in a slot of each `v8::Context`, which contains a `js_recv_cb` callback for each realm. Combined with a new list of known realms, which stores them as `v8::Weak<v8::Context>`, and a change in the `#[op]` macro to pass the current context to `queue_async_op`, this makes it possible to send the results of promises for different realms to their realm, and prevent the ID's from getting mixed up. Additionally, since promise ID's are no longer unique to the isolate, having a single set of unrefed ops doesn't work. This change therefore also moves `unrefed_ops` from `JsRuntimeState` to `ContextState`, and adds the lengths of the unrefed op sets for all known realms to get the total number of unrefed ops to compare in the event loop. Co-authored-by: Luis Malheiro <luismalheiro@gmail.com>
2022-08-05chore: forward v1.24.2 release commit to main (#15410)denobot
2022-08-03core: remove heapStats type definition (#15393)Zach
2022-08-01refactor(core/error): use evaluated call sites for formatting (#15369)Nayeem Rahman
2022-07-31core: Add types for `Deno.core.print()` (#15283)Zicklag
2022-07-30fix(core): BorrowMutError in nested error (#15352)Bartek Iwańczuk
2022-07-29Forward 1.24.1 to main (#15333) (#15336)Colin Ihrig
1.24.1 (#15333) Co-authored-by: cjihrig <cjihrig@users.noreply.github.com>
2022-07-28serde_v8: improvements to avoid hitting unimplemented codepaths (#13915)Arthur Silva
2022-07-27chore: upgrade rusty_v8 to 0.47.1 (#15324)Bartek Iwańczuk
2022-07-25refactor(core): remove unneeded ops for uncaughtException (#15296)Bartek Iwańczuk
2022-07-23fix: unhandledrejection handling for sync throw in top level (#15279)Bartek Iwańczuk
Fixes an edge in "unhandledrejection" event that prevent synchronous errors being surfaced when throw from a top-level scope.
2022-07-22Revert "feat(ops): V8 Fast Calls (#15122)" (#15276)Divy Srivastava
This reverts commit 03dc3b8972f460e40d0b75fc3207cae9fe4f60da.
2022-07-22feat(ops): V8 Fast Calls (#15122)Divy Srivastava
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2022-07-211.24.0 (#15262)denobot
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2022-07-20Reland "feat: add "unhandledrejection" event support" (#15211)Bartek Iwańczuk
2022-07-19chore: upgrade rusty_v8 to 0.47.0 (#15247)Bartek Iwańczuk
2022-07-19feat: emit files on demand and fix racy emit (#15220)David Sherret
2022-07-18reland: "fix(core): unhandled rejection in top-level scope" (#15236)Bartek Iwańczuk
Reland #15204
2022-07-18feat: import.meta.resolve() (#15074)Bartek Iwańczuk
This commit adds new "import.meta.resolve()" API which allows to resolve specifiers relative to the module the API is called in. This API supports resolving using import maps.
2022-07-18Revert "fix(core): unhandled rejection in top-level scope (#15204)" (#15226)Bartek Iwańczuk
This reverts commit 48a7312f3871e3b76c51eb0143ca1c48da43b20c.
2022-07-15Revert "feat: add "unhandledrejection" event support (#12994) (#15080)" (#15210)Bartek Iwańczuk
This reverts commit 1a7259b04b7229f6350a7a7c21b50497b5c80c17.
2022-07-14feat: add "unhandledrejection" event support (#12994) (#15080)Bartek Iwańczuk
Relanding #12994 This commit adds support for "unhandledrejection" event. This event will trigger event listeners registered using: "globalThis.addEventListener("unhandledrejection") "globalThis.onunhandledrejection" This is done by registering a default handler using "Deno.core.setPromiseRejectCallback" that allows to handle rejected promises in JavaScript instead of Rust. This commit will make it possible to polyfill "process.on("unhandledRejection")" in the Node compat layer. Co-authored-by: Colin Ihrig <cjihrig@gmail.com>
2022-07-14fix(core): unhandled rejection in top-level scope (#15204)Bartek Iwańczuk
Update "deno_core" to not forward rejection of top level module if it was already handled by appropriate handlers. Co-authored-by: Colin Ihrig cjihrig@gmail.com
2022-07-14chore: upgrade rusty_v8 to v0.46.0 (#15200)Bartek Iwańczuk
2022-07-12chore: forward v1.23.4 release commit to main (#15172)Colin Ihrig
1.23.4 (#15168) Co-authored-by: cjihrig <cjihrig@users.noreply.github.com> Co-authored-by: denobot <33910674+denobot@users.noreply.github.com> Co-authored-by: cjihrig <cjihrig@users.noreply.github.com>
2022-07-11fix: upgrade deno_ast to 0.17 (#15152)David Sherret
2022-07-11chore(web, worker): Use `DetachedBuffer` for `postMessage` ops (#15133)Andreu Botella
This commit uses `DetachedBuffer` instead of `ZeroCopyBuf` in the ops that back `Worker.prototype.postMessage` and `MessagePort.prototype.postMessage`. This is done because the serialized buffer is then copied to the destination isolate, even though it is internal to runtime code and not used for anything else, so detaching it and transferring it instead saves an unnecessary copy.
2022-07-11chore(core): Deduplicate code related to `op_event_loop_has_more_work` (#15147)Andreu Botella
The `op_event_loop_has_more_work` op, introduced in #14830, duplicates code from `JsRuntime::poll_event_loop`. That PR also added the unused method `JsRuntime::event_loop_has_work`, which is another duplication of that same code, and which isn't used anywhere. This change deduplicates this by renaming `JsRuntime::event_loop_has_work` to `event_loop_pending_state`, and making it the single place to determine what in the event loop is pending. This result is then returned in a struct which is used both in the event loop and in the `op_event_loop_has_more_work` op.
2022-07-09fix(ext/ffi): Avoid keeping JsRuntimeState RefCell borrowed for event loop ↵Aapo Alasuutari
middleware calls (#15116)
2022-07-08perf(ext/ffi): leverage V8 Fast Calls (#15125)Divy Srivastava
2022-07-08chore: upgrade rusty_v8 to 0.45.0 (#15123)Divy Srivastava
2022-07-07fix(core): deflake WASM termination test (#15103)Bartek Iwańczuk
2022-07-06refactor(core): Use `&mut Isolate` as an argument in `JsRealm` methods (#15093)Andreu Botella
Currently almost every `JsRealm` method has a `&mut JsRuntime` argument. This argument, however, is only used to get the runtime's corresponding isolate. Given that a mutable reference to the corresponding `v8::Isolate` can be reached from many more places than a mutable reference to the `JsRuntime` (for example, by derefing a V8 scope), changing that will make `JsRealm` usable from many more places than it currently is.
2022-07-05feat(core): Re-export v8 use_custom_libcxx feature (#14475)Arthur Silva
2022-07-05chore: unpin pin project to fix cargo publish (#15085)David Sherret
2022-07-051.23.3 (#15081)denobot
Co-authored-by: David Sherret <dsherret@gmail.com>
2022-07-04Revert "feat: add "unhandledrejection" event support (#12994)" (#15075)Bartek Iwańczuk
This reverts commit f7af0b01a59aaac91473e2f920137004d39a310a.
2022-07-04feat: add "unhandledrejection" event support (#12994)Bartek Iwańczuk
This commit adds support for "unhandledrejection" event. This event will trigger event listeners registered using: "globalThis.addEventListener("unhandledrejection") "globalThis.onunhandledrejection" This is done by registering a default handler using "Deno.core.setPromiseRejectCallback" that allows to handle rejected promises in JavaScript instead of Rust. This commit will make it possible to polyfill "process.on("unhandledRejection")" in the Node compat layer. Co-authored-by: Colin Ihrig <cjihrig@gmail.com>
2022-07-01chore: use Rust 1.62.0 (#15028)Bartek Iwańczuk
2022-07-01fix(core): handle exception from Wasm termination (#15014)João Avelino Bellomo Filho
Co-authored-by: Augusto Lenz <augustollenz@gmail.com>
2022-07-01fix(core): remove unsafe in OpsTracker (#15025)Nugine
2022-06-30chore: forward 1.23.2 to main (#15027)David Sherret
Co-authored-by: David Sherret <dsherret@gmail.com>
2022-06-30chore: upgrade rusty_v8 to 0.44.3 (#15019)Divy Srivastava
2022-06-28feat(web): add beforeunload event (#14830)Colin Ihrig
This commit adds the 'beforeunload' event. Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2022-06-28feat(ext/ffi): Thread safe callbacks (#14942)Aapo Alasuutari
2022-06-26build: require safety comments on unsafe code (#13870)Luca Casonato
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com> Co-authored-by: Divy Srivastava <dj.srivastava23@gmail.com>
2022-06-25fix(modules): Immediately resolve follow-up dyn imports to a dyn imported ↵Andreu Botella
module (#14958) When a dynamically imported module gets resolved, any code that comes after an await import() to that module will continue running. However, if that is the last code in the evaluation of another dynamically imported module, that second module will not resolve until the next iteration of the event loop, even though it does not depend on the event loop at all. When the event loop is being blocked by a long-running operation, such as a long-running timer, or by an async op that might never end, such as with workers or BroadcastChannels, that will result in the second dynamically imported module not being resolved for a while, or ever. This change fixes this by running the dynamic module loading steps in a loop until no more dynamic modules can be resolved.
2022-06-25fix(core): don't panic on non-existent cwd (#14957)Divy Srivastava
Co-authored-by: cjihrig <cjihrig@gmail.com>