summaryrefslogtreecommitdiff
path: root/core
AgeCommit message (Collapse)Author
2023-05-04fix(core): allow esm extensions not included in snapshot (#18980)Nayeem Rahman
Fixes #18979. This changes the predicate for allowing `ext:` specifier resolution from `snapshot_loaded_and_not_snapshotting` to `ext_resolution_allowed` which is only set to true during the extension module loading phase. Module loaders as used in core are now declared as `ExtModuleLoader` rather than `dyn ModuleLoader`.
2023-05-03fix(core): rebuild when JS sources for snapshotting change (#18976)Bartek Iwańczuk
2023-05-03perf: use jemalloc as global allocator (#18957)Bartek Iwańczuk
Follow up to https://github.com/denoland/deno/pull/18875 that enables `jemalloc` as a global allocator for the Deno CLI.
2023-05-02perf(core): use jemalloc for V8 array buffer allocator (#18875)Divy Srivastava
This commits changes "deno_core" to use jemalloc allocator as an allocator for V8 array buffers. This greatly improves our GC characteristics as we are using a lot of short lived array buffers. They no longer go through the expensive malloc/free cycle using the default Rust allocator, but instead use jemallocator's memory pool. As a result the flamegraphs for WS/HTTP server flamegraphs no longer show stacks for malloc/free around ops that use ZeroCopyBuf and &[u8]. --------- Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2023-05-02chore: release extension crates, unpin tokio (#18954)Bartek Iwańczuk
2023-05-02refactor(core): Use `ObjectHasOwn` instead of ↵Kenta Moriuchi
`ObjectPrototypeHasOwnProperty` (#18952) ES2022 `Object.hasOwn` can be used in snapshot, so I migrate to use it.
2023-05-02fix(npm): canonicalize filename before returning (#18948)Bartek Iwańczuk
This commit changes how paths for npm packages are handled, by canonicalizing them when resolving. This is done so that instead of returning "node_modules/<package_name>@<version>/node_modules/<dep>/index.js" (which is a symlink) we "node_modules/<dep>@<dep_version>/index.js. Fixes https://github.com/denoland/deno/issues/18924 Fixes https://github.com/bluwy/create-vite-extra/issues/31 --------- Co-authored-by: David Sherret <dsherret@gmail.com>
2023-05-01bench: fix benchmarks again (#18942)Bartek Iwańczuk
2023-05-01bench: fix json ops benchmark (#18941)Bartek Iwańczuk
2023-05-01refactor: migrate async ops to generated wrappers (#18937)Bartek Iwańczuk
Migrates some of existing async ops to generated wrappers introduced in https://github.com/denoland/deno/pull/18887. As a result "core.opAsync2" was removed. I will follow up with more PRs that migrate all the async ops to generated wrappers.
2023-05-01fix(core): Use primordials for methods (#18839)Kenta Moriuchi
I would like to get this change into Deno before merging https://github.com/denoland/deno_lint/pull/1152
2023-04-30perf(core): async op pseudo-codegen and performance work (#18887)Matt Mastracci
Performance: ``` async_ops.js: 760k -> 1030k (!) async_ops_deferred.js: 730k -> 770k Deno.serve bench: 118k -> 124k WS test w/ third_party/prebuilt/mac/load_test 100 localhost 8000 0 0: unchanged Startup time: approx 0.5ms slower (13.7 -> 14.2ms) ```
2023-04-30refactor: merge Deno & Node inspectors (#18691)Leo Kettmeir
2023-04-29fix(ext/kv): stricter structured clone serializer (#18914)Luca Casonato
2023-04-28fix(ext/io) several sync fs fixes (#18886)Igor Zinkovsky
2 fixes related to sync fs: * update the 2 sync methods on `Resource` trait to take `Rc<Self>` (consistent with other methods) * fix a bug in `StdFileResource::with_inner_and_metadata`, which currently can trigger a panic if a sync method is called on a file with a pending async operation. This could happen in the code path where `File::try_clone` [fails](https://github.com/denoland/deno/blob/39ece1fe0ddacc2cbf182403c9e7085bc01df5a6/ext/io/lib.rs#L485-L489).
2023-04-28chore: forward v1.33.1 release commit to main (#18897)denobot
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2023-04-281.33.0 (#18879)denobot
Co-authored-by: bartlomieju <bartlomieju@users.noreply.github.com> Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2023-04-28Revert "refactor: don't expose Deno[Deno.internal].core namespace" (#18881)Bartek Iwańczuk
Also conditionally disabled one test if there's not enough space on device.
2023-04-27fix(repl): print unhandled rejections and event errors (#18878)Nayeem Rahman
Fixes #8858. Fixes #8869. ``` $ target/debug/deno Deno 1.32.5 exit using ctrl+d, ctrl+c, or close() REPL is running with all permissions allowed. To specify permissions, run `deno repl` with allow flags. > Promise.reject(new Error("bar")); Promise { <rejected> Error: bar at <anonymous>:2:16 } Uncaught (in promise) Error: bar at <anonymous>:2:16 > reportError(new Error("baz")); undefined Uncaught Error: baz at <anonymous>:2:13 >
2023-04-27chore: upgrade rusty_v8 to 0.71.0 (#18868)Bartek Iwańczuk
2023-04-27fix(test): handle dispatched exceptions from test functions (#18853)Nayeem Rahman
Fixes #18852.
2023-04-27feat(serde_v8): better error output (#18815)Bartek Iwańczuk
The type that was received is now printed as part of a message.
2023-04-26refactor(core): simplify op types and codegeneration (#18843)Bartek Iwańczuk
About 2% improvement on WS/HTTP benchmarks, possibly unlocking more optimizations in the future. --------- Co-authored-by: Matt Mastracci <matthew@mastracci.com>
2023-04-26refactor: don't expose Deno[Deno.internal].core namespace (#18816)Bartek Iwańczuk
2023-04-26chore: upgrade rusty_v8 to 0.70.0 (#18844)Bartek Iwańczuk
Closes https://github.com/denoland/deno/issues/18369
2023-04-26fix(core): Wrap safe collections' argument of primordials (#18750)Kenta Moriuchi
2023-04-22feat(ext/http): Rework Deno.serve using hyper 1.0-rc3 (#18619)Matt Mastracci
This is a rewrite of the `Deno.serve` API to live on top of hyper 1.0-rc3. The code should be more maintainable long-term, and avoids some of the slower mpsc patterns that made the older code less efficient than it could have been. Missing features: - `upgradeHttp` and `upgradeHttpRaw` (`upgradeWebSocket` is available, however). - Automatic compression is unavailable on responses.
2023-04-21refactor(core): remove ops from Deno.core.ops that are disabled (#18793)Bartek Iwańczuk
This commit changes how "disabled" ops behave. Instead of using "void" functions under the hood, they now explicitly throw errors saying that a given op doesn't exist.
2023-04-19refactor(core): remove PhantomData from IdentityHasher (#18770)Bartek Iwańczuk
2023-04-19refactor(core): return better error for non-existent async ops (#18772)Bartek Iwańczuk
2023-04-19refactor(core): store v8::Global<v8::Context> in an Rc (#18749)Bartek Iwańczuk
Alternative to https://github.com/denoland/deno/pull/18726. This was suggested by @piscisaureus. It's a bit ugly, but it does the work and makes cloning `JsRealm` very cheap, while not requiring invasive changes. Also managed to remove some vector and `v8::Global` clones which yields about 5% improvement in the "async_ops_deferred.js" benchmark. This PR: ``` time 1689 ms rate 592066 time 1722 ms rate 580720 time 1629 ms rate 613873 time 1578 ms rate 633713 time 1585 ms rate 630914 time 1574 ms rate 635324 ``` `main` branch: ``` time 1687 ms rate 592768 time 1676 ms rate 596658 time 1651 ms rate 605693 time 1652 ms rate 605326 time 1638 ms rate 610500 ```
2023-04-18chore: forward v1.32.5 release commit to main (#18758)denobot
Co-authored-by: levex <levex@users.noreply.github.com> Co-authored-by: Levente Kurusa <lkurusa@kernelstuff.org>
2023-04-18docs(core): fix example link (#18731)Oleh Martsokha
2023-04-17chore(ext/fs): decouple fs trait from deno_core (#18732)Luca Casonato
This commit removes the dependencies on `deno_core` for the Fs trait. This allows to move the trait into a different crate that does not depend on core in the limit. This adds a new `bounds` field to `deno_core::extension!` that expands to `where` clauses on the generated code. This allows to add bounds to the extension parameters, such as `Fs::File: Resource`.
2023-04-16bench: add benchmark for deferred async ops (#18722)Bartek Iwańczuk
``` ./target/release/deno run cli/bench/async_ops_deferred.js time 794 ms rate 1259445 time 786 ms rate 1272264 time 770 ms rate 1298701 time 784 ms rate 1275510 time 775 ms rate 1290322 time 786 ms rate 1272264 time 773 ms rate 1293661 time 771 ms rate 1297016 time 774 ms rate 1291989 time 767 ms rate 1303780 time 764 ms rate 1308900 time 768 ms rate 1302083 time 763 ms rate 1310615 time 761 ms rate 1314060 time 761 ms rate 1314060 time 762 ms rate 1312335 time 763 ms rate 1310615 time 759 ms rate 1317523 time 760 ms rate 1315789 time 761 ms rate 1314060 time 769 ms rate 1300390 time 763 ms rate 1310615 time 760 ms rate 1315789 time 763 ms rate 1310615 time 761 ms rate 1314060 time 759 ms rate 1317523 time 765 ms rate 1307189 time 760 ms rate 1315789 time 764 ms rate 1308900 time 763 ms rate 1310615 time 760 ms rate 1315789 time 757 ms rate 1321003 time 763 ms rate 1310615 time 759 ms rate 1317523 time 771 ms rate 1297016 time 759 ms rate 1317523 time 759 ms rate 1317523 time 763 ms rate 1310615 time 754 ms rate 1326259 time 755 ms rate 1324503 time 762 ms rate 1312335 time 752 ms rate 1329787 time 755 ms rate 1324503 time 754 ms rate 1326259 time 759 ms rate 1317523 time 754 ms rate 1326259 time 749 ms rate 1335113 time 753 ms rate 1328021 time 756 ms rate 1322751 time 753 ms rate 1328021 ``` ``` samply record -r 20000 target/release/deno run cli/bench/async_ops_deferred.js ``` https://share.firefox.dev/43Efvm6
2023-04-16Revert "perf(core): immediately schedule another tick if there are un… ↵Bartek Iwańczuk
(#18718) …polled ops (#18611)" This reverts commit 4317055a3e49c7a75648480bbc86e4b466c60b5e. Reverting because we discovered while working on https://github.com/denoland/deno/pull/18619 that it doesn't work correctly (sometimes waker just stops working).
2023-04-14fix(core): Use safe primordials wrappers (#18687)Kenta Moriuchi
2023-04-14perf(core): immediately schedule another tick if there are unpolled ops (#18611)Bartek Iwańczuk
Currently we are "waking up" the runtime if at the end of the event loop tick there are ops that haven't been polled. Waking up incurs a syscall and it appears we can do another tick of the event loop, without going through the "wake up" machinery.
2023-04-14refactor(core): limit number of boundary crossings between Rust and V8 (#18652)Bartek Iwańczuk
This commit refactors "deno_core" to do fewer boundary crossings from Rust to V8. In other words we are now calling V8 from Rust fewer times. This is done by merging 3 distinct callbacks into a single one. Instead of having "op resolve" callback, "next tick" callback and "macrotask queue" callback, we now have only "Deno.core.eventLoopTick" callback, which is responsible for doing the same actions previous 3 callbacks. On each of the event loop we were doing at least 2 boundary crosses (timers macrotask queue callback and unhandled promise rejection callback) and up to 4 crosses if there were op response and next tick callbacks coming from Node.js compatibility layer. Now this is all done in a single callback. Closes https://github.com/denoland/deno/issues/18620
2023-04-13perf(ops): directly respond for eager ops (#18683)Bartek Iwańczuk
This commit changes "eager ops" to directly return a response value instead of calling "opresponse" callback in JavaScript. This saves one boundary crossing and has a fantastic impact on the "async_ops.js" benchmark: ``` v1.32.4 $ deno run cli/bench/async_ops.js time 329 ms rate 3039513 time 322 ms rate 3105590 time 307 ms rate 3257328 time 301 ms rate 3322259 time 303 ms rate 3300330 time 306 ms rate 3267973 time 300 ms rate 3333333 time 301 ms rate 3322259 time 301 ms rate 3322259 time 301 ms rate 3322259 time 302 ms rate 3311258 time 301 ms rate 3322259 time 302 ms rate 3311258 time 302 ms rate 3311258 time 303 ms rate 3300330 ``` ``` this branch $ ./target/release/deno run -A cli/bench/async_ops.js time 257 ms rate 3891050 time 248 ms rate 4032258 time 251 ms rate 3984063 time 246 ms rate 4065040 time 238 ms rate 4201680 time 227 ms rate 4405286 time 228 ms rate 4385964 time 229 ms rate 4366812 time 228 ms rate 4385964 time 226 ms rate 4424778 time 226 ms rate 4424778 time 227 ms rate 4405286 time 228 ms rate 4385964 time 227 ms rate 4405286 time 228 ms rate 4385964 time 227 ms rate 4405286 time 229 ms rate 4366812 time 228 ms rate 4385964 ``` Prerequisite for https://github.com/denoland/deno/pull/18652
2023-04-13refactor(serde_v8): move to `thiserror`, better error output (#18202)Yiyu Lin
Ref #17318 --------- Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2023-04-12chore: forward v1.32.4 release commit to main (#18669)denobot
Co-authored-by: levex <levex@users.noreply.github.com>
2023-04-12refactor(ext/fs): abstract FS via FileSystem trait (#18599)Luca Casonato
This commit abstracts out the specifics of the underlying system calls FS operations behind a new `FileSystem` and `File` trait in the `ext/fs` extension. This allows other embedders to re-use ext/fs, but substituting in a different FS backend. This is likely not the final form of these traits. Eventually they will be entirely `deno_core::Resource` agnostic, and will live in a seperate crate. --------- Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2023-04-12fix(core): preserve syntax error locations in dynamic imports (#18664)Nayeem Rahman
Fixes #6259. Adds the location for v8 syntax errors to the message (`message += " at {location}"`) when rethrowing them for dynamic imports. Discussing with @bartlomieju on discord I proposed just preserving v8's error and not reconstructing it, allowing the standard stack trace to just point to the syntax error instead of the dynamic import. But on further thought this way has parity with SWC's syntax errors + has the advantage of showing both the syntax error and dynamic import location. ```ts // temp.js await import("./temp2.js"); // temp2.js function foo() { await Promise.resolve(); } // Before: // error: Uncaught (in promise) SyntaxError: Unexpected reserved word // await import("./temp2.js"); // ^ // at async file:///.../temp.js:1:1 // After: // error: Uncaught (in promise) SyntaxError: Unexpected reserved word at file:///.../temp2.js:2:3 // await import("./temp2.js"); // ^ // at async file:///.../temp.js:1:1 ```
2023-04-08cleanup(core): Move `JsRealm` into a separate module (#18641)Andreu Botella
This will help make reviews easier for #15760, which moves a number of methods related to module loading from `JsRuntime` into `JsRealm`.
2023-04-06feat(core): sync io ops in core (#18603)Luca Casonato
This commit adds op_read_sync and op_write_sync to core. These ops are similar to op_read and op_write, but they are synchronous. Just like the async ops, they operate on generic `deno_core::Resource` objects. These now have new `read_byob_sync` and `write_sync` methods, with default implementations throwing "NotSupported" errors, just like the async counterparts. There are no `write_all` or `read` equivalents, because the optimizations they unlock are not useful in synchronous contexts.
2023-04-05refactor(core): run pending dynamic imports before ops (#18592)Bartek Iwańczuk
This is in preparation to limit number of times we have to cross Rust -> V8 boundary on each tick of event loop.
2023-04-04refactor(core): Improve ergonomics of managing ASCII strings (#18498)Matt Mastracci
This is a follow-on to the earlier work in reducing string copies, mainly focused on ensuring that ASCII strings are easy to provide to the JS runtime. While we are replacing a 16-byte reference in a number of places with a 24-byte structure (measured via `std::mem::size_of`), the reduction in copies wins out over the additional size of the arguments passed into functions. Benchmarking shows approximately the same if not slightly less wallclock time/instructions retired, but I believe this continues to open up further refactoring opportunities.
2023-04-02chore: Turn back on dlintPreferPrimordials (#17715)Kenta Moriuchi
Closes #17709
2023-04-01chore: forward v1.32.3 release commit to main (#18561)denobot
Co-authored-by: David Sherret <dsherret@gmail.com>