0
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-10-31 09:14:20 -04:00
Commit graph

1148 commits

Author SHA1 Message Date
denobot
98d062e3dc
chore: forward v1.28.3 release commit to main (#16884)
Co-authored-by: kt3k <kt3k@users.noreply.github.com>
2022-12-01 22:46:27 +09:00
Bartek Iwańczuk
381932ce1e
chore: upgrade rusty_v8 to 0.58.0 (#16879) 2022-11-30 22:20:18 +00:00
David Sherret
623dbe7a57
chore: remove unnecessary lifetimes (#16878)
It seems we don't really need to allow these clippy rules.
2022-11-30 19:19:32 +00:00
Bartek Iwańczuk
f526513d74
feat(core): show unresolved promise origin (#16650)
This commit updates unhelpful messages that are raised when event loop
stalls on unresolved top-level promises.

Instead of "Module evaluation is still pending but there are no pending
ops or dynamic imports. This situation is often caused by unresolved
promises." and "Dynamically imported module evaluation is still pending
but there are no pending ops. This situation is often caused by
unresolved promises." we are now printing a message like: 

error: Top-level await promise never resolved
[SOURCE LINE]
^
    at [FUNCTION NAME] ([FILENAME])

eg:
error: Top-level await promise never resolved
await new Promise((_resolve, _reject) => {});
^
at <anonymous>
(file:///Users/ib/dev/deno/cli/tests/testdata/test/unresolved_promise.ts:1:1)

Co-authored-by: David Sherret <dsherret@users.noreply.github.com>
2022-11-28 23:07:23 +01:00
Divy Srivastava
ca66978a5a
feat(ops): fast calls for Wasm (#16776)
This PR introduces Wasm ops. These calls are optimized for entry from
Wasm land.

The `#[op(wasm)]` attribute is opt-in. 

Last parameter `Option<&mut [u8]>` is the memory slice of the Wasm
module *when entered from a Fast API call*. Otherwise, the user is
expected to implement logic to obtain the memory if `None`

```rust
#[op(wasm)]
pub fn op_args_get(
  offset: i32,
  buffer_offset: i32,
  memory: Option<&mut [u8]>,
) {
  // ...
}
```
2022-11-27 19:24:28 +05:30
Bartek Iwańczuk
28b5a7e2ec
feat(core): support initializing extensions with and without JS (#16789)
This commit allows to execute more JS code from extensions when
creating a snapshot from an existing snapshot.

"deno_core::RuntimeOptions::extensions_with_js" field was added
that is used to pass a list of extensions whose both "ops" and
associated JS source should be executed upon start.

Co-authored-by: crowlkats <crowlkats@toaxl.com>
2022-11-27 00:58:23 +01:00
Bartek Iwańczuk
d4f659d1d3
feat(core): send "executionContextDestroyed" notification on program end (#16831)
This commit changes "JsRuntime" to send "executionContextDestroyed"
notification when the program finishes and shows a prompt informing 
that runtime is waiting for inspector to disconnect.
2022-11-27 00:44:39 +01:00
Bartek Iwańczuk
3a320db270
fix(inspector): send "isDefault" in aux data (#16836)
With trial and error I found that most debuggers expect "isDefault" to be sent
in "auxData" field of "executionContextCreated" notification. This stems from
the fact that Node.js sends this data and eg. VSCode requires it to close
connection to the debugger when the program finishes execution.
2022-11-26 23:09:48 +01:00
Bartek Iwańczuk
d8ab492d01
chore: update rusty_v8 to 0.56.1 (#16835) 2022-11-26 20:11:27 +01:00
denobot
72dd7ad807
chore: forward v1.28.2 release commit to main (#16796)
Co-authored-by: bartlomieju <bartlomieju@users.noreply.github.com>
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2022-11-24 23:59:42 +01:00
Ikko Ashimine
04afc06b00
refactor(core): fix typo in ops_builtin.rs (#16613) 2022-11-24 15:22:39 +01:00
Leo Kettmeir
13e3acf71d
chore: workspace inheritance (#16343) 2022-11-22 21:07:35 +01:00
Bartek Iwańczuk
d232746928
feat(core): Ability to create snapshots from existing snapshots (#16597)
Co-authored-by: crowlkats <crowlkats@toaxl.com>
2022-11-21 14:36:26 +01:00
Aaron O'Mullan
238590aa9f
chore: use Rust 1.65.0 (#16688) 2022-11-18 02:59:10 +01:00
denobot
483c10c94b
chore: forward v1.28.1 release commit to main (#16678)
Co-authored-by: bartlomieju <bartlomieju@users.noreply.github.com>
2022-11-17 02:17:19 +01:00
denobot
916598f8a7
1.28.0 (#16620)
Co-authored-by: David Sherret <dsherret@gmail.com>
2022-11-13 15:31:36 -05:00
Bartek Iwańczuk
b88b7c9244
chore: upgrade rusty_v8 to 0.55.0 (#16604)
<!--
Before submitting a PR, please read http://deno.land/manual/contributing

1. Give the PR a descriptive title.

  Examples of good title:
    - fix(std/http): Fix race condition in server
    - docs(console): Update docstrings
    - feat(doc): Handle nested reexports

  Examples of bad title:
    - fix #7123
    - update docs
    - fix bugs

2. Ensure there is a related issue and it is referenced in the PR text.
3. Ensure there are tests that cover the changes.
4. Ensure `cargo test` passes.
5. Ensure `./tools/format.js` passes without changing files.
6. Ensure `./tools/lint.js` passes.
-->
2022-11-12 05:37:37 +01:00
Bartek Iwańczuk
06bd9e9e16
fix(npm): disable npm specifiers in import.meta.resolve() (#16599) 2022-11-11 18:20:13 +01:00
Divy Srivastava
5b9620df7a
feat(ops): implement fast lazy async ops (#16579)
Implements fast scheduling of deferred op futures. 

```rs
#[op(fast)]
async fn op_read(
  state: Rc<RefCell<OpState>>,
  rid: ResourceId,
  buf: &mut [u8],
) -> Result<u32, Error> {
  // ...
}
```

The future is scheduled via a fast API call and polled by the event loop
after being woken up by its waker.
2022-11-11 19:14:53 +05:30
Divy Srivastava
110a0ebe69
perf(core): minimize trivial heap allocations in resolve_async_ops (#16584)
* Use stack allocated array for 16 promises and spill rest to heap. the
exact number can change, maybe 128? (tokio's coop budget limit)
* Avoid v8::Global::clone for global context.
* Do not open global opresolve when its not needed.
2022-11-10 17:26:02 +05:30
denobot
c08fcd96c1
chore: forward v1.27.2 release commit to main (#16572)
Co-authored-by: bartlomieju <bartlomieju@users.noreply.github.com>
2022-11-09 00:27:51 +01:00
Ryan Dahl
3019c45f87
refactor: simplify deno_core's grab_global and ensure_objs (#16564)
- refactor: remove JsRuntime::ensure_objs
- refactor: Replace JsRuntime::grab_global with JsRuntime::eval
2022-11-08 02:39:48 +01:00
denobot
61fbfabe44
chore: forward v1.27.1 release commit to main (#16533)
Co-authored-by: bartlomieju <bartlomieju@users.noreply.github.com>
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2022-11-04 00:40:23 +01:00
Kenta Moriuchi
59ac110edd
fix(core): fix APIs not to be affected by Promise.prototype.then modification (#16326) 2022-10-29 18:25:23 +09:00
Bartek Iwańczuk
e202f890f0
feat(core): support creating snapshots from existing snapshots (#14744) 2022-10-28 21:31:01 +02:00
Divy Srivastava
e18950284f
Reland "perf(core): generate inlined wrappers for async ops" (#16455)
Reland https://github.com/denoland/deno/pull/16428
2022-10-28 16:50:17 +05:30
Divy Srivastava
d9e425a947
chore(core): remove TODO in bindings.rs (#16456) 2022-10-28 11:26:16 +05:30
denobot
b0fb8fa9dc
1.27.0 (#16442)
Co-authored-by: bartlomieju <bartlomieju@users.noreply.github.com>
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2022-10-27 17:13:26 +02:00
Divy Srivastava
115cc1e6ae
Revert "perf(core): generate inlined wrappers for async ops (#16428)" (#16443) 2022-10-27 16:58:27 +02:00
Divy Srivastava
02187966c1
perf(core): generate inlined wrappers for async ops (#16428)
V8's JIT can do a better job knowing the argument count and also enable
fast call path (in future).

This also lets us call async ops without `opAsync`:

```js
const { ops } = Deno.core;
await ops.op_void_async();
```

this patch: 4405286 ops/sec
main: 3508771 ops/sec
2022-10-27 19:10:48 +05:30
Jan Špaček
642118fdeb
fix(core) Include causes when converting anyhow errors to JS exceptions (#16397)
When an op returns an `anyhow` error with a cause (usually added using
the `.context()` method), the `Error` thrown into JavaScript contains
only the message of the outernmost error in the chain.

This PR simply changes the formatting of `anyhow::Error` from `"{}"` to
`"{:#}"`:

This significantly improves errors for code that embeds Deno and defines
custom ops. For example, in
[chiselstrike/chiselstrike](https://github.com/chiselstrike/chiselstrike),
this PR improves an error message like

```
Error: could not plan migration
```

to

```
Error: could not plan migration: could not migrate table for entity "E": could not add column for field "title": the field does not have a default value
```
2022-10-26 17:30:44 +02:00
Bartek Iwańczuk
a57faa8a0a
core: enable --harmony-change-array-by-copy V8 flag (#16429)
Enables [Change Array by copy
proposal](https://github.com/tc39/proposal-change-array-by-copy) via a
V8 flag.
2022-10-26 16:54:22 +02:00
Cre3per
193b8828c5
feat(cli): show error cause recursion information (#16384) 2022-10-26 15:37:45 +02:00
Divy Srivastava
851db03a6e
perf(core): do not drive JsInspector by default (#16410)
Part of https://github.com/denoland/deno/pull/16377
2022-10-26 17:07:50 +05:30
David Sherret
e203bd9c5a
fix: upgrade swc_ecma_parser to 0.122.19 - deno_ast 0.20 (#16406) 2022-10-25 11:55:57 -04:00
Divy Srivastava
f242d98280
perf(core): avoid isolate slots for ModuleMap (#16409) 2022-10-25 17:57:33 +05:30
Marcos Casagrande
34fb380ed3
feat(ext/web): use ArrayBuffer.was_detached() (#16307)
This PR adds a way to reliably check if an ArrayBuffer was detached
2022-10-25 14:22:37 +02:00
Marcos Casagrande
b7d86b4bed
perf(ext/streams): fast path when consuming body of tee'd stream (#16329)
Add a fast path for consuming the body of cloned `Request`/`Response`,
which is very common specially when using `cache` API.
2022-10-24 13:13:20 +02:00
Divy Srivastava
d461a784b2
perf(core): don't access isolate slots for JsRuntimeState (#16376)
example writeFile benchmark:

```
# before
time 188 ms rate 53191
time 168 ms rate 59523
time 167 ms rate 59880
time 166 ms rate 60240
time 168 ms rate 59523
time 173 ms rate 57803
time 183 ms rate 54644

# after
time 157 ms rate 63694
time 152 ms rate 65789
time 151 ms rate 66225
time 151 ms rate 66225
time 152 ms rate 65789
```
2022-10-21 19:43:42 +05:30
Divy Srivastava
0f27b84a5c
chore(core): remove core.opSync (#16379)
This patch removes the last uses of `core.opSync` from Deno.

The new and JIT-friendly way to call sync ops is `core.ops.op_name()`.
2022-10-21 19:35:23 +05:30
Divy Srivastava
c007657cfd
Revert realms from deno_core (#16366)
This revert has been discussed at length out-of-band (including with
@andreubotella). The realms work in impeding ongoing event loop and
performance work. We very much want to land realms but it needs to wait
until these lower-level refactors are complete. We hope to bring realms
back in a couple weeks.
2022-10-21 08:24:22 +05:30
Bartek Iwańczuk
869acee8fb
chore: upgrade rusty_v8 to 0.54.0 (#16368)
<!--
Before submitting a PR, please read http://deno.land/manual/contributing

1. Give the PR a descriptive title.

  Examples of good title:
    - fix(std/http): Fix race condition in server
    - docs(console): Update docstrings
    - feat(doc): Handle nested reexports

  Examples of bad title:
    - fix #7123
    - update docs
    - fix bugs

2. Ensure there is a related issue and it is referenced in the PR text.
3. Ensure there are tests that cover the changes.
4. Ensure `cargo test` passes.
5. Ensure `./tools/format.js` passes without changing files.
6. Ensure `./tools/lint.js` passes.
-->
2022-10-20 21:01:49 +02:00
Divy Srivastava
d3736f12b5
perf(core): avoid creating global handles in op_queue_microtask (#16359) 2022-10-20 16:03:47 +05:30
Yusuke Tanaka
44a89dd6dc
fix(ext/net): return an error from startTls and serveHttp if the original connection is captured elsewhere (#16242)
This commit removes the calls to `expect()` on `std::rc::Rc`, which caused
Deno to panic under certain situations. We now return an error if `Rc`
is referenced by other variables.

Fixes #9360
Fixes #13345
Fixes #13926
Fixes #16241

Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2022-10-18 11:28:27 +09:00
Bartek Iwańczuk
204c46dcc1
chore: forward v1.26.2 to main (#16331)
Co-authored-by: bartlomieju <bartlomieju@users.noreply.github.com>

<!--
Before submitting a PR, please read http://deno.land/manual/contributing

1. Give the PR a descriptive title.

  Examples of good title:
    - fix(std/http): Fix race condition in server
    - docs(console): Update docstrings
    - feat(doc): Handle nested reexports

  Examples of bad title:
    - fix #7123
    - update docs
    - fix bugs

2. Ensure there is a related issue and it is referenced in the PR text.
3. Ensure there are tests that cover the changes.
4. Ensure `cargo test` passes.
5. Ensure `./tools/format.js` passes without changing files.
6. Ensure `./tools/lint.js` passes.
-->

Co-authored-by: denobot <33910674+denobot@users.noreply.github.com>
Co-authored-by: bartlomieju <bartlomieju@users.noreply.github.com>
2022-10-17 23:11:16 +02:00
Cre3per
cf1be5e76f
fix: add error cause in recursive cause tail (#16306) 2022-10-16 21:16:46 +02:00
Bartek Iwańczuk
edaba4d06b
chore: upgrade rusty_v8 to 0.53.1 (#16303)
This commit fixes startup time regression, caused by update
to rusty_v8 v0.50.0.
2022-10-16 13:26:06 +02:00
Andreu Botella
8a736d7dc7
fix(docs): Documentation improvements related to JsRealm. (#16247) 2022-10-15 22:44:51 +02:00
Bartek Iwańczuk
e32719c291
refactor(core): use isolate get_data/set_data instead of slots (#16286) 2022-10-15 16:01:01 +02:00
Bartek Iwańczuk
8283d37c51
bench: avoid port collision (#16285) 2022-10-15 13:35:04 +02:00
Bartek Iwańczuk
e7d7585065
chore: upgrade rusty_v8 to 0.53.0 (#16272) 2022-10-15 01:53:13 +02:00
Luca Casonato
1ab3691b09
feat(core): add Deno.core.writeAll(rid, chunk) (#16228)
This commit adds a new op_write_all to core that allows writing an
entire chunk in a single async op call. Internally this calls
`Resource::write_all`.

The `writableStreamForRid` has been moved to `06_streams.js` now, and
uses this new op. Various other code paths now also use this new op.

Closes #16227
2022-10-10 10:28:35 +02:00
Luca Casonato
3b6b75bb46
feat(core): improve resource read & write traits (#16115)
This commit introduces two new buffer wrapper types to `deno_core`. The
main benefit of these new wrappers is that they can wrap a number of
different underlying buffer types. This allows for a more flexible read
and write API on resources that will require less copying of data
between different buffer representations.

- `BufView` is a read-only view onto a buffer. It can be backed by
`ZeroCopyBuf`, `Vec<u8>`, and `bytes::Bytes`.
- `BufViewMut` is a read-write view onto a buffer. It can be cheaply
converted into a `BufView`. It can be backed by `ZeroCopyBuf` or
`Vec<u8>`.

Both new buffer views have a cursor. This means that the start point of
the view can be constrained to write / read from just a slice of the
view. Only the start point of the slice can be adjusted. The end point
is fixed. To adjust the end point, the underlying buffer needs to be
truncated.

Readable resources have been changed to better cater to resources that
do not support BYOB reads. The basic `read` method now returns a
`BufView` instead of taking a `ZeroCopyBuf` to fill. This allows the
operation to return buffers that the resource has already allocated,
instead of forcing the caller to allocate the buffer. BYOB reads are
still very useful for resources that support them, so a new `read_byob`
method has been added that takes a `BufViewMut` to fill. `op_read`
attempts to use `read_byob` if the resource supports it, which falls
back to `read` and performs an additional copy if it does not. For
Rust->JS reads this change should have no impact, but for Rust->Rust
reads, this allows the caller to avoid an additional copy in many
scenarios. This combined with the support for `BufView` to be backed by
`bytes::Bytes` allows us to avoid one data copy when piping from a
`fetch` response into an `ext/http` response.

Writable resources have been changed to take a `BufView` instead of a
`ZeroCopyBuf` as an argument. This allows for less copying of data in
certain scenarios, as described above. Additionally a new
`Resource::write_all` method has been added that takes a `BufView` and
continually attempts to write the resource until the entire buffer has
been written. Certain resources like files can override this method to
provide a more efficient `write_all` implementation.
2022-10-09 14:49:25 +00:00
Jakub Łabor
7c3df66be7
feat(core): Reorder extension initialization (#16136) 2022-10-07 14:38:06 +02:00
Bartek Iwańczuk
5733de8a2e
chore: upgrade rusty_v8 to 0.52.0 (#16183) 2022-10-07 09:21:56 +05:30
denobot
afeacb8328
chore: forward v1.26.1 release commit to main (#16178)
This is the release commit being forwarded back to main for 1.26.1

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

Don't need this PR? Close it.

cc @cjihrig

Co-authored-by: cjihrig <cjihrig@users.noreply.github.com>
2022-10-06 16:49:40 -04:00
Divy Srivastava
0b016a7fb8
feat(npm): implement Node API (#13633)
This PR implements the NAPI for loading native modules into Deno. 

Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
Co-authored-by: DjDeveloper <43033058+DjDeveloperr@users.noreply.github.com>
Co-authored-by: Ryan Dahl <ry@tinyclouds.org>
2022-10-05 19:36:44 +05:30
Marcos Casagrande
569287b15b
perf(ext/fetch): consume body using ops (#16038)
This commit adds a fast path to `Request` and `Response` that
make consuming request bodies much faster when using `Body#text`,
`Body#arrayBuffer`, and `Body#blob`, if the body is a FastStream.
Because the response bodies for `fetch` are FastStream, this speeds up
consuming `fetch` response bodies significantly.
2022-10-04 15:48:50 +02:00
Darshan Sen
bac3a1210f
fix(serde_v8): serialize objects with numeric keys correctly (#15946)
Signed-off-by: Darshan Sen <raisinten@gmail.com>
2022-10-02 22:18:31 +02:00
Luca Casonato
20c7300412
refactor(ext/http): remove op_http_read (#16096)
We can use Resource::read_return & op_read instead. This allows HTTP
request bodies to participate in FastStream.

To make this work, `readableStreamForRid` required a change to allow non
auto-closing resources to be handled. This required some minor changes
in our FastStream paths in ext/http and ext/flash.
2022-09-30 07:54:12 +02:00
denobot
d8827514ff
1.26.0
Co-authored-by: bartlomieju <bartlomieju@users.noreply.github.com>
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2022-09-29 00:10:44 +02:00
Guilherme Bernal
6c55772f0d
feat(core): add Deno.core.setPromiseHooks (#15475) 2022-09-28 16:09:33 +02:00
Satya Rohith
b312279e58
feat: implement Web Cache API (#15829) 2022-09-28 17:41:12 +05:30
Aapo Alasuutari
b5dfcbbcbe
feat(ops): Fallible fast ops (#15989) 2022-09-23 08:25:37 +05:30
David Sherret
1b04ff0782
chore: forward v1.25.4 release commit to main (#16001) 2022-09-22 15:58:43 -04:00
Aaron O'Mullan
388e880dd0
examples(core): panik (#15983) 2022-09-22 11:00:13 +05:30
Aapo Alasuutari
707e9e3580
feat(ops): Automatic fast ops creation (#15527) 2022-09-22 10:05:24 +05:30
Divy Srivastava
3864961364
perf(core): use single ObjectTemplate for ops in initialize_ops (#15959) 2022-09-19 20:43:34 +05:30
Ben Noordhuis
b1b418b81a
chore: fix clippy warnings (#15944)
Stop allowing clippy::derive-partial-eq-without-eq and fix warnings
about deriving PartialEq without also deriving Eq.

In one case I removed the PartialEq because it a) wasn't necessary,
and b) sketchy because it was comparing floating point numbers.

IMO, that's a good argument for enforcing the lint rule, because it
would most likely have been caught during review if it had been enabled.
2022-09-19 10:25:03 +02:00
Darshan Sen
e7934432ce
chore: upgrade rusty_v8 to v0.50.0 (#15762)
Signed-off-by: Darshan Sen <raisinten@gmail.com>
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2022-09-17 11:55:19 +02:00
Ryan Dahl
684841a18c
upgrade deps (#15914) 2022-09-16 19:11:30 -04:00
Colin Ihrig
ee208c1b20
chore: forward v1.25.3 release commit to main (#15919)
Co-authored-by: denobot <33910674+denobot@users.noreply.github.com>
Co-authored-by: cjihrig <cjihrig@users.noreply.github.com>
2022-09-15 16:24:06 -04:00
Divy Srivastava
a54d5654a2
perf: optimize URL serialization (#15663) 2022-09-10 09:15:16 +05:30
denobot
3bce2af0eb
chore: forward v1.25.2 release commit to main (#15831)
Co-authored-by: kt3k <kt3k@users.noreply.github.com>
2022-09-09 20:31:43 +09:00
Leo Kettmeir
93cbac69e8
chore: update url crate to 2.3.1 (#15818) 2022-09-08 19:04:59 +02:00
David Sherret
9e6917426a
fix: upgrade deno_ast to 0.19 (#15808) 2022-09-07 15:06:18 -04:00
Divy Srivastava
429759fe8b
chore: bump url crate to 2.3.0 (#15800) 2022-09-07 19:07:46 +05:30
Colin Ihrig
3b1204eb2d
fix(core): make errors more resistant to tampering (#15789)
This commit makes error objects more resistant to
prototype tampering.

This bug was found when updating the deno_std Node compatibility
layer to Node 18. The Node test 'parallel/test-assert-fail.js'
was breaking std's assertion library.

Refs: https://github.com/denoland/deno_std/pull/2585
2022-09-07 09:11:16 -04:00
Divy Srivastava
027d4d433d
perf(ops): inline &[u8] arguments and enable fast API (#15731) 2022-09-07 16:21:47 +05:30
Divy Srivastava
d57f9d560d
fix(ext/flash): use utf8 length as Content-Length (#15793) 2022-09-07 16:21:30 +05:30
Aapo Alasuutari
199e6f2a38
fix(core): opAsync leaks a promise on type error (#15795) 2022-09-07 13:50:30 +05:30
Divy Srivastava
d2a408f452
perf(runtime): short-circuit queue_async_op for Poll::Ready (#15773) 2022-09-06 23:08:37 +05:30
Giovanny Gutiérrez
2929ddabaa
fix(core): Register external references for imports to the SnapshotCreator (#15621)
Several functions used for handling of dynamic imports and "import.meta"
object were not registered as external references and caused V8 to crash
during snapshotting. These functions are now registered as external refs
and aborts are no longer happening.
2022-09-06 14:35:04 +02:00
Nayeem Rahman
118dd47ad0
fix(watch): ignore unload errors on drop (#15782) 2022-09-06 13:18:23 +02:00
Nayeem Rahman
4f8dea100e
refactor(test): grab runTests() and runBenchmarks() from __bootstrap (#15420) 2022-09-02 19:44:45 +02:00
Garcia
4ec213b0aa
fix(ext/timers): create primordial eval (#15110) 2022-09-02 17:55:44 +02:00
Nayeem Rahman
a74b2ecf37
fix(repl): don't terminate on unhandled error events (#15548) 2022-09-02 12:43:39 +02:00
denobot
658d2cdff2
chore: forward v1.25.1 release commit to main (#15735)
Co-authored-by: bartlomieju <bartlomieju@users.noreply.github.com>
2022-09-02 07:42:47 +02:00
Andreu Botella
307d84cfa5
refactor(core): Move optional callbacks from JsRuntimeState to ContextState (#15599)
The `JsRuntimeState` struct stores a number of JS callbacks that are
used either in the event loop or when interacting with V8. Some of
these callback fields are vectors of callbacks, and therefore could
plausibly store at least one callback per realm. However, some of
those fields are `Option<v8::Global<v8::Function>>`, which would make
the callbacks set by a realm override the one that might have been set
by a different realm.

As it turns out, all of the current such optional callbacks
(`js_promise_reject_cb`, `js_format_exception_cb` and
`js_wasm_streaming_cb`) are only used from inside a realm, and
therefore this change makes it so such callbacks can only be set from
inside a realm, and will only affect that realm.
2022-09-01 23:01:05 +02:00
Geert-Jan Zwiers
58e76098e6
fix(serde_v8): no panic on reading large text file (#15494)
Co-authored-by: Nayeem Rahman <nayeemrmn99@gmail.com>
2022-09-01 22:20:11 +02:00
Divy Srivastava
e267ec6ed5
chore(serde_v8): take mutable reference in ToV8::to_v8 (#15707) 2022-09-01 15:54:40 +05:30
Divy Srivastava
a7558196a7
perf: use fast api for core.isProxy (#15682) 2022-08-30 14:31:36 +05:30
Divy Srivastava
8e1c0e5141
perf(runtime): optimize allocations in read/write checks (#15631) 2022-08-27 20:50:05 +05:30
Bartek Iwańczuk
8986e2ced4
v1.25.0 2022-08-25 00:20:07 +02:00
Bartek Iwańczuk
86ef743c0f
chore: upgrade rusty_v8 to v0.49.0 (#15547) 2022-08-23 14:51:04 +02:00
Geert-Jan Zwiers
ecf3b51fd9
refactor(core/runtime): clean up extra type cast (#15539) 2022-08-23 09:24:17 +05:30
Giovanny Gutiérrez
5ea51702bd
fix: Free up JsRuntime state global handles before snapshot (#15491) 2022-08-21 21:03:56 +02:00
Nayeem Rahman
97954003cc
feat: queueMicrotask() error handling (#15522)
Adds error event dispatching for queueMicrotask(). Consequently unhandled errors are now reported with Deno.core.terminate(), which is immune to the existing quirk with plainly thrown errors (#14158).
2022-08-21 20:16:42 +02:00
Mathias Lafeldt
e96933bc16
chore: use Rust 1.63.0 (#15464) 2022-08-21 19:31:14 +02:00
Divy Srivastava
906aa78af3
feat(ops): V8 Fast Calls (#15291) 2022-08-21 17:37:53 +05:30
Nayeem Rahman
e39d4e3e7f
fix(core/runtime): always cancel termination in exception handling (#15514) 2022-08-21 13:57:10 +02:00
Divy Srivastava
cd21cff299
feat(ext/flash): An optimized http/1.1 server (#15405)
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
Co-authored-by: Ben Noordhuis <info@bnoordhuis.nl>
Co-authored-by: crowlkats <crowlkats@toaxl.com>
Co-authored-by: Ryan Dahl <ry@tinyclouds.org>
2022-08-18 17:35:02 +05:30
Bartek Iwańczuk
5a4f84a0e1
chore: upgrade rusty_v8 to 0.48.1 (#15310) 2022-08-15 14:12:11 +02:00
denobot
e4a5f9952f
chore: forward v1.24.3 release commit to main (#15462)
Co-authored-by: David Sherret <dsherret@gmail.com>
2022-08-11 16:47:03 -04:00
Aapo Alasuutari
2164f6b1eb
perf(ops): Monomorphic sync op calls (#15337)
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-11 15:56:56 +02:00
Nayeem Rahman
25a1cc1b28
refactor(core): unwrap sync ops in rust (#15449) 2022-08-11 11:57:20 +02:00
Andreu Botella
f16fe44303
feat(core): Add support for async ops in realms (#14734)
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-10 20:04:20 +02:00
denobot
cf33720a85
chore: forward v1.24.2 release commit to main (#15410) 2022-08-05 00:10:47 +02:00
Zach
00b51ca94b
core: remove heapStats type definition (#15393) 2022-08-03 14:41:44 +02:00
Nayeem Rahman
96290f1a66
refactor(core/error): use evaluated call sites for formatting (#15369) 2022-08-01 17:17:55 +02:00
Zicklag
d81c5b51b3
core: Add types for Deno.core.print() (#15283) 2022-07-31 22:15:29 +02:00
Bartek Iwańczuk
20a89d46c4
fix(core): BorrowMutError in nested error (#15352) 2022-07-30 16:09:42 +02:00
Colin Ihrig
088bc52db0
Forward 1.24.1 to main (#15333) (#15336)
1.24.1 (#15333)

Co-authored-by: cjihrig <cjihrig@users.noreply.github.com>
2022-07-29 08:44:46 -04:00
Arthur Silva
5d263c932f
serde_v8: improvements to avoid hitting unimplemented codepaths (#13915) 2022-07-28 12:46:10 +02:00
Bartek Iwańczuk
3d40eee4b2
chore: upgrade rusty_v8 to 0.47.1 (#15324) 2022-07-27 18:45:26 +05:30
Bartek Iwańczuk
2e1d6d3508
refactor(core): remove unneeded ops for uncaughtException (#15296) 2022-07-25 01:10:56 +02:00
Bartek Iwańczuk
504d2936ec
fix: unhandledrejection handling for sync throw in top level (#15279)
Fixes an edge in "unhandledrejection" event that prevent synchronous
errors being surfaced when throw from a top-level scope.
2022-07-23 00:40:42 +02:00
Divy Srivastava
4db650ddd5
Revert "feat(ops): V8 Fast Calls (#15122)" (#15276)
This reverts commit 03dc3b8972.
2022-07-22 19:06:32 +05:30
Divy Srivastava
03dc3b8972
feat(ops): V8 Fast Calls (#15122)
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2022-07-22 17:54:22 +05:30
denobot
f0e01682cc
1.24.0 (#15262)
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2022-07-21 01:28:00 +02:00
Bartek Iwańczuk
d53936eb7d
Reland "feat: add "unhandledrejection" event support" (#15211) 2022-07-20 20:28:19 +02:00
Bartek Iwańczuk
1bdf5a2081
chore: upgrade rusty_v8 to 0.47.0 (#15247) 2022-07-19 21:36:15 +02:00
David Sherret
0ab262b901
feat: emit files on demand and fix racy emit (#15220) 2022-07-19 11:58:18 -04:00
Bartek Iwańczuk
9eb70bdb5f
reland: "fix(core): unhandled rejection in top-level scope" (#15236)
Reland #15204
2022-07-18 21:20:38 +02:00
Bartek Iwańczuk
999cbfb52b
feat: import.meta.resolve() (#15074)
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-18 20:05:26 +02:00
Bartek Iwańczuk
0f6b455c96
Revert "fix(core): unhandled rejection in top-level scope (#15204)" (#15226)
This reverts commit 48a7312f38.
2022-07-18 12:52:54 +02:00
Bartek Iwańczuk
f9b692e68e
Revert "feat: add "unhandledrejection" event support (#12994) (#15080)" (#15210)
This reverts commit 1a7259b04b.
2022-07-15 01:06:20 +02:00
Bartek Iwańczuk
1a7259b04b
feat: add "unhandledrejection" event support (#12994) (#15080)
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-14 22:39:20 +02:00
Bartek Iwańczuk
48a7312f38
fix(core): unhandled rejection in top-level scope (#15204)
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-14 21:01:08 +02:00
Bartek Iwańczuk
2423f83ca8
chore: upgrade rusty_v8 to v0.46.0 (#15200) 2022-07-14 12:03:31 +02:00
Colin Ihrig
7610764980
chore: forward v1.23.4 release commit to main (#15172)
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-12 17:08:36 -04:00
David Sherret
687c712be3
fix: upgrade deno_ast to 0.17 (#15152) 2022-07-11 14:10:12 -04:00
Andreu Botella
018ad9b3a4
chore(web, worker): Use DetachedBuffer for postMessage ops (#15133)
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-11 17:27:33 +02:00
Andreu Botella
83c9714fb2
chore(core): Deduplicate code related to op_event_loop_has_more_work (#15147)
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-11 12:08:37 +02:00
Aapo Alasuutari
3da182b0b8
fix(ext/ffi): Avoid keeping JsRuntimeState RefCell borrowed for event loop middleware calls (#15116) 2022-07-09 11:49:20 +02:00
Divy Srivastava
20cbd7f0f8
perf(ext/ffi): leverage V8 Fast Calls (#15125) 2022-07-08 23:19:09 +05:30
Divy Srivastava
b3b3018273
chore: upgrade rusty_v8 to 0.45.0 (#15123) 2022-07-08 18:25:54 +02:00
Bartek Iwańczuk
870eb0df81
fix(core): deflake WASM termination test (#15103) 2022-07-07 16:28:29 +02:00
Andreu Botella
f0ef15ff07
refactor(core): Use &mut Isolate as an argument in JsRealm methods (#15093)
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-06 00:45:10 +02:00
Arthur Silva
cdba53a73d
feat(core): Re-export v8 use_custom_libcxx feature (#14475) 2022-07-05 23:01:41 +02:00
David Sherret
1cc59e6c5c chore: unpin pin project to fix cargo publish (#15085) 2022-07-05 14:24:40 -04:00
denobot
ef312e0050 1.23.3 (#15081)
Co-authored-by: David Sherret <dsherret@gmail.com>
2022-07-05 14:24:40 -04:00
Bartek Iwańczuk
06934db883
Revert "feat: add "unhandledrejection" event support (#12994)" (#15075)
This reverts commit f7af0b01a5.
2022-07-04 23:34:39 +02:00
Bartek Iwańczuk
f7af0b01a5
feat: add "unhandledrejection" event support (#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-04 21:14:58 +02:00
Bartek Iwańczuk
b8b82c3ea4
chore: use Rust 1.62.0 (#15028) 2022-07-01 15:28:06 +02:00
João Avelino Bellomo Filho
77c25beaa5
fix(core): handle exception from Wasm termination (#15014)
Co-authored-by: Augusto Lenz <augustollenz@gmail.com>
2022-07-01 09:51:29 +02:00
Nugine
a27acbc2ec
fix(core): remove unsafe in OpsTracker (#15025) 2022-07-01 00:43:25 +02:00
David Sherret
3d8ba30ea0
chore: forward 1.23.2 to main (#15027)
Co-authored-by: David Sherret <dsherret@gmail.com>
2022-06-30 18:01:08 -04:00
Divy Srivastava
79c5b84eab
chore: upgrade rusty_v8 to 0.44.3 (#15019) 2022-06-30 14:17:39 +05:30
Colin Ihrig
0f6a5c5fc2
feat(web): add beforeunload event (#14830)
This commit adds the 'beforeunload' event.

Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2022-06-28 10:49:30 -04:00