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

166 commits

Author SHA1 Message Date
Martin Fischer
801b9ec62d
chore: fix typos (#19572) 2023-06-26 09:10:27 -04:00
Kangwook Lee (이강욱)
d8293cd8bc
fix(ops): quoting serde_v8::Value (#19593)
The following code:

```rust
use deno_core::op;

#[op]
fn ops_serde_v8(value: serde_v8::Value) {
    //
}

fn main() {
    //
}
```

...with the following `Cargo.toml`:

```toml
[package]
name = "playground"
version = "0.1.0"
edition = "2021"

[dependencies]
deno_core = "0.191.0"
serde_v8 = "0.102.0"
```

...will not compile with the error:

```
error[E0433]: failed to resolve: use of undeclared crate or module `v8`
 --> src/main.rs:3:1
  |
3 | #[op]
  | ^^^^^ use of undeclared crate or module `v8`
  |
  = note: this error originates in the attribute macro `op` (in Nightly builds, run with -Z macro-backtrace for more info)
```

This PR is fixing the above issue by properly quoting
`deno_core::v8::Value` instead of `v8::Value`.
2023-06-25 21:41:48 +00:00
Matt Mastracci
8fe9b8a4cc
refactor(ops): ops2 supports result in fast path (#19603)
Implements `Result` in fast-calls. Note that the approach here is
slightly different. Rather than store the last result in the `OpState`,
we put it into the `OpCtx` which saves us a lookup and lock in the error
case. We do not have to lock this field as it's guaranteed only one
runtime and thread can ever access it.

The fastcall path for many ops can avoid doing a great deal of work,
even for `Result` return values. In the previous iteration of `ops`, all
`Result`-returning functions would fetch and lock the `OpState`,
regardless of whether it was used or not.
2023-06-25 16:36:09 +02:00
Matt Mastracci
a181ceb0e3
refactor(ops): op2 supports Result in slow call path (#19602) 2023-06-24 15:30:04 -06:00
Matt Mastracci
65d9bfb533
refactor(ops): Adding op2 macro and implementing in a couple of places (#19534)
This is a new op system that will eventually replace `#[op]`. 

Features
 - More maintainable, generally less-coupled code
 - More modern Rust proc-macro libraries
- Enforces correct `fast` labelling for fast ops, allowing for visual
scanning of fast ops
 - Explicit marking of `#[string]`, `#[serde]` and `#[smi]` parameters.

This first version of op2 supports integer and Option<integer>
parameters only, and allows us to start working on converting ops and
adding features.
2023-06-24 13:54:10 +02:00
denobot
239dc5e681
chore: forward v1.34.3 release commit to main (#19526)
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2023-06-16 01:55:31 +02:00
denobot
1b26f3c726
chore: forward v1.34.2 release commit to main (#19434)
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2023-06-09 02:17:03 +00:00
Nayeem Rahman
34dac6c6ef
refactor(core): remove force_op_registration and cleanup JsRuntimeForSnapshot (#19353)
Addresses
https://github.com/denoland/deno/pull/19308#discussion_r1212248194. 

Removes force_op_registration as it is no longer necessary.
2023-06-03 14:22:32 -06:00
Bartek Iwańczuk
acc6cdc0b1
chore: forward v1.34.1 to main (#19312)
Co-authored-by: denobot <33910674+denobot@users.noreply.github.com>
Co-authored-by: bartlomieju <bartlomieju@users.noreply.github.com>
2023-05-29 20:26:03 -06:00
denobot
935071dd0e
1.34.0 (#19246)
Co-authored-by: bartlomieju <bartlomieju@users.noreply.github.com>
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2023-05-24 23:38:01 +00:00
denobot
877b38b370
chore: forward v1.33.4 release commit to main (#19181)
**THIS PR HAS GIT CONFLICTS THAT MUST BE RESOLVED**

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

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

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

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-18 20:44:10 +02:00
denobot
7476ee34fa
chore: forward v1.33.3 release commit to main (#19111)
**THIS PR HAS GIT CONFLICTS THAT MUST BE RESOLVED**

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

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.3 && git checkout -b forward_v1.33.3 upstream/forward_v1.33.3
```

Don't need this PR? Close it.

cc @levex

Co-authored-by: Levente Kurusa <lkurusa@kernelstuff.org>
2023-05-12 14:47:27 +00: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
Bartek Iwańczuk
97147faf89
chore: release extension crates, unpin tokio (#18954) 2023-05-02 11:30:11 +00: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
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
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
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
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
d790ea7d53
refactor(cli,ext,ops): cleanup regex with lazy-regex (#17296)
- bump deps: the newest `lazy-regex` need newer `oncecell` and
`regex`
- reduce `unwrap`
- remove dep `lazy_static`
- make more regex cached

---------

Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2023-04-13 03:08:01 +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
denobot
ad8d0c90d1
chore: forward v1.32.3 release commit to main (#18561)
Co-authored-by: David Sherret <dsherret@gmail.com>
2023-04-01 20:27:53 -04:00
denobot
f465123fdc
chore: forward v1.32.2 release commit to main (#18539)
This is the release commit being forwarded back to main for 1.32.2
2023-04-01 00:10:13 +00:00
Divy Srivastava
feab94ff51
fix(ops): fallback when FastApiOneByteString is not utf8 (#18518)
Fixes https://github.com/denoland/deno/issues/18255
2023-03-31 17:46:25 +02:00
Divy Srivastava
b9a3790932
perf: const op declaration (#18288)
Co-authored-by: Levente Kurusa <lkurusa@kernelstuff.org>
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2023-03-31 14:42:14 +02:00
Divy Srivastava
b2fd0742bd
feat: port node:zlib to rust (#18291) 2023-03-27 16:03:07 +00:00
denobot
e8348231df
chore: forward v1.32.1 release commit to main (#18399)
Co-authored-by: bartlomieju <bartlomieju@users.noreply.github.com>
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2023-03-23 22:55:23 +01:00
denobot
25b564bf86
1.32.0 (#18367)
Bumped versions for 1.32.0

---------

Co-authored-by: mmastrac <mmastrac@users.noreply.github.com>
Co-authored-by: Matt Mastracci <matthew@mastracci.com>
Co-authored-by: David Sherret <dsherret@users.noreply.github.com>
2023-03-22 22:22:24 +00:00
Bartek Iwańczuk
3c9771deb2
Reland "perf(core): preserve ops between snapshots (#18080)" (#18272)
Relanding 4b6305f4f2
2023-03-18 18:30:04 -04:00
Bartek Iwańczuk
d11e89127d
Revert "perf(core): preserve ops between snapshots (#18080)" (#18267)
This reverts commit 4b6305f4f2.
2023-03-18 14:59:51 +00:00
Bartek Iwańczuk
4b6305f4f2
perf(core): preserve ops between snapshots (#18080)
This commit changes the build process in a way that preserves already
registered ops in the snapshot. This allows us to skip creating hundreds of
"v8::String" on each startup, but sadly there is still some op registration
going on startup (however we're registering 49 ops instead of >200 ops). 

This situation could be further improved, by moving some of the ops 
from "runtime/" to a separate extension crates.

---------

Co-authored-by: Divy Srivastava <dj.srivastava23@gmail.com>
2023-03-18 12:51:21 +01:00
Divy Srivastava
eb3d79ab1b
chore(ops): inline FastFunction trait methods (#18226) 2023-03-16 13:20:41 +00:00
denobot
33b85a2b8e
chore: forward v1.31.3 release commit to main (#18222)
Co-authored-by: kt3k <kt3k@users.noreply.github.com>
2023-03-16 17:09:26 +09:00
denobot
857393d934
chore: forward v1.31.2 release commit to main (#18114)
Co-authored-by: Yoshiya Hinosawa <stibium121@gmail.com>
2023-03-10 17:39:29 +09:00
Divy Srivastava
d4807f458e
chore(core): remove argc field from OpDecl (#18024)
https://github.com/denoland/deno/pull/18023#discussion_r1125611859
2023-03-05 11:16:43 +00:00
Divy Srivastava
0910be4d64
feat(ops): relational ops (#18023)
Join two independent ops into one. A fast impl of one + a slow callback
of another. Here's an example showing optimized paths for latin-1 via
fast call and the next-best fallback using V8 apis.

```rust
#[op(v8)]
fn op_encoding_encode_into_fallback(
  scope: &mut v8::HandleScope,
  input: serde_v8::Value,
// ...

#[op(fast, slow = op_encoding_encode_into_fallback)]
fn op_encoding_encode_into(
  input: Cow<'_, str>,
// ...
```

Benchmark results of the fallback path:
```
time target/release/deno run -A --unstable ./cli/tests/testdata/benches/text_encoder_into_perf.js
________________________________________________________
Executed in   70.90 millis    fish           external
   usr time   57.76 millis    0.23 millis   57.53 millis
   sys time   17.02 millis    1.28 millis   15.74 millis

target/release/deno_main run -A --unstable ./cli/tests/testdata/benches/text_encoder_into_perf.js
________________________________________________________
Executed in  154.00 millis    fish           external
   usr time   67.14 millis    0.26 millis   66.88 millis
   sys time   38.82 millis    1.47 millis   37.35 millis
```
2023-03-05 13:30:22 +05:30
Divy Srivastava
38555a6a0f
feat(ops): reland fast zero copy string arguments (#17996)
Reland https://github.com/denoland/deno/pull/16777

The codegen is disabled in async ops and when fallback to slow call is
possible (return type is a Result) to avoid hitting this V8 bug:
https://github.com/denoland/deno/issues/17159
2023-03-03 19:04:10 +05:30
Aapo Alasuutari
4835098cf7
fix(ext/ffi): Remove deno_core::OpState qualifiers, fix ops returning pointer defaults (#17959) 2023-02-28 08:26:48 +02:00
denobot
3cd24fa8d0
chore: forward v1.31.1 release commit to main (#17939)
Co-authored-by: David Sherret <dsherret@gmail.com>
2023-02-24 22:37:46 -05:00
denobot
c26fbe38d5
1.31.0 (#17906)
Co-authored-by: bartlomieju <bartlomieju@users.noreply.github.com>
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2023-02-24 00:16:04 +01:00
Aapo Alasuutari
b56b8c8a75
feat(ext/ffi): Replace pointer integers with v8::External objects (#16889) 2023-02-22 19:32:38 +02:00
Divy Srivastava
f8435d20b0
feat(ext/node): implement node:v8 (#17806)
Closes https://github.com/denoland/deno/issues/17115 

Implements `cachedDataVersionTag` and `getHeapStatistics`.
2023-02-17 18:48:09 +05:30
denobot
a4988d00da
chore: forward v1.30.3 release commit to main (#17677)
Co-authored-by: bartlomieju <bartlomieju@users.noreply.github.com>
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2023-02-07 04:15:38 +00:00
denobot
f8ecd236fb
chore: forward v1.30.2 release commit to main (#17641)
This is the release commit being forwarded back to main for 1.30.2

Co-authored-by: Divy Srivastava <dj.srivastava23@gmail.com>
2023-02-03 16:26:43 +00:00
denobot
65755a115a
chore: forward v1.30.1 release commit to main (#17623)
This is the release commit being forwarded back to main for 1.30.1
2023-02-02 16:28:40 +00:00
Aapo Alasuutari
04ba709b6e
perf(ops): Remove unnecessary fast call fallback options usage (#17585)
Currently fast ops will always check for the alignment of a TypedArray
when getting a slice out of them. A match is then done to ensure that
some slice was received and if not a fallback will be requested.

For Uint8Arrays (and WasmMemory which is equivalent to a Uint8Array) the
alignment will always be okay. Rust probably optimises this away for the
most part (since the Uint8Array check is `x % 1 != 0`), but what it
cannot optimise away is the fast ops path's request for fallback options
parameter.

The extra parameter's cost is likely negligible but V8 will need to
check if a fallback was requested and prepare the fallback call just in
case it was. In the future the lack of a fallback may also enable V8 to
much better optimise the result handling.

For V8 created buffers, it seems like all buffers are actually always
guaranteed to be properly aligned: All buffers seem to always be created
8-byte aligned, and creating a 32 bit array or 64 bit array with a
non-aligned offset from an ArrayBuffer is not allowed. Unfortunately,
Deno FFI cannot give the same guarantees, and it is actually possible
for eg. 32 bit arrays to be created unaligned using it. These arrays
work fine (at least on Linux) so it seems like this is not illegal, it
just means that we cannot remove the alignment checking for 32 bit
arrays.
2023-01-29 19:35:08 +05:30
David Sherret
f5840bdcd3
chore: upgrade to Rust 1.67 (#17548)
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2023-01-27 10:43:16 -05:00
denobot
a6f915c22f
1.30.0 (#17532)
Co-authored-by: bartlomieju <bartlomieju@users.noreply.github.com>
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2023-01-26 00:15:08 +01:00
denobot
f2a5f6d7f0
chore: forward v1.29.4 release commit to main (#17453)
Co-authored-by: bartlomieju <bartlomieju@users.noreply.github.com>
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2023-01-17 00:30:33 +01:00