1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-11-14 16:33:45 -05:00
Commit graph

257 commits

Author SHA1 Message Date
andy finch
621af21e6e only use Locker when calling into js (#2665) 2019-07-18 20:23:14 -04:00
andy finch
042484d45a remove v8::Locker from deno_respond (#2664) 2019-07-18 18:40:46 -04:00
andy finch
056c146175 Fix expected dyn before AnyError trait (#2663) 2019-07-18 23:48:44 +02:00
Ryan Dahl
4e248ecda9 v0.12.0 2019-07-16 16:08:50 -04:00
Bert Belder
abe8a113ad Refactor error to use dynamic dispatch and traits
This is in preperation for dynamic import (#1789), which is more easily
implemented when errors are dynamic.
2019-07-11 14:37:00 -04:00
Ryan Dahl
52c0764e4f
Upgrade v8 to 7.7.200 (#2624) 2019-07-09 14:03:06 -04:00
Bartek Iwańczuk
d641782c82 Rewrite snapshot_creator in Rust 2019-07-08 18:18:28 -04:00
Bert Belder
f4c9b31405
core: replace ModuleSpecifier::to_url() by as_url() 2019-07-08 23:04:07 +02:00
Bartek Iwańczuk
72d9045528
cli: refactor deno_dir to use Url instead of String 2019-07-08 13:07:32 +02:00
Bert Belder
9b1997b8b6
core: clearly define when module lookup is path-based vs URL-based
The rules are now as follows:

* In `import` statements, as mandated by the WHATWG specification,
  the import specifier is always treated as a URL.
  If it is a relative URL, it must start with either / or ./ or ../

* A script name passed to deno as a command line argument may be either
  an absolute URL or a local path.
  - If the name starts with a valid URI scheme followed by a colon, e.g.
    'http:', 'https:', 'file:', 'foo+bar:', it always interpreted as a
    URL (even if Deno doesn't support the indicated protocol).
  - Otherwise, the script name is interpreted as a local path. The local
    path may be relative, and operating system semantics determine how
    it is resolved. Prefixing a relative path with ./ is not required.
2019-07-08 13:07:32 +02:00
Ryan Dahl
92ac616708 v0.11.0 2019-07-07 12:17:46 -04:00
Bert Belder
32cde32e54 core: return useful error when import path has no prefix like ./ 2019-06-30 19:46:32 +02:00
Ryan Dahl
c56df45355 v0.10.0 2019-06-25 07:09:46 -07:00
Gurwinder Singh
6fa6828e5f Minor tweaks (#2569)
1. Separate Snapshot and Script StartupData functions based on cfg "no-snapshot-init"
2. Replace deprecated Once::ONCE_INIT with Once::new (https://github.com/rust-lang/rust/pull/61757)
3. Elide lifetime
4. Fix typos
2019-06-23 04:49:49 -07:00
Ryan Dahl
f2c50fae84
Fix silent failure of WebAssembly.instantiate() (#2548)
By making WASM compilation synchronous. We'll have to do more work to
make it properly async.
2019-06-20 09:04:34 -07:00
Kitson Kelly
425df50484 Combine CLI Errors (#2487) 2019-06-19 19:07:01 -07:00
Kitson Kelly
ed390a51ca Add dyn to be rust nightly compatible (#2538) 2019-06-18 06:28:56 -07:00
andy finch
76d51b0f9a refactor dispatch take 2 (#2533) 2019-06-17 18:02:08 -07:00
Ryan Dahl
7b06aa3734 v0.9.0 2019-06-15 09:04:57 -07:00
Bert Belder
77737707e4
third_party: upgrade rust crates 2019-06-15 15:20:02 +02:00
Ryan Dahl
1361e30223 Revert "Refactor dispatch handling (#2452)"
Due to performance regression:
dc60fe9f30 (commitcomment-33943711)

This reverts commit dc60fe9f30.
2019-06-14 13:56:36 -07:00
andy finch
dc60fe9f30 Refactor dispatch handling (#2452)
Promise id is now created in core and passed back to JS.
2019-06-13 20:43:54 -07:00
Bartek Iwańczuk
bca5cc5041 Move ModuleSpecifier to //core (#2509) 2019-06-12 16:55:59 -07:00
Ryan Dahl
2a5138a516
Remove Config struct from core (#2502)
It's unnecessary indirection and is preventing the ability to easily
pass isolate references into the dispatch and dyn_import closures.

Note: this changes how StartupData::Script is executed. It's no longer done
during Isolate::new() but rather lazily on first poll or execution.
2019-06-12 10:53:24 -07:00
Bert Belder
878d092df9
Revert "Work around Windows-only V8 concurrent initialization crash"
This fix is no longer necessary as the underlying V8 bug has been
fixed upstream.

This reverts commit 48bcfce09e.
2019-06-11 23:17:41 +02:00
Ryan Dahl
523ab6a929
Upgrade V8 to 7.7.37 (#2492) 2019-06-10 18:49:30 -04:00
Ryan Dahl
e043697521
Expose dynamic import in core (#2472) 2019-06-10 15:27:34 -04:00
Bartek Iwańczuk
a115340288 feat: Import maps (#2360) 2019-06-09 09:08:20 -04:00
Ryan Dahl
d60bdb6350 v0.8.0 2019-06-08 15:16:34 -04:00
Michał Sabiniarz
9bea576f3e Deno.core.evalContext & Deno.core.print fix (#2465) 2019-06-06 21:51:04 -04:00
Ryan Dahl
cbcb78f188
libdeno: expose dynamic import (#2461) 2019-06-06 19:07:47 -04:00
Ryan Dahl
e152dae006
RecursiveLoad shouldn't own the Isolate (#2453)
This patch makes it so that RecursiveLoad doesn't own the Isolate, so
Worker::execute_mod_async does not consume itself.

Previously Worker implemented Loader, but now ThreadSafeState does.

This is necessary preparation work for dynamic import (#1789) and import
maps (#1921)
2019-06-05 16:35:38 -04:00
Bert Belder
1540b36ce7
third_party: upgrade rust crates 2019-05-30 11:28:05 -07:00
Ryan Dahl
5265bd7cb1 v0.7.0 2019-05-29 18:42:49 -04:00
Ryan Dahl
856c44213b TS compiler refactor
* Compiler no longer has its own Tokio runtime. Compiler handles one
  message and then exits.

* Uses the simpler ts.CompilerHost interface instead of
  ts.LanguageServiceHost.

* avoids recompiling the same module by introducing a hacky but simple
  `hashset<string>` that stores the module names that have been already
  compiled.

* Removes the CompilerConfig op.

* Removes a lot of the mocking stuff in compiler.ts like `this._ts`. It
  is not useful as we don't even have tests.

* Turns off checkJs because it causes fmt_test to die with OOM.
2019-05-29 07:53:39 -04:00
Ryan Dahl
22feb74ba1 v0.6.0 2019-05-20 15:22:08 -04:00
Ryan Dahl
9620b20ede Adjust core/README.md text 2019-05-20 15:22:08 -04:00
Bert Belder
3d6f0a85af
build: add support for rust proc-macro crates 2019-05-16 20:33:25 -07:00
Ryan Dahl
23aca36d52 v0.5.0 2019-05-11 17:19:21 -04:00
Nikola Ristic
551b56dd85 Typo (#2337) 2019-05-11 16:10:19 -04:00
Bert Belder
c0341cb1af
third_party: upgrade rust crates 2019-05-11 05:03:03 +02:00
Bert Belder
369a7ec94e
core: make PinnedBuf::Raw -> PinnedBuf conversion actually a move 2019-05-11 03:13:29 +02:00
Bartek Iwańczuk
1fc61f3b6a core: Privatize ModuleNameMap SymbolicModule deno_buf (#2324) 2019-05-09 16:44:30 -04:00
Ryan Dahl
2aae09c2b8 v0.4.0 2019-05-03 19:33:50 -04:00
Ryan Dahl
3b1e2f1ad4 v0.3.11 2019-05-03 18:05:41 -04:00
Bert Belder
8999517421
core,cli: fix clippy warnings 2019-05-03 03:29:42 +02:00
Bert Belder
48bcfce09e
Work around Windows-only V8 concurrent initialization crash
This patch provides a work-around for an apparent V8 bug where
initializing multiple isolates concurrently leads to a crash on
Windows.

At the time of writing the cause of this crash is not exactly
understood, but it seems to be related to the V8 internal
function win64_unwindinfo::RegisterNonABICompliantCodeRange(),
which didn't exist in older versions of V8.
2019-05-02 20:46:56 +02:00
Bert Belder
ae0544b7ce core: remove support for moving deno_buf ownership from C++ to JavaScript
The functionality hasn't been in use for a long time. Without this feature,
the `alloc_ptr` and `alloc_len` fields are no longer necessary.
2019-05-02 06:25:44 +02:00
Ryan Dahl
c171813e89
core: express op as enum (#2255) 2019-05-01 18:22:32 -04:00
Bert Belder
41c7e96f1a
Refactor zero-copy buffers for performance and to prevent memory leaks
* In order to prevent ArrayBuffers from getting garbage collected by V8,
  we used to store a v8::Persistent<ArrayBuffer> in a map. This patch
  introduces a custom ArrayBuffer allocator which doesn't use Persistent
  handles, but instead stores a pointer to the actual ArrayBuffer data
  alongside with a reference count. Since creating Persistent handles
  has quite a bit of overhead, this change significantly increases
  performance. Various HTTP server benchmarks report about 5-10% more
  requests per second than before.

* Previously the Persistent handle that prevented garbage collection had
  to be released manually, and this wasn't always done, which was
  causing memory leaks. This has been resolved by introducing a new
  `PinnedBuf` type in both Rust and C++ that automatically re-enables
  garbage collection when it goes out of scope.

* Zero-copy buffers are now correctly wrapped in an Option if there is a
  possibility that they're not present. This clears up a correctness
  issue where we were creating zero-length slices from a null pointer,
  which is against the rules.
2019-05-01 21:11:09 +02:00
Bert Belder
abdb98a251
core: remove unused function StrBufNullAllocPtr() 2019-05-01 19:47:15 +02:00
Bartek Iwańczuk
8978870808 Rename test targets (#2262) 2019-05-01 09:48:56 -04:00
Greg Altman
1d4b14e306 core: add Deps::to_json() (#2223) 2019-04-27 10:04:09 -07:00
Ryan Dahl
40d8ef1ec9 v0.3.10 2019-04-25 13:59:18 -06:00
Ryan Dahl
e725b26b28 v0.3.9 2019-04-25 17:44:34 +02:00
Ryan Dahl
7fc9d7d62a
core: Add test for snapshotting from Rust (#2197) 2019-04-24 21:43:06 -04:00
Ryan Dahl
d68b44b6b2
core: make Isolate concrete, remove Dispatch trait (#2183)
Op dispatch is now dynamically dispatched, so slightly less efficient.
The immeasurable perf hit is a reasonable trade for the API simplicity
that is gained here.
2019-04-23 18:58:00 -04:00
Ryan Dahl
961f87e1c5
Fixes #2033, shared queue push bug (#2158) 2019-04-21 12:16:55 -04:00
Bartek Iwańczuk
cd19da62d9 Refactor CLI entry point (#2157)
Changes "deno --types" to "deno types"
and "deno --prefetch" to "deno prefetch"
2019-04-21 11:34:18 -04:00
Matt Harrison
c08075053f Fix link to http_bench example in core README (#2167) 2019-04-21 10:40:44 -04:00
Ryan Dahl
0796a8f2f7 v0.3.8 2019-04-19 11:41:13 -04:00
Ryan Dahl
5e5c8553e7
core: test Modules::deps and handle error cases better (#2141) 2019-04-19 11:18:46 -04:00
Ryan Dahl
e026320c73
Improve test slow_never_ready_modules (#2145) 2019-04-19 09:22:46 -04:00
Kevin (Kun) "Kassimo" Qian
afabb3f833 Fix redirects under async load (#2133) 2019-04-18 21:33:50 -04:00
Bert Belder
8477daa8b9
Fix clippy warnings 2019-04-17 15:35:46 +02:00
Ryan Dahl
79a974229a
Move deno_core_http_bench into examples dir (#2127) 2019-04-16 17:53:43 -04:00
Bert Belder
7807afa972
core: make Isolate use FuturesUnordered to track ops
Additionally, instead of polling ops in a loop until none of them are
ready, the isolate will now yield to the task system after delivering
the first batch of completed ops to the javascript side.

Although this makes performance a bit worse (about 15% fewer
requests/second on the 'deno_core_http_bench' benchmark), we feel that
the advantages are worth it:

* It resolves the extremely high worst-case latency that we were seeing
  on deno_core_http_bench, in particular when using the multi-threaded
  Tokio runtime, which would sometimes exceed a full second.

* Before this patch, the implementation of Isolate::poll() had to loop
  through all sub-futures and poll each one of them, which doesn't scale
  well as the number of futures managed by the isolate goes up. This
  could lead to poor performance when e.g. a server is servicing
  thousands of connected clients.
2019-04-16 22:54:33 +02:00
Bert Belder
dd595220ab
core: run isolate tests within a task
This change is made in preparation for using FuturesUnordered to track
futures that are spawned by the isolate. FuturesUnordered sets up
notififications for every future that it finds to be not ready when
polled, which causes a crash if attempted outside of a task context.
2019-04-16 22:26:33 +02:00
Bert Belder
2719631038
core/http_bench: support -D flag to enable logging 2019-04-16 22:25:57 +02:00
Ryan Dahl
1bfb443369
Implement async module loading in CLI (#2084) 2019-04-16 15:13:42 -04:00
Bert Belder
97f0fe7437
third_party: upgrade rust crates 2019-04-15 18:56:29 +02:00
Ryan Dahl
8584d80cfd v0.3.7 2019-04-11 15:35:21 -04:00
Ryan Dahl
d2579f4564
core: Rename Behavior to Dispatch (#2082)
And rename IsolateState to ThreadSafeState.

Also make ThreadSafeState directly implement Dispatch. This is simpler.
2019-04-09 13:11:25 -04:00
Bert Belder
e43da28b28
core: poll ops round robin
Also use a VecDeque to store pending ops to avoid exponential time complexity
when removing completed ops from the list.
2019-04-08 23:10:21 +02:00
Ryan Dahl
f7fdb90fd5
core: snapshot improvements (#2052)
* Moves how snapshots are supplied to the Isolate. Previously they were
  given by Behavior::startup_data() but it was only called once at
  startup. It makes more sense (and simplifies Behavior) to pass it to the
  constructor of Isolate.
* Adds new libdeno type deno_snapshot instead of overloading
  deno_buf.
* Adds new libdeno method to delete snapshot deno_snapshot_delete().
* Renames deno_get_snapshot() to deno_snapshot_new().
* Makes StartupData hold references to snapshots. This was implicit when
  it previously held a deno_buf but is made explicit now. Note that
  include_bytes!() returns a &'static [u8] and we want to avoid
  copying that.
2019-04-08 10:12:43 -04:00
Ryan Dahl
744e56cb58 v0.3.6 2019-04-04 09:59:41 -04:00
Ryan Dahl
0a26230a87
Improve docs in core (#2049) 2019-04-04 09:35:52 -04:00
andy finch
0e7311e171 Non-fatal compile_sync failures (#2039)
And model worker resources as Stream
2019-04-04 05:33:32 -04:00
Bert Belder
917e68f30f
Refactor deno_core::RecursiveLoad to be more idiomatic (#2034) 2019-04-02 20:10:16 +02:00
Ryan Dahl
2b0f553e2e
Add deno_core::RecursiveLoad for async module loading (#2034) 2019-04-02 20:10:08 +02:00
Bert Belder
b735155712
Clippy fixes 2019-04-02 18:04:25 +02:00
andy finch
b0a23beb8f Add web worker JS API (#1993)
* Refactored the way worker polling is scheduled and errors are handled.
* Share the worker future as a Shared
2019-04-01 15:09:59 -04:00
Bert Belder
97265895ba
Publish rust crate on crates.io (#2024) 2019-03-31 17:22:02 -04:00
Ryan Dahl
3ba4c3c2b0
Remove deno_core_http_bench from core/Cargo.toml (#2023)
So we don't have to have an optional tokio dependency. We build
deno_core_http_bench using GN anyway.
2019-03-31 11:11:36 -04:00
Ryan Dahl
e9910d8ae5
Rename crate deno_core to deno (#2022) 2019-03-30 19:30:40 -04:00
Ryan Dahl
6744bb8d75
Call ninja directly from build.rs (#2020) 2019-03-30 19:27:00 -04:00
Ryan Dahl
c9614d86c1
Move //libdeno to //core/libdeno (#2015)
Fixes some sed errors introduced in c43cfe.

Unfortunately moving libdeno required splitting build.rs into two parts,
one for cli and one for core.

I've also removed the arm64 build - it's complicating things at this
re-org and we're not even testing it. I need to swing back to it and get
tools/test.py running for it.
2019-03-30 14:45:36 -04:00
Bert Belder
3d6c033369
third_party: upgrade rust crates 2019-03-29 14:50:07 -04:00
Ryan Dahl
b965c7ab36 v0.3.5 2019-03-28 16:58:17 -04:00
Ryan Dahl
51abcd6147 Make sharedQueue overflow warning quieter (#2008) 2019-03-28 14:13:34 -04:00
Bert Belder
da1b98b690 Clippy fixes (#2009) 2019-03-28 08:09:19 -04:00
Kitson Kelly
c43cfedeba namespace reorg: libdeno and DenoCore to Deno.core (#1998) 2019-03-26 08:22:07 -04:00
Ryan Dahl
d8714281b4
Resolve callback moved from Behavior to mod_instantiate() (#1999)
This simplifies the Behavior trait and makes it more explicit where the
resolve callback is being made.

Also s/StartupScript/Script
2019-03-25 17:43:31 -04:00
Bartek Iwańczuk
129eae0265 Handle overflown shared queue (#1992)
Fixes #1988
2019-03-24 11:07:10 -04:00
Simon Menke
93793dc455 core: Allow terminating an Isolate from another thread (#1982) 2019-03-21 09:48:19 -04:00
andy finch
cdfd32dd74 Re-implement init scripts in core (#1958)
Re-enables arm64 CI test
2019-03-18 20:03:37 -04:00
Ryan Dahl
44773c9b0f Integrate //core into existing code base
This disables a few tests which are broken still:
- tests/error_004_missing_module.test
- tests/error_005_missing_dynamic_import.test
- tests/error_006_import_ext_failure.test
- repl_test test_set_timeout
- repl_test test_async_op
- repl_test test_set_timeout_interlaced
- all of permission_prompt_test
2019-03-18 17:17:08 -04:00
Bert Belder
62761a4e3a
core: remove reset() from SharedQueue API 2019-03-15 21:57:22 +01:00
Ryan Dahl
1811318097 core: Behavior shouldn't be generic
We always pass around Box<[u8]>, and adding this generic is an
unnecessary complication.

Add deno_core_http_bench_test to test.py

sharedQueue works on deno_core_http_bench
2019-03-15 10:58:18 -04:00
Ryan Dahl
45fad1b7cf
allow v8 cli flags on deno_core_http_bench (#1934) 2019-03-15 03:12:56 -04:00
Ryan Dahl
6b07ed189c
Small cleanups for //core (#1914)
* Privatize a few deno_core::Isolate methods
* Add deno_core::Isolate docs
2019-03-12 18:47:54 -04:00
Ryan Dahl
72f9a2e20d
core: Abstract out Behavior from Isolate (#1904)
Move v8_set_flags and v8_version to core. (The idea is that src/ should
not depend on libdeno.rs anymore. This is a step towards that.)
2019-03-11 17:57:36 -04:00
Kitson Kelly
034e2cc028 Migrate from tslint to eslint for linting (#1905) 2019-03-09 12:30:38 -05:00
Ryan Dahl
b3b989ffdc
Use deno_core::JSError in deno (#1855)
src/js_errors.rs takes care of source maps and color while
core/js_errors.rs is just the basic struct.
2019-02-28 16:19:04 -05:00
Bert Belder
d4e3bf945d
third_party: upgrade rust crates 2019-02-27 10:24:22 -08:00
Bert Belder
15831272bb
core: add Cargo.toml
This aids development using Visual Studio Code. The http_bench can't be
built with cargo yet because it needs to link with libdeno.
2019-02-26 16:23:36 -08:00
Ryan Dahl
b8a537d020
deno_core (#1827)
A new low-level crate with focus on speed. 
This doesn't yet hook into the existing code base.
2019-02-26 17:36:05 -05:00