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

658 commits

Author SHA1 Message Date
heddi.nabbisen
beba52c17c
docs: fix a tiny typo (#10535) 2021-05-09 11:39:44 +10:00
Aaron O'Mullan
d5f39fd121
cleanup(ops): remove unused ZeroCopyBuf arg-types (#10530) 2021-05-08 14:37:42 +02:00
Elias Sjögreen
4ed1428c34
fix: align plugin api with Extension (#10427) 2021-05-07 09:45:07 -04:00
Aaron O'Mullan
1e8e44f4c3
refactor(ops): replace ZeroCopyBuf arg by 2nd generic deserializable arg (#10448) 2021-05-06 19:32:03 +02:00
Aaron O'Mullan
d21380728f
fix(core): error registration could pollute constructors (#10422)
Co-authored-by: Luca Casonato <lucacasonato@yahoo.com>
2021-05-03 17:30:41 +02:00
Aaron O'Mullan
3a37444cb5
fix(core/print): flush stderr (#10480) 2021-05-03 14:51:32 +02:00
Aaron O'Mullan
ea917384fe
refactor(core): convert core.print() to a builtin op (#10436) 2021-05-02 19:30:03 -04:00
Aditya Pandit
012da3ae1e
fix(core): fix typo in error message of print function (#10456) 2021-05-01 23:20:20 +09:00
Aaron O'Mullan
c5be20aa67
cleanup(core): use ZeroCopyBuf for serialize & encode bindings (#10435) 2021-04-30 21:09:58 -04:00
Aaron O'Mullan
578f2ba45e
refactor(core): provide builtins as an Extension (#10449) 2021-04-30 21:08:29 -04:00
Andy Hayden
684c357136
Rename crate_ops to extensions (#10431) 2021-04-30 15:51:48 -04:00
Aaron O'Mullan
fc9c7de94b
cleanup(core): replace OpResponse with OpResult (#10434)
Drop the Value/Buffer enum since #10432 allows buffers to be serialized rust => v8
2021-04-30 10:51:54 -04:00
Aaron O'Mullan
5ec478b5fa
refactor(core): initialize extensions in runtime constructor (#10421)
This ensures that provided extensions are all correctly setup and ready to use once the JsRuntime constructor returns

Note: this will also initialize ops for to-be-snapshotted runtimes
2021-04-30 10:38:35 -04:00
Aaron O'Mullan
4e6790a5fa
feat(serde_v8): ZeroCopyBuf (#10432)
Bidirectional zero-copy serialization of buffers between v8 & rust
that can be nested in structs/tuples/etc.
2021-04-30 08:42:09 -04:00
Aaron O'Mullan
8922639c1d
refactor(core.js): provide window.__bootstrap (#10423) 2021-04-30 08:13:23 -04:00
Aaron O'Mullan
e89295b176
refactor(extensions): reintroduce builder (#10412) 2021-04-28 18:16:45 -04:00
Ryan Dahl
e63c533154
enable error-on-warning (#10410)
Only on linux and osx. Fixes one warning.
2021-04-28 15:10:44 -04:00
Aaron O'Mullan
0260b488fb
core: introduce extensions (#9800)
Extensions allow declarative extensions to "JsRuntime" (ops, state, JS or middleware).

This allows for:
- `op_crates` to be plug-and-play & self-contained, reducing complexity leaked to consumers
- op middleware (like metrics_op) to be opt-in and for new middleware (unstable, tracing,...)
- `MainWorker` and `WebWorker` to be composable, allowing users to extend workers with their ops whilst benefiting from the other infrastructure (inspector, etc...)

In short extensions improve deno's modularity, reducing complexity and leaky abstractions for embedders and the internal codebase.
2021-04-28 18:41:50 +02:00
Bartek Iwańczuk
b28f9445aa
refactor(core): simplify module loading code (#10385)
General cleanup of module loading code, tried to reduce indentation in various methods
on "JsRuntime" to improve readability.

Added "JsRuntime::handle_scope" helper function, which returns a "v8::HandleScope".
This was done to reduce a code pattern that happens all over the "deno_core".

Additionally if event loop hangs during loading of dynamic modules a list of
currently pending dynamic imports is printed.
2021-04-28 18:28:46 +02:00
Satya Rohith
2bd087ab1b
chore: upgrade dprint plugins (#10397) 2021-04-28 10:08:51 -04:00
Bert Belder
299518d935 fix(tls): throw meaningful error when hostname is invalid (#10387)
`InvalidDNSNameError` is thrown when a string is not a valid hostname,
e.g. it contains invalid characters, or starts with a numeric digit. It
does not involve a (failed) DNS lookup.
2021-04-26 23:40:45 +02:00
Casper Beyer
e4e7d957e8
feat(core): enable wasm threading support (#10116) 2021-04-26 17:54:07 +02:00
Ryan Dahl
9c3da280e0
remove #![deny(warnings)] (#10376)
Prefer RUSTFLAGS="-D warnings" to prevent warnings, but cannot 
enable yet due to #10378.
2021-04-26 10:10:57 -04:00
Aaron O'Mullan
83bece56b0
refactor(core): move op cache sync responsibility to rust space (#10340)
Even if bootstrapping the JS runtime is low level, it's an abstraction leak of 
core to require users to call `Deno.core.ops()` in JS space.

So instead we're introducing a `JsRuntime::sync_ops_cache()` method, 
once we have runtime extensions a new runtime will ensure the ops 
cache is setup (for the provided extensions) and then loading/unloading 
plugins should be the only operations that require op cache syncs
2021-04-25 22:00:05 +02:00
Aaron O'Mullan
1c7164257d
refactor(core): move builtin ops to their own file (#10336) 2021-04-25 19:23:22 +02:00
Aaron O'Mullan
c130cbb7b7
feat(core): allow async opcalls in snapshots (#10308) 2021-04-25 18:57:48 +02:00
Anssi Eteläniemi
c14bd77086
docs: updated link (#10345) 2021-04-24 09:45:40 -04:00
Aaron O'Mullan
dd156e886b
refactor(core): rename send() to opcall() (#10307)
I think it's a better fit since recv() was killed and opcall <> syscall (send/recv 
was too reminiscent of request/response and custom payloads)
2021-04-23 11:50:45 -04:00
Luca Casonato
52d316f143
chore: release crates (#10327)
Release crates for the cli 1.9.2 release.
2021-04-23 15:05:12 +02:00
Ryan Dahl
1f821dd5e5
chore: remove dead code (#10321) 2021-04-23 10:39:02 +10:00
Aaron O'Mullan
ff9ff4a377
refactor(core): simplify error handling (#10297)
- register builtin v8 errors in core.js so consumers don't have to
- remove complexity of error args handling (consumers must provide a 
  constructor with custom args, core simply provides msg arg)
2021-04-21 20:50:50 -04:00
Aaron O'Mullan
89bb774010
refactor(core): kill recv() and init() (#10299)
`init()` was previously needed to init the shared queue, but now that it's
gone `init()` only registers the async msg handler which is snapshot 
safe and constant since the op layer refactor.
2021-04-21 20:48:17 -04:00
Bartek Iwańczuk
3432833574
chore: release crates (#10269)
* Revert "tooling(bench_util): benching and profiling utilities (#10223)"

This reverts commit 733a000305.

* Upgrade notify
2021-04-21 00:15:39 +02:00
Yoshiya Hinosawa
8424647d22
chore: update copyright headers (#10243) 2021-04-20 14:27:36 +09:00
Aaron O'Mullan
167f017ca0
refactor(core): move SerializablePkg to serde_v8 (#10231) 2021-04-19 15:19:49 +02:00
Aaron O'Mullan
5b31d0f846
cleanup(core): simplify op_async(), drop need for try_dispatch_op() (#10240) 2021-04-18 15:29:06 +02:00
Aaron O'Mullan
733a000305
tooling(bench_util): benching and profiling utilities (#10223) 2021-04-18 14:51:48 +02:00
Aaron O'Mullan
8fb1af1412
refactor(core): remove ZeroCopyBuf's dep on the bindings mod (#10232)
Also cleanup `bindings::deserialize()/decode()` so they 
use the `ZeroCopyBuf` abstraction rather than reimplementing it.

This cleanup will facilitate moving `ZeroCopyBuf` to `serde_v8` 
since it's now self contained and there are no other 
`get_backing_store_slice()` callers.
2021-04-18 14:39:26 +02:00
Ben Noordhuis
ad7f6d4510
fix(core): better "missing type" GothamState error (#10189)
Include the type name in the error message so you know what to look for.
2021-04-14 23:11:39 +02:00
Bartek Iwańczuk
1be65bbe4f
chore: release crates (#10164) 2021-04-13 18:22:48 +02:00
Casper Beyer
ec1fce58d9
fix(core): remove wasm-test-streaming flag (#10158) 2021-04-13 06:20:05 -04:00
Bert Belder
36f147364a
upgrade: rusty_v8 0.22.1 (V8 9.1.269.5) (#10159) 2021-04-13 08:47:24 +00:00
Bert Belder
b9f758d3ad upgrade: rusty_v8 0.22.0 (V8 9.1.269.2) (#10152) 2021-04-13 02:54:36 +02:00
Aaron O'Mullan
2eafbf2b98
perf(core/ops): avoid allocs when returning primitives (#10149) 2021-04-12 17:38:26 -04:00
Ben Noordhuis
73b7bd92e5 core: remove some unnecessary heap allocations 2021-04-12 22:03:32 +02:00
Ben Noordhuis
986513c080 core: let embedders plug in their own V8 platform
Fixes #9912.
2021-04-12 22:03:32 +02:00
Aaron O'Mullan
46b1c653c0
refactor(deno): remove concept of bin & json ops (#10145) 2021-04-12 15:55:05 -04:00
Aaron O'Mullan
bf99039ea9
feat: Add Deno.memoryUsage() (#9986) 2021-04-12 10:47:44 +02:00
Aaron O'Mullan
29eca72fea
core: avoid async op future reboxing to bundle PromiseId (#10123) 2021-04-11 07:05:43 +02:00
Aaron O'Mullan
0fd1fb9329
perf: use BTreeMap for ResourceTable (#10074) 2021-04-09 14:07:24 -04:00
Aaron O'Mullan
0b4cb29386
perf(core): use BTreeMap for GothamState (#10073)
This commit replaces GothamState's internal HashMap 
with a BTreeMap to improve performance.

OpState/GothamState keys by TypeId which is essentially 
an opaque u64. For small sets of integer keys BTreeMap 
outperforms HashMap mainly since it removes the hashing 
overhead and Eq/Comp on integer-like types is very cheap, 
it should also have a smaller memory footprint.

We only use ~30 unique types and thus ~30 unique keys to 
access OpState, so the keyset is small and immutable 
throughout the life of a JsRuntime, there's no meaningful 
churn in keys added/removed.
2021-04-09 19:49:11 +02:00
Nayeem Rahman
c86ee742a2
fix: async op error stacktraces (#10080)
Co-authored-by: Aaron O'Mullan <aaron.omullan@gmail.com>
2021-04-09 11:55:33 -04:00
Luca Casonato
4e70ff80c2
chore: update deps (#10058)
This commit updates crate dependencies.
2021-04-08 18:46:14 +02:00
Inteon
d050b491b1
fix(core): error handling in examples (#9867) 2021-04-08 18:04:02 +02:00
Aaron O'Mullan
2865f39bec
perf(core.js): introduce promise ring (#9979)
This is another optimization to help improve the baseline overhead 
of async ops. It shaves off ~55ns/op or ~7% of the current total 
async op overhead.

It achieves these gains by taking advantage of the sequential 
nature of promise IDs and optimistically stores them sequentially 
in a pre-allocated circular buffer and fallbacks to the promise Map 
for slow to resolve promises.
2021-04-07 14:38:54 +02:00
Aaron O'Mullan
91e80ada8a
core: remove serde_json-isms in op_close() and op_resources() (#10026)
Core no longer uses `serde_json` now, besides re-exporting it or in the module specifier tests
2021-04-05 23:17:00 -04:00
Nayeem Rahman
1312a57984
fix: Properly await already evaluating dynamic imports (#9984) 2021-04-04 07:26:00 -04:00
Aaron O'Mullan
19d0e6b671
perf(serde_v8): introduce Serializable boxable object (#9983) 2021-04-04 01:17:02 +02:00
Ryan Dahl
d2fbbfbbf3
refactor: don't call Context::Global in async_op_response (#9971) 2021-04-03 14:33:01 +02:00
Aaron O'Mullan
22cef71c4e
core/op_baseline: drop BufVec and minor cleanup (#9969) 2021-04-02 17:36:01 +02:00
Aaron O'Mullan
ee3aa612aa
perf: bench async op baseline (#9954) 2021-04-02 16:06:30 +02:00
Aaron O'Mullan
058579da56
refactor(ops): remove variadic buffers (#9944) 2021-04-02 09:47:57 -04:00
Kitson Kelly
df1d36a759 chore: bump dependent crates for cli (#9964) 2021-04-02 22:22:08 +11:00
Aaron O'Mullan
6eace4de5c
perf(core): js errors as unions vs tuples to reduce allocs (#9947) 2021-04-01 07:24:30 -04:00
Aaron O'Mullan
fec1b2a5a4
refactor: new optimized op-layer using serde_v8 (#9843)
- Improves op performance.
- Handle op-metadata (errors, promise IDs) explicitly in the op-layer vs
  per op-encoding (aka: out-of-payload).
- Remove shared queue & custom "asyncHandlers", all async values are
  returned in batches via js_recv_cb.
- The op-layer should be thought of as simple function calls with little
  indirection or translation besides the conceptually straightforward
  serde_v8 bijections.
- Preserve concepts of json/bin/min as semantic groups of their
  inputs/outputs instead of their op-encoding strategy, preserving these
  groups will also facilitate partial transitions over to v8 Fast API for the
  "min" and "bin" groups
2021-03-31 10:37:38 -04:00
Aaron O'Mullan
7efea6cc20
perf: add op_baseline bench (#9924) 2021-03-30 16:20:45 +02:00
Aaron O'Mullan
699eeebc12
refactor(core): decode JsStackFrames using serde_v8 (#9902) 2021-03-27 01:25:48 +01:00
Ryan Dahl
f46e39c5c5
remove macro_use (#9884) 2021-03-26 12:34:25 -04:00
Aaron O'Mullan
505db5da2c
refactor(core): simplify heapStats() by using serde_v8 (#9901) 2021-03-26 09:09:22 -04:00
Ryan Dahl
9f9db6accd
chore: publish serde_v8, bump version (#9898) 2021-03-26 08:51:38 +01:00
Aaron O'Mullan
3d2e05dc7b
Introduce serde_v8 (#9722) 2021-03-25 22:36:46 -04:00
Yusuke Tanaka
e7954413e1
upgrade: Rust 1.51.0 (#9895) 2021-03-25 19:17:37 +01:00
Kitson Kelly
5ebb401703
feat(lsp): add import completions (#9821) 2021-03-25 11:13:37 +11:00
Aaron O'Mullan
876f075dde
feat(core): Deno.core.heapStats() (#9659)
This commit implements "Deno.core.heapStats()" function 
that allows to programatically measure isolate heap-usage.
2021-03-23 15:33:06 +01:00
Bartek Iwańczuk
c08284ab9d
chore: release crates (#9847) 2021-03-21 16:10:08 +01:00
Andrew Mitchell
c00872c0c0
fix(core): don't panic on invalid arguments for Deno.core.print (#9834) 2021-03-21 08:52:28 -04:00
Inteon
1251c89321
refactor: Move bin ops to deno_core and unify logic with json ops (#9457)
This commit moves implementation of bin ops to "deno_core" crates
as well as unifying logic between bin ops and json ops to reuse
as much code as possible (both in Rust and JavaScript).
2021-03-20 17:51:08 +01:00
Ryan Dahl
0d26a82ea9
upgrade: tokio 1.4.0 (#9842) 2021-03-20 11:51:27 -04:00
Divy Srivastava
91ca58fb26
chores: enforce type ResourceId across codebase (#9837) 2021-03-19 13:25:37 -04:00
Inteon
20627c9136
refactor: update minimal ops & rename to buffer ops (#9719)
This commit rewrites "dispatch_minimal" into "dispatch_buffer".

It's part of an effort to unify JS interface for ops for both json
and minimal (buffer) ops.

Before this commit "minimal ops" could be either sync or async
depending on the return type from the op, but this commit changes
it to have separate signatures for sync and async ops (just like 
in case of json ops).
2021-03-18 14:10:27 +01:00
Yusuke Tanaka
c8fbf6d38a
chore: upgrade to tokio 1.3.0 (#9778) 2021-03-14 10:03:24 -04:00
Ben Noordhuis
10b99e8eb0
refactor: simplify icu data alignment (#9766) 2021-03-12 23:55:32 +01:00
Luca Casonato
fbec6e39c7
chore: bump crates (#9769) 2021-03-12 22:29:07 +01:00
Ryan Dahl
2f9d7c02dc
upgrade: rusty_v8 0.21.0 (#9725) 2021-03-10 15:16:43 -05:00
Bartek Iwańczuk
cdc0b6958d
chore: release crates (#9731) 2021-03-09 20:12:13 +01:00
Inteon
4cd1f3d2b2
fix(core): shared queue assertion failure in case of js error (#9721)
In case JavaScript throws an unhandled error, part of the "shared_queue" could
be still unprocessed.

If this is the case; throw the js runtime error instead of asserting on the 
queue size not being 0.
2021-03-08 15:53:39 +01:00
Nayeem Rahman
0f2121355f
fix(runtime/web_worker): Don't block self.onmessage with TLA (#9619)
This commit rewrites implementation of "JsRuntime::mod_evaluate". 

Event loop is no longer polled automatically and users must manually
drive event loop forward after calling "mod_evaluate".

Co-authored-by: Nayeem Rahman <nayeemrmn99@gmail.com>
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2021-03-04 13:19:47 +01:00
Ryan Dahl
f1fe6a57ba
Bump crate versions (#9651) 2021-03-02 15:15:43 -05:00
Ryan Dahl
3d87198ba0
Upgrade rusty_v8 (V8 9.0.257.3) (#9605) 2021-02-25 19:22:01 -05:00
Luca Casonato
975705a649
chore(core): optional args for registerErrorClass (#9602) 2021-02-25 20:06:06 +01:00
Bartek Iwańczuk
dc3683c7a4
refactor(core): cleanup module implementation (#9580)
* remove "ModuleNameMap", instead define that map inline inside "Modules" struct
* remove "dyn_import_id" argument from "mod_instantiate"
* rename "Modules" struct to "ModuleMap"
* rename "JsRuntime::modules" to "JsRuntime::module_map"
2021-02-23 15:22:55 +01:00
Inteon
dccf5e0c5c
refactor(core): Allow multiple overflown responses in single poll (#9433)
This commit rewrites "JsRuntime::poll" function to fix a corner case that
might caused "overflown_response" to be overwritten by other overflown response.

The logic has been changed to allow returning multiple overflown response
alongside responses from shared queue.
2021-02-23 13:08:50 +01:00
Nayeem Rahman
14ec22e880
fix(core/bindings): Add stacks for dynamic import resolution errors (#9562) 2021-02-21 16:22:06 +01:00
Nayeem Rahman
10fb25db63
fix(core/runtime): Fix dynamic imports for already rejected modules (#9559) 2021-02-20 22:50:13 +01:00
Luca Casonato
4f80587d26
chore: rename default branch to main (#9503) 2021-02-19 15:58:19 +01:00
Nayeem Rahman
555595e6d0
fix(core): Make dynamic import async errors catchable (#9505)
Fixes #6259
2021-02-19 09:36:02 +11:00
Ryan Dahl
c7dabc99ee
Make ModuleSpecifier a type alias, not wrapper struct (#9531) 2021-02-17 13:47:18 -05:00
Inteon
e2a91190c3
feat: add structured cloning to Deno.core (#9458)
This commit adds two new "Deno.core" APIs:
- "Deno.core.serialize"
- "Deno.core.deserialize"

These APIs are used to provide structured cloning of values
and will be used for further web worker implementation.

Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2021-02-16 14:20:21 +01:00
Bartek Iwańczuk
0cf952e7fb
upgrade: rusty_v8 0.19.0 (#9466)
Co-authored-by: Ryan Dahl <ry@tinyclouds.org>
2021-02-15 17:32:08 +01:00
Aaron O'Mullan
1afe6b48e0
refactor(core): Reduce verbosity of binding core functions (#9497) 2021-02-15 12:53:33 +01:00