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

146 commits

Author SHA1 Message Date
Nayeem Rahman
e8ee5da459
fix(core/bindings): use is_instance_of_error() instead of is_native_error() (#12479) 2021-10-19 18:26:45 +02:00
Aaron O'Mullan
5a8a989b78
refactor(metrics): move to core (#12386)
Avoids overhead of wrapping ops (and allocs when inspecting async-op futures)
2021-10-10 17:20:30 +02:00
Aaron O'Mullan
22328f8758
feat(core): native binding names (#12290)
Makes native builtin functions easier to recognize when debugging/profiling, they would otherwise appear as "(anonymous)" functions
2021-10-05 22:55:51 +02:00
Aaron O'Mullan
ea7a63cd5a
refactor(core): split opcall into sync/async (#12312) 2021-10-04 12:34:53 +02:00
Aaron O'Mullan
26de516558
feat(core): implement Deno.core.isProxy() (#12288) 2021-10-01 20:25:33 +02:00
Andreu Botella
cdb252af0a
feat: support serializing WebAssembly.Module objects (#12140) 2021-09-29 10:47:24 +02:00
Andreu Botella
4d6f412b0b
refactor(core): Turn the wasm_streaming_feed binding into ops (#11985)
Async WebAssembly compilation was implemented by adding two
bindings: `set_wasm_streaming_callback`, which registered a callback to
be called whenever a streaming wasm compilation was started, and
`wasm_streaming_feed`, which let the JS callback modify the state of the
v8 wasm compiler.

`set_wasm_streaming_callback` cannot currently be implemented as
anything other than a binding, but `wasm_streaming_feed` does not really
need to use anything specific to bindings, and could indeed be
implemented as one or more ops. This PR does that, resulting in a
simplification of the relevant code.

There are three operations on the state of the v8 wasm compiler that
`wasm_streaming_feed` allowed: feeding new bytes into the compiler,
letting it know that there are no more bytes coming from the network,
and aborting the compilation. This PR provides `op_wasm_streaming_feed`
to feed new bytes into the compiler, and `op_wasm_streaming_abort` to
abort the compilation. It doesn't provide an op to let v8 know that the
response is finished, but closing the resource with `Deno.core.close()`
will achieve that.
2021-09-13 14:27:54 +02:00
Luca Casonato
5d814a4c24
feat: ArrayBuffer in structured clone transfer (#11840) 2021-08-25 13:48:53 +02:00
Aaron O'Mullan
2ca454b402
refactor(ops): return BadResource errors in ResourceTable calls (#11710)
* refactor(ops): return BadResource errors in ResourceTable calls

Instead of relying on callers to map Options to Results via `.ok_or_else(bad_resource_id)` at over 176 different call sites ...
2021-08-15 13:29:19 +02:00
Leo K
16ae4a0d57
feat(extensions/web): add structuredClone function (#11572)
Co-authored-by: Luca Casonato <hello@lcas.dev>
2021-08-09 10:39:00 +02:00
Yusuke Tanaka
8f00b5542c
chore: upgrade Rust to 1.54.0 (#11554) 2021-07-30 15:03:41 +02:00
Aaron O'Mullan
01cf8aab9f
perf(core): avoid extra alloc in Deno.core.encode() (#11323) 2021-07-08 17:57:57 +02:00
Luca Casonato
bdfad23dd0
feat: support SharedArrayBuffer sharing between workers (#11040)
This commit adds support for sharing SABs between workers.
2021-07-06 19:42:52 +02:00
Andreu Botella
ffa75be480
feat: enable WebAssembly.instantiateStreaming and wasm async compilation (#11200)
The WebAssembly streaming APIs used to be enabled, but used to take
buffer sources as their first argument (see #6154 and #7259). This
change re-enables them, requiring a Promise<Response> instead, as well as
enabling asynchronous compilation of WebAssembly modules.
2021-07-03 23:33:36 +02:00
Nayeem Rahman
c577c273a4
fix(core/modules): Fix concurrent loading of dynamic imports (#11089)
This commit changes implementation of module loading in "deno_core"
to track all currently fetched modules across all existing module loads.

In effect a bug that caused concurrent dynamic imports referencing the 
same module to fail is fixed.
2021-06-29 03:03:02 +02:00
Bartek Iwańczuk
7b9737b9f4
feat(inspector): pipe console messages between terminal and inspector (#11134)
This commit adds support for piping console messages to inspector.

This is done by "wrapping" Deno's console implementation with default
console provided by V8 by the means of "Deno.core.callConsole" binding.

Effectively each call to "console.*" methods calls a method on Deno's
console and V8's console.
2021-06-27 02:27:50 +02:00
Luca Casonato
22e7b0f585
fix: MessagePort in message for postMessage transfers (#11103) 2021-06-26 11:17:05 +02:00
Yusuke Tanaka
8031644e65
chore: upgrade Rust to 1.53.0 (#11021) 2021-06-17 15:56:30 -04:00
Luca Casonato
a66f327250
tests: run wpt scripts with Deno.core.evalContext (#10852)
This means wpts are now run in script context, and there are better
stack traces.
2021-06-06 18:32:06 +02:00
Bartek Iwańczuk
0768f8d369
refactor(core): move ModuleMap to separate RefCell (#10656)
This commit moves bulk of the logic related to module loading
from "JsRuntime" to "ModuleMap".

Next steps are to rewrite the actual loading logic (represented by
"RecursiveModuleLoad") to be a part of "ModuleMap" as well --
that way we will be able to track multiple module loads from within
the map which should help me solve the problem of concurrent
loads (since all info about currently loading/loaded modules will
be contained in the ModuleMap, so we'll be able to know if actually
all required modules have been loaded).
2021-05-19 20:53:43 +02:00
Tim Ramlot
635253bd3a
feat(runtime/worker): Structured cloning worker message passing (#9323)
This commit upgrade "Worker.postMessage()" implementation to use 
structured clone algorithm instead of non-spec compliant JSON serialization.
2021-05-11 21:09:09 +02: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
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
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
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
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
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
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
19d0e6b671
perf(serde_v8): introduce Serializable boxable object (#9983) 2021-04-04 01:17:02 +02: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
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
Aaron O'Mullan
3d2e05dc7b
Introduce serde_v8 (#9722) 2021-03-25 22:36:46 -04: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
Andrew Mitchell
c00872c0c0
fix(core): don't panic on invalid arguments for Deno.core.print (#9834) 2021-03-21 08:52:28 -04: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
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
Aaron O'Mullan
1afe6b48e0
refactor(core): Reduce verbosity of binding core functions (#9497) 2021-02-15 12:53:33 +01:00
Bartek Iwańczuk
a6723fafc5
upgrade: rusty_v8 0.17.0, v8 9.0.123 (#9413) 2021-02-05 22:25:02 +01:00
Ryan Dahl
9312d48e69
upgrade: rusty_v8 0.16.0, v8 8.9.255.3 (#9180) 2021-01-19 18:40:30 -08:00
Ryan Dahl
2b75a11559
update copyright to 2021 (#9081) 2021-01-10 21:59:07 -05:00
Luca Casonato
0d41e21b0e
fix: align encoding APIs to spec using WPT (#9004) 2021-01-05 19:50:40 +01:00
Kitson Kelly
e2858d0bbb
chore: clippy future cleanups (#8514) 2020-11-28 06:47:35 +11:00
Bartek Iwańczuk
ec7f1e399e
refactor(core): don't depend on get_identity_hash for modules (#8354)
This commit refactors "deno_core::Modules" structure to not depend on
"get_identity_hash" function to identify modules, but instead use default
hash implementation.
2020-11-21 16:23:35 +01:00
Bartek Iwańczuk
d4c8fa263d
refactor(core): don't depend on get_identity_hash for promises (#8352)
This commit changes how pending promise exceptions are stored
in JsRuntime by using global handle to promise instead of its
identity hash.
2020-11-11 23:11:40 +01:00
Yoshiya Hinosawa
e736d0f60f
fix(prompt): fix display of non-ASCII characters on Windows (#8199) 2020-11-03 01:15:29 +01:00
Bartek Iwańczuk
8d95bd15e1
refactor(core): remove Deno.core.formatError() (#8091)
With recent improvements to REPL implementation,
Deno.core.formatError() API is no longer needed.
2020-10-23 22:16:12 +02:00
Ryan Dahl
59888ff0b2
upgrade rusty_v8 (#8017) 2020-10-18 13:07:11 -04:00
Ryan Dahl
055dfe2ff4
Make JsRuntimeState private (#7484) 2020-09-14 23:49:12 -04:00
Bert Belder
f5b40c918c
refactor: use the 'anyhow' crate instead of 'ErrBox' (#7476) 2020-09-15 01:50:52 +02:00
Ryan Dahl
7c2e7c6608
Use gotham-like state for ops (#7385)
Provides a concrete state type that can be dynamically added. This is necessary for op crates.
* renames BasicState to OpState
* async ops take `Rc<RefCell<OpState>>`
* sync ops take `&mut OpState`
* removes `OpRegistry`, `OpRouter` traits
* `get_error_class_fn` moved to OpState
* ResourceTable moved to OpState
2020-09-10 09:57:45 -04:00
Bartek Iwańczuk
25053f92ff
fix(core): panic on big string allocation (#7395)
Co-authored-by: Bert Belder <bertbelder@gmail.com>
2020-09-09 20:52:11 +02:00
uki00a
ac455050ee
feat(console): print proxy details (#7139) 2020-09-08 16:06:26 +02:00
Bartek Iwańczuk
f57a2c1e85
refactor(core): rename CoreIsolate to JsRuntime (#7373)
deno_core/
- rename core_isolate.rs to runtime.rs
- rename CoreIsolate to JsRuntime
- rename JSError to JsError
- rename JSStackFrame to JsStackFrame

cli/
- update references from deno_core::CoreIsolate to deno_core::JsRuntime
- rename deno_core::JSError to deno_core::JsError
- rename fmt_errors::JSError to fmt_errors::JsError
2020-09-06 21:44:29 +02:00
Bartek Iwańczuk
803bdd37c7
refactor(core): merge CoreIsolate and EsIsolate (#7370) 2020-09-06 16:50:49 +02:00
Bert Belder
c821e8f2f1
Move JSON ops to deno_core (#7336) 2020-09-06 02:34:02 +02:00
Bert Belder
fd83df7cdb
Convert the remaining http_bench ops to json ops (#7143) 2020-08-21 13:11:04 +02:00
Bert Belder
faa64edaf4
Upgrade to rusty_v8 0.7.0 (#6801) 2020-07-19 01:47:45 +02:00
Valentin Anger
be7e0f2d49
BREAKING(core): Remove control slice from ops (#6048) 2020-07-08 11:23:50 -04:00
Bert Belder
e10d74a3d3
Upgrade to rusty_v8 0.4.2 / V8 8.5.216 (#6503) 2020-06-26 20:17:15 +02:00
Ryan Dahl
aa39dfc62f
upgrade: rusty_v8 0.5.0 (#6070) 2020-06-03 12:19:21 -04:00
Ryan Dahl
23dc9c13db
Fix REPL BorrowMutError panic (#6055) 2020-06-02 16:37:52 -04:00
Valentin Anger
becbb56b19
feat(core): Ops can take several zero copy buffers (#4788) 2020-06-01 14:20:47 -04:00
Ryan Dahl
d4b05dd89e
refactor: Split isolate and state using safe get_slot() (#5929) 2020-05-29 17:41:39 -04:00
Ryan Dahl
2610ceac20
tidy up deno_core modules (#5923) 2020-05-28 13:36:43 -04:00
Bartek Iwańczuk
d062ffc1ba
fix: source maps in inspector (#5223)
This commit fixes problems with source maps in Chrome Devtools
by substituting source map URL generated by TS compiler with
actual file URL pointing to DENO_DIR.

Dummy value of "source_map_url" has been removed from
"ScriptOrigin".

Also fixes lock file which used compiled source code to generate
lock hash; it now uses source code of the file that is
being compiled.
2020-05-11 23:48:36 +02:00
Bartek Iwańczuk
f7d1f82796
core: add id field to RecursiveModuleLoad (#4905)
This commit unifies handling of ids for main module/dynamic 
import loads in EsIsolate.
2020-04-26 19:00:10 +02:00
Ryan Dahl
d8711155ca
Rename deno_core::Isolate to deno_core::CoreIsolate (#4851) 2020-04-23 11:51:07 +02:00
Bert Belder
10a174834e
Upgrade to rusty_v8 v0.4.0 (#4856) 2020-04-23 03:35:52 +02:00
Michał Sabiniarz
30fdf6dc83
console: print promise details (#4524) 2020-03-30 19:01:19 -04:00
Bartek Iwańczuk
87d2ba42bf
perf: Optimize TextEncoder and TextDecoder (#4430)
* add tests for "Deno.core.encode" and "Deno.core.decode" for empty inputs
* use "Deno.core.encode" in "TextEncoder"
* use "Deno.core.decode" in "TextDecoder"
* remove "core_decode" and "core_encode" benchmarks
2020-03-19 21:31:56 +01:00
Kevin (Kun) "Kassimo" Qian
2f3de4b425
Simplify timer with macrotask callback (#4385) 2020-03-19 10:45:28 -04:00
Nikolai Vavilov
8c1c929034
fix: stack traces for modules imported via std/node's require (#4035) 2020-03-19 10:42:07 -04:00
Bartek Iwańczuk
dc6e0c3591
feat: Deno.core.{encode,decode}; standalone UTF-8 encoding/decoding (#4349)
This commits add two new methods to "Deno.core" namespace: "encode" and "decode".

Those methods are bound in Rust to provide a) fast b) generally available of encoding and decoding UTF-8 strings. 

Both methods are now used in "cli/js/dispatch_json.ts".
2020-03-15 15:31:55 +01:00
Bert Belder
eafd40feab
Do not convert exceptions to JSON and back (#4214) 2020-03-02 14:20:16 -08:00
Bert Belder
ba0991ad2b
Refactor exception handling, remove message listener callback (#4198) 2020-02-29 16:27:19 -08:00
Bert Belder
1a8ef36b71
Upgrade to rusty_v8 v0.3.3 (#4119) 2020-02-26 11:44:33 -08:00
Ryan Dahl
91b606aaae
Clean up how we use opIds (#4118) 2020-02-25 09:14:27 -05:00
Bert Belder
37a7b01d5c
Refactor error tracking and scope juggling in deno_core (#3783) 2020-01-25 14:31:42 +01:00
Ryan Dahl
5e32c5ea44
s/PinnedBuf/ZeroCopyBuf (#3782) 2020-01-24 15:10:49 -05:00
Bert Belder
a6a7253df9
Fix: take control buffer offset/length into account again (#3769) 2020-01-24 05:34:55 +01:00
Ryan Dahl
9f1e4237a5
Upgrade rusty_v8 to 0.2.0 (#3764) 2020-01-23 20:22:05 -05:00
Bartek Iwańczuk
5a658a2ff7 refactor: remove Isolate.shared_response_buf optimization (#3759)
Op return values are no zero copied from Rust to JS.
2020-01-23 10:49:46 -05:00
Bert Belder
8c3cd634a8
Upgrade to rusty_v8 v0.1.1 (#3741) 2020-01-21 21:31:52 +01:00
Bert Belder
d8ad81d3fb
Upgrade to rusty_v8 v0.1.0 (#3691) 2020-01-17 02:26:40 +01:00
Bartek Iwańczuk
0d0ad360d3
refactor: remove Isolate.current_send_cb_info and DenoBuf, port Isolate.shared_response_buf (#3643)
* remove Isolate.current_send_cb_info
* remove DenoBuf
* remove Isolate.shared_ab
* port Isolate.shared_response_buf (last bit not ported from libdeno)
* add some docs for Isolate and EsIsolate
2020-01-11 10:49:16 +01:00
Bartek Iwańczuk
cbdf9c5009
refactor: module loading in EsIsolate (#3615)
* refactored RecursiveLoad - it was renamed to RecursiveModuleLoad, it does not take ownership of isolate anymore - a struct implementing Stream that yields SourceCodeInfo

* untangled module loading logic between RecursiveLoad and isolate - that logic is encapsulated in EsIsolate and RecursiveModuleLoad, where isolate just consumes modules as they become available - does not require to pass Arc<Mutex<Isolate>> around anymore

* removed EsIsolate.mods_ in favor of Modules and moved them inside EsIsolate

* EsIsolate now requires "loader" argument during construction - struct that implements Loader trait

* rewrite first methods on isolate as async
2020-01-08 15:06:04 +01:00
Bartek Iwańczuk
ad9fd589d4
core: factor out EsIsolate from Isolate (#3613) 2020-01-07 12:45:44 +01:00
Bartek Iwańczuk
8bf383710f
refactor: remove core/libdeno.rs (#3611) 2020-01-06 20:07:35 +01:00
Bartek Iwańczuk
870622d3cc
merge libdeno::DenoIsolate into core::Isolate (#3605) 2020-01-06 16:24:44 +01:00