1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-11-01 09:24:20 -04:00
Commit graph

998 commits

Author SHA1 Message Date
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
Aapo Alasuutari
00f4521b20
feat(ext/ffi): Thread safe callbacks (#14942) 2022-06-28 14:53:36 +05:30
Luca Casonato
8d82ba7299
build: require safety comments on unsafe code (#13870)
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
Co-authored-by: Divy Srivastava <dj.srivastava23@gmail.com>
2022-06-26 00:13:24 +02:00
Andreu Botella
38505db391
fix(modules): Immediately resolve follow-up dyn imports to a dyn imported 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-25 20:56:29 +02:00
Divy Srivastava
18c9a7ad64
fix(core): don't panic on non-existent cwd (#14957)
Co-authored-by: cjihrig <cjihrig@gmail.com>
2022-06-25 09:21:58 +05:30
Kayla Washburn
215f3d4c8e
v1.23.1 (#14954)
1.23.1 (#14952)

Co-authored-by: aslilac <aslilac@users.noreply.github.com>
Co-authored-by: Kayla Washburn <mckayla@hey.com>

Co-authored-by: denobot <33910674+denobot@users.noreply.github.com>
Co-authored-by: aslilac <aslilac@users.noreply.github.com>
2022-06-23 15:27:41 -06:00
Bartek Iwańczuk
13f47ec41b
chore: upgrade rusty_v8 to 0.44.2 (#14947) 2022-06-23 15:49:28 +02:00
David Sherret
ca4385ad68
fix: upgrade swc via deno_ast 0.16 (#14930) 2022-06-22 15:42:08 -04:00
Nayeem Rahman
79b42808a4
perf(core): Cache source lookups (#14816)
Keep a cache for source maps and source lines. 

We sort of already had a cache argument for source map lookup 
functions but we just passed an empty map instead of storing it. 

Extended it to cache source line lookups as well and plugged it 
into runtime state.
2022-06-20 14:42:20 +02:00
Christian Dürr
94d369ebc6
docs: Improve mod_evaluate documentation (#14827) 2022-06-20 14:40:57 +02:00
denobot
e7ea4edc8a
1.23.0 (#14878)
* 1.23.0

* docs(Releases.md): update a few items for 1.23

* docs(Releases.md): revert bad formatting

Co-authored-by: aslilac <aslilac@users.noreply.github.com>
Co-authored-by: McKayla Washburn <mckayla@hey.com>
2022-06-15 17:02:18 -06:00
Ryan Dahl
d0dec8d36b
chore: upgrade various deps (#14876)
Co-authored-by: David Sherret <dsherret@gmail.com>
2022-06-15 13:48:53 -04:00
Ryan Dahl
3d2394954c
upgrade: v8 10.4.132.5 (#14874) 2022-06-15 12:30:19 -04:00
Colin Ihrig
cf866c5ad3
chore: Forward v1.22.3 to main (#14835)
* 1.22.3 (#14832)
* chore: pin swc versions to fix cargo publish

Co-authored-by: denobot <33910674+denobot@users.noreply.github.com>
Co-authored-by: cjihrig <cjihrig@users.noreply.github.com>
Co-authored-by: David Sherret <dsherret@gmail.com>
2022-06-09 16:57:16 -04:00
Bartek Iwańczuk
99f525a66c
refactor(core): SourceMapGetter doesn't need Send + Sync (#14808) 2022-06-07 17:26:08 +02:00
Nayeem Rahman
9385a91312
refactor(core): Move Deno.core bindings to ops (#14793) 2022-06-07 11:25:10 +02:00
Nayeem Rahman
e3eae662f3
fix: Format non-error exceptions (#14604)
This commit adds "Deno.core.setFormatExceptionCallback" which
can be used to provide custom formatting for errors. It is useful
in cases when user throws something that is non-Error (eg.
a string, plain object, etc).
2022-06-06 20:26:57 +02:00
Bartek Iwańczuk
de562b0215
chore: Forward v1.22.2 to main (#14785) 2022-06-02 22:29:41 +02:00
Andreu Botella
01e5bbadac
test(core): Test that sync ops return/throw objects in the right realm (#14750)
This behavior was introduced in #14019 but wasn't properly tested in
that PR.
2022-05-30 13:18:32 +02:00
Kitson Kelly
1c44f4060e
1.22.1
Co-authored-by: Kitson Kelly <me@kitsonkelly.com>

Co-authored-by: denobot <33910674+denobot@users.noreply.github.com>
2022-05-27 17:36:43 +10:00
Mark Ladyshau
402b497299
fix(core): rethrow exception during structured cloning serialization (#14671)
- Introduced optional callback for Deno.core.serialize API, that returns
cloning error if there is one.
- Removed try/catch in seralize structured clone function and throw error from
callback.
- Removed "Object with a getter that throws" assertion from WPT.
2022-05-26 17:14:38 +02:00
Bartek Iwańczuk
3aa6d5d8b0
chore: upgrade rusty_v8 to 0.43.1 (#14713) 2022-05-26 13:13:01 +02:00
Aaron O'Mullan
5e62ee31d7
fix(core): op metrics op_names mismatch (#14716) 2022-05-24 22:21:32 +02:00
David Sherret
1fcecb6789
refactor: upgrade to deno_ast 0.15 (#14680) 2022-05-20 16:40:55 -04:00
denobot
5ad8919d64
1.22.0 (#14657)
Co-authored-by: Divy Srivastava <dj.srivastava23@gmail.com>
2022-05-18 20:35:16 +05:30
Aaron O'Mullan
9766399a3f
fix(core): support classifying ENOTDIR (#14646) 2022-05-17 19:20:57 +02:00
Divy Srivastava
68bf43fca7
feat(core): deterministic snapshots (#14037) 2022-05-17 20:49:55 +05:30
Aaron O'Mullan
8744ee883e
perf(core): optimize encode on large strings (#14619)
Follow up to serde_v8's #14450
2022-05-15 17:52:32 +02:00
Aaron O'Mullan
f5c31b56e3
Revert "core: don't include_str extension js code (#10786)" (#14614)
This reverts commit 10e50a1207

Alternative to #13217, IMO the tradeoffs made by #10786 aren't worth it.

It breaks abstractions (crates being self-contained, deno_core without snapshotting etc...) and causes pain points / gotchas for both embedders & devs for a relatively minimal gain in incremental build time ...

Closes #11030
2022-05-15 13:27:56 +02:00
Divy Srivastava
20ee3110d8
chore: upgrade rusty_v8 to 0.42.1 (#14597) 2022-05-14 15:26:31 +05:30
Andreu Botella
3e7afb8918
chore(runtime): Make some ops in ext and runtime infallible. (#14589)
Co-authored-by: Aaron O'Mullan <aaron.omullan@gmail.com>
2022-05-13 10:36:31 +02:00
Aaron O'Mullan
c6063e390a
feat(ops): infallible / result-free ops (#14585) 2022-05-12 19:13:25 +02:00
Aaron O'Mullan
5e6d3d42c7
feat(ops): #[op(v8)] (#14582) 2022-05-12 19:06:42 +02:00
Bert Belder
89b428234c
1.21.3 (#14584) 2022-05-12 18:43:00 +02:00
Aaron O'Mullan
d0f5cd6a06
fix(core): avoid panic on non-string Error.name (#14529)
Fixes #14518
2022-05-08 23:03:00 +02:00
Bartek Iwańczuk
bcd875030a
refactor(core): add AssertedModuleType enum (#14501)
Co-authored-by: Luca Casonato <hello@lcas.dev>
2022-05-07 18:46:35 +02:00
Colin Ihrig
23c77df664
1.21.2 (#14508)
1.21.2
2022-05-05 19:37:27 -04:00
Bartek Iwańczuk
45a4d75296
refactor(core): use Box<u8> for ModuleSource.code instead of a String (#14487) 2022-05-05 13:16:25 +02:00
Luca Casonato
242273e69b
chore: update deps (#14416) 2022-05-05 12:41:59 +02:00
Bartek Iwańczuk
3f08a40412
refactor: add core.formatLocationFilename, remove op_format_filename (#14474)
This commit moves "op_format_location" to "core/ops_builtin.rs"
and removes "Deno.core.createPrepareStackTrace" in favor of
"Deno.core.prepareStackTrace".

Co-authored-by: Aaron O'Mullan <aaron.omullan@gmail.com>
2022-05-03 19:45:57 +02:00
Leo Kettmeir
de2004dec5
Forward 1.21.1 (#14428) 2022-04-28 23:32:42 +02:00
Nayeem Rahman
9853c96cc4
refactor: Remove PrettyJsError and js_error_create_fn (#14378)
This commit:
- removes "fmt_errors::PrettyJsError" in favor of "format_js_error" fn
- removes "deno_core::JsError::create" and 
"deno_core::RuntimeOptions::js_error_create_fn"
- adds new option to "deno_runtime::ops::worker_host::init"
2022-04-27 01:06:10 +02:00
Nayeem Rahman
74175c039a
refactor(core): Remove ErrWithV8Handle (#14394) 2022-04-26 15:28:42 +02:00
Aaron O'Mullan
12f7581ed9
cleanup(serde_v8): disambiguate ZeroCopyBuf (#14380) 2022-04-25 16:56:47 +02:00
Luca Casonato
1ad8c11bc9
chore: bump crates (#14365) 2022-04-22 16:54:42 +02:00
Divy Srivastava
57f7e07c13
Reland "perf(http): optimize ReadableStreams backed by a resource" (#14346) 2022-04-22 16:19:08 +05:30
denobot
29c8cd8aae
1.21.0 (#14336)
Co-authored-by: ry <ry@users.noreply.github.com>
Co-authored-by: David Sherret <dsherret@gmail.com>
2022-04-20 21:50:16 -04:00
Bartek Iwańczuk
03019e7781
Revert various PRs related to "ext/http" (#14339)
* Revert "feat(ext/http): stream auto resp body compression (#14325)"
* Revert "core: introduce `resource.read_return` (#14331)"
* Revert "perf(http): optimize `ReadableStream`s backed by a resource (#14284)"
2022-04-21 02:22:55 +02:00
Ryan Dahl
78c9cd9789
upgrade: rusty_v8 0.42.0 (#14334) 2022-04-20 19:13:31 -04:00
Divy Srivastava
2612b6f20f
core: introduce resource.read_return (#14331) 2022-04-20 18:39:13 +02:00
David Sherret
a64e63c361
perf: move Deno.writeTextFile and like functions to Rust (#14221)
Co-authored-by: Luca Casonato <hello@lcas.dev>
2022-04-18 18:00:14 -04:00