1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-11-22 15:06:54 -05:00
Commit graph

1239 commits

Author SHA1 Message Date
Bartek Iwańczuk
e021070a2a
refactor(core): make sure to always set embedder wrapper offset (#19048) 2023-05-08 19:37:29 +00:00
Bartek Iwańczuk
71db518b76
refactor(core): verify there are no ops with duplicate names (#19047)
This commit adds a "debug build" only check that verifies on startup
that there are no duplicate ops (ie. the op names are unique).
2023-05-08 20:59:38 +02:00
Bartek Iwańczuk
7da8b1d9bb
Revert "perf(core): use jemalloc for V8 array buffer allocator (#18875)" (#19046)
This reverts commit 022aae9854.
2023-05-09 03:42:34 +09:00
ud2
40987178c4
fix(core): always report the first error on unhandled rejection (#18992)
The root cause of denoland/deno_std#3320, I believe, is that
`pending_promise_rejections` is a `HashMap` whose entries are in
arbitrary order, and as a result either of the two errors (`AddrInUse`
and `TypeError`) may be selected when determining which one to report. I
changed the field to a `VecDeque` so that the first error (`AddrInUse`
in this case) is always selected.
2023-05-08 00:27:59 +02:00
Bartek Iwańczuk
b8c9360761
refactor(core): remove run_in_task helper, use tokio::test macro (#19009) 2023-05-06 16:01:05 +02:00
David Sherret
5270c43e41
refactor(ext/fs): boxed deno_fs::FileSystem (#18945)
1. Boxed `File` and `FileSystem` to allow more easily passing this
through the CLI code (as shown within this pr).
2. `StdFileResource` is now `FileResource`. `FileResource` now contains
an `Rc<dyn File>`.
2023-05-04 14:28:42 -04:00
denobot
4b645676d6
chore: forward v1.33.2 release commit to main (#18990)
**THIS PR HAS GIT CONFLICTS THAT MUST BE RESOLVED**

This is the release commit being forwarded back to main for 1.33.2

Please ensure:
- [x] Everything looks ok in the PR
- [x] The release has been published

To make edits to this PR:
```shell
git fetch upstream forward_v1.33.2 && git checkout -b forward_v1.33.2 upstream/forward_v1.33.2
```

Don't need this PR? Close it.

cc @levex

Co-authored-by: levex <levex@users.noreply.github.com>
Co-authored-by: Levente Kurusa <lkurusa@kernelstuff.org>
2023-05-04 19:19:35 +02:00
Nayeem Rahman
7a8bb3b611
fix(core): allow esm extensions not included in snapshot (#18980)
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-04 02:44:59 +02:00
Bartek Iwańczuk
246569f6d4
fix(core): rebuild when JS sources for snapshotting change (#18976) 2023-05-03 16:35:39 +00:00
Bartek Iwańczuk
798c1ad0f1
perf: use jemalloc as global allocator (#18957)
Follow up to https://github.com/denoland/deno/pull/18875 that enables
`jemalloc` as a global allocator for the Deno CLI.
2023-05-03 00:36:33 +02:00
Divy Srivastava
022aae9854
perf(core): use jemalloc for V8 array buffer allocator (#18875)
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-02 20:17:11 +05:30
Bartek Iwańczuk
97147faf89
chore: release extension crates, unpin tokio (#18954) 2023-05-02 11:30:11 +00:00
Kenta Moriuchi
49eb887cc6
refactor(core): Use ObjectHasOwn instead of ObjectPrototypeHasOwnProperty (#18952)
ES2022 `Object.hasOwn` can be used in snapshot, so I migrate to use it.
2023-05-02 12:15:45 +02:00
Bartek Iwańczuk
2f651b2d64
fix(npm): canonicalize filename before returning (#18948)
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-02 02:35:33 +02:00
Bartek Iwańczuk
ecc70eb58f
bench: fix benchmarks again (#18942) 2023-05-01 19:57:58 +00:00
Bartek Iwańczuk
13c16d9cfd
bench: fix json ops benchmark (#18941) 2023-05-01 18:41:56 +00:00
Bartek Iwańczuk
dcf391ffed
refactor: migrate async ops to generated wrappers (#18937)
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-01 17:40:00 +02:00
Kenta Moriuchi
6728ad4203
fix(core): Use primordials for methods (#18839)
I would like to get this change into Deno before merging
https://github.com/denoland/deno_lint/pull/1152
2023-05-01 15:30:02 +02:00
Matt Mastracci
bb1f5e4262
perf(core): async op pseudo-codegen and performance work (#18887)
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-30 08:50:24 +00:00
Leo Kettmeir
9c8ebce3dc
refactor: merge Deno & Node inspectors (#18691) 2023-04-30 07:24:13 +00:00
Luca Casonato
1066490847
fix(ext/kv): stricter structured clone serializer (#18914) 2023-04-29 17:43:07 +02:00
Igor Zinkovsky
10ae5ee265
fix(ext/io) several sync fs fixes (#18886)
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](39ece1fe0d/ext/io/lib.rs (L485-L489)).
2023-04-28 12:16:17 -07:00
denobot
6369098ad7
chore: forward v1.33.1 release commit to main (#18897)
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2023-04-28 21:14:26 +02:00
denobot
39ece1fe0d
1.33.0 (#18879)
Co-authored-by: bartlomieju <bartlomieju@users.noreply.github.com>
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2023-04-28 01:18:57 +02:00
Bartek Iwańczuk
683dbd7f3b
Revert "refactor: don't expose Deno[Deno.internal].core namespace" (#18881)
Also conditionally disabled one test if there's not enough space on
device.
2023-04-28 00:37:03 +02:00
Nayeem Rahman
504482dadd
fix(repl): print unhandled rejections and event errors (#18878)
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-27 23:36:49 +02:00
Bartek Iwańczuk
6cd62ea5e9
chore: upgrade rusty_v8 to 0.71.0 (#18868) 2023-04-27 20:50:46 +02:00
Nayeem Rahman
03132e19da
fix(test): handle dispatched exceptions from test functions (#18853)
Fixes #18852.
2023-04-27 14:40:03 +02:00
Bartek Iwańczuk
1054723a4b
feat(serde_v8): better error output (#18815)
The type that was received is now printed as part of a message.
2023-04-27 02:12:39 +02:00
Bartek Iwańczuk
77e25a656e
refactor(core): simplify op types and codegeneration (#18843)
About 2% improvement on WS/HTTP benchmarks, possibly unlocking more
optimizations in the future.

---------

Co-authored-by: Matt Mastracci <matthew@mastracci.com>
2023-04-26 20:02:27 +02:00
Bartek Iwańczuk
14aaa73c02
refactor: don't expose Deno[Deno.internal].core namespace (#18816) 2023-04-26 19:57:38 +02:00
Bartek Iwańczuk
106e4c475f
chore: upgrade rusty_v8 to 0.70.0 (#18844)
Closes https://github.com/denoland/deno/issues/18369
2023-04-26 10:02:03 +02:00
Kenta Moriuchi
9b49de4644
fix(core): Wrap safe collections' argument of primordials (#18750) 2023-04-26 00:36:22 +02:00
Matt Mastracci
bdffcb409f
feat(ext/http): Rework Deno.serve using hyper 1.0-rc3 (#18619)
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-22 11:48:21 -06:00
Bartek Iwańczuk
1d447cb7c3
refactor(core): remove ops from Deno.core.ops that are disabled (#18793)
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-21 15:22:45 +02:00
Bartek Iwańczuk
10442350c3
refactor(core): remove PhantomData from IdentityHasher (#18770) 2023-04-19 17:35:02 -04:00
Bartek Iwańczuk
5a77bb8844
refactor(core): return better error for non-existent async ops (#18772) 2023-04-19 16:22:41 +02:00
Bartek Iwańczuk
40e157c005
refactor(core): store v8::Global<v8::Context> in an Rc (#18749)
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-19 00:52:12 +02:00
denobot
4e5d370b56
chore: forward v1.32.5 release commit to main (#18758)
Co-authored-by: levex <levex@users.noreply.github.com>
Co-authored-by: Levente Kurusa <lkurusa@kernelstuff.org>
2023-04-18 22:20:49 +02:00
Oleh Martsokha
54c31194a5
docs(core): fix example link (#18731) 2023-04-18 17:08:19 +09:00
Luca Casonato
bcbdaac7e6
chore(ext/fs): decouple fs trait from deno_core (#18732)
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-17 16:10:59 +02:00
Bartek Iwańczuk
02dd09a36f
bench: add benchmark for deferred async ops (#18722)
```
./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-16 19:47:06 +00:00
Bartek Iwańczuk
1564595f6b
Revert "perf(core): immediately schedule another tick if there are un… (#18718)
…polled ops (#18611)"

This reverts commit 4317055a3e.

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-16 14:05:13 +00:00
Kenta Moriuchi
f086ec57b4
fix(core): Use safe primordials wrappers (#18687) 2023-04-14 22:23:28 +02:00
Bartek Iwańczuk
4317055a3e
perf(core): immediately schedule another tick if there are unpolled ops (#18611)
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-14 12:55:47 +02:00
Bartek Iwańczuk
cb2ca234bb
refactor(core): limit number of boundary crossings between Rust and V8 (#18652)
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-14 02:41:32 +02:00
Bartek Iwańczuk
702284dc22
perf(ops): directly respond for eager ops (#18683)
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-13 14:32:47 +02:00
Yiyu Lin
19c3e4f6dc
refactor(serde_v8): move to thiserror, better error output (#18202)
Ref #17318

---------

Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2023-04-13 02:03:56 +02:00
denobot
05c393b99b
chore: forward v1.32.4 release commit to main (#18669)
Co-authored-by: levex <levex@users.noreply.github.com>
2023-04-12 13:03:27 -04:00
Luca Casonato
f90caa821c
refactor(ext/fs): abstract FS via FileSystem trait (#18599)
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-12 15:13:32 +02:00