Commit graph

6119 commits

Author SHA1 Message Date
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
Bartek Iwańczuk 8978870808 Rename test targets (#2262) 2019-05-01 09:48:56 -04:00
Kevin (Kun) "Kassimo" Qian 7237e9d34a fs: add Deno.utime/Deno.utimeSync (#2241) 2019-05-01 05:08:11 -04:00
Ryan Dahl 6c137342d7
flags: fix merge error (#2244) 2019-04-29 18:35:25 -07:00
Bartek Iwańczuk 636827a1d5 Rewrite flags.rs::parse_flags (#2237) 2019-04-29 16:43:06 -07:00
Kitson Kelly 1a0f53a807 Add support for custom tsconfig.json (#2089)
Use `--config`
2019-04-29 07:58:31 -07:00
Ryan Dahl 1af02b405e
Revert "recover: #1517 Kill all pending accepts when TCP listener is closed (#2224)" (#2239)
Crashes while running wrk against
js/deps/https/deno.land/std/http/http_bench.ts

This reverts commit 972ac03858.
2019-04-28 14:15:15 -07:00
Yusuke Sakurai 972ac03858 recover: #1517 Kill all pending accepts when TCP listener is closed (#2224) 2019-04-27 11:33:24 -07:00
Bartek Iwańczuk 02596c08bd disable --version flag from deno version (#2226) 2019-04-27 11:19:50 -07:00
Ryan Dahl 40d8ef1ec9 v0.3.10 2019-04-25 13:59:18 -06:00
Bartek Iwańczuk aa85a4d288 Rename CLI flags to subcommands (#2212) 2019-04-25 12:59:49 -06:00
Ryan Dahl b426ecce80
compile lib.deno_runtime.d.ts into executable (#2209) 2019-04-25 12:27:30 -06:00
Bartek Iwańczuk b7d8a0c6f6 Rename deno prefetch to deno fetch (#2210) 2019-04-25 13:47:33 -04:00
Ryan Dahl e725b26b28 v0.3.9 2019-04-25 17:44:34 +02: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 675919e915
Use tokio_threadpool's new panic_handler (#2188) 2019-04-23 16:27:44 -04:00
Bert Belder 6caf865507
third_party: upgrade rust crates 2019-04-23 18:01:57 +02:00
Kevin (Kun) "Kassimo" Qian 1d4b92ac85 Add Deno.kill(pid, signo) and process.kill(signo) (Unix only) (#2177) 2019-04-21 21:26:56 -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
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
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
Bert Belder 90c2b10f47
Add cli dependency on tokio-rustls 2019-04-17 14:02:20 +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 c7e1f8fabd
Fix silent error, add custom panic handler (#2098)
This is to work around Tokio's panic recovery feature.
Ref https://github.com/tokio-rs/tokio/issues/495
Ref https://github.com/tokio-rs/tokio/issues/209
Ref https://github.com/denoland/deno/issues/1311
Fixes #2097
2019-04-14 16:07:24 -04:00
Yoshiya Hinosawa 635ad2a18e fix absolute path resolution from remote (#2109) 2019-04-13 13:27:27 -04:00
Bartek Iwańczuk 591b5e4a7d Add deno eval subcommand (#2102) 2019-04-13 13:24:15 -04:00
andy finch d3bd5879c3 better wait for removed_from_resource_table_on_close test (#2104) 2019-04-12 18:39:31 -04:00
Ryan Dahl 8584d80cfd v0.3.7 2019-04-11 15:35:21 -04:00
andy finch 960ee5257a Improve op dispatch (#2088) 2019-04-11 10:58:31 -04:00
Bartek Iwańczuk 1034d9723d fix --v8-options (#2093) 2019-04-11 10:20:07 -04:00
Bert Belder 4ffe1612ff Silence clippy warnings and format source code 2019-04-09 20:05:47 +02:00
Bert Belder fe2f3ba889 Use correct type for source_bytes when buiding in check-only mode 2019-04-09 20:05:47 +02: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
Ryan Dahl 2debbdacb9
Merge Worker and Isolate types (#2078)
Reduces generics.
2019-04-08 17:10:00 -04:00
Vincent LE GOFF 734cf781c6 Allow high precision performance.now() (#1977) 2019-04-08 16:22:40 -04: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
Kevin (Kun) "Kassimo" Qian 1746a3ac69 Add link/linkSync fs call for hardlinks (#2074) 2019-04-08 09:11:32 -04:00
Bartek Iwańczuk 86aee7f137 Flags clean up: DenoFlags::from (#2068) 2019-04-07 14:58:16 -04:00
Bartek Iwańczuk 780e72ab6a Refactor CLI flag parsing (#2025) 2019-04-07 01:13:06 +03:00
andy finch 07f0d077c7 add compile_async (#2053) 2019-04-05 00:04:06 -04:00
Ryan Dahl 744e56cb58 v0.3.6 2019-04-04 09:59:41 -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 5f1e42f8ac
cli: refactor compile_sync() for readability 2019-04-02 18:04:25 +02:00
Bert Belder b735155712
Clippy fixes 2019-04-02 18:04:25 +02:00
Kevin (Kun) "Kassimo" Qian 534b8d3021 Follow redirect location as new referrers for nested module imports (#2031)
Fixes #1742
Fixes #2021
2019-04-01 21:46:40 -04: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 ff1c80d6d8
third_party: add rust crate 'clap' 2019-03-31 17:55:03 -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
Ryan Dahl c25e262b04
Merge the --recompile and --reload flags (#2003) 2019-03-28 16:05:41 -04:00
Bert Belder da1b98b690 Clippy fixes (#2009) 2019-03-28 08:09:19 -04:00
Bartek Iwańczuk 597ee38ef2 Rewrite readFile and writeFile (#2000)
Using open/read/write
2019-03-27 23:29:36 -04:00
Ryan Dahl d0b6152f11
Fix error when JS is executed with --recompile (#2007)
test case from @afinch7
2019-03-27 16:10:31 -04:00
Kevin (Kun) "Kassimo" Qian 5c4189a3b8 Do not close file on invalid seek mode (#2004) 2019-03-26 22:47:17 -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
andy finch 1499d57490 Remove dead code (#1983) 2019-03-21 15:52:30 -04:00
Ryan Dahl 94405bb617
Fix clippy errors and upgrade Rust to 1.33.0 in CI (#1945) 2019-03-20 18:55:52 -04:00
Ryan Dahl 4c831f1eb5
Add more async module loading function (#1974)
* get_source_code_async
* fetch_module_meta_data_async
* fetch_module_meta_data_and_maybe_compile_async
2019-03-20 11:38:43 -04:00
andy finch 48bf419669 Separate behavior for the compiler isolate (#1973) 2019-03-19 20:55:59 -04:00
andy finch 6131152a57 Remove old Buf definition in cli.rs (#1971) 2019-03-19 16:47:35 -04:00
Ryan Dahl fb2c0c29ec
Add fetch_remote_source_async (#1972) 2019-03-19 16:45:39 -04:00
Ryan Dahl 5e4312de4d Move fetch_remote_source, fetch_local_source
They do not depend on DenoDir, so should not be methods of it.
2019-03-19 14:50:41 -04:00
Ryan Dahl 2c5030000b Add async version of http_util::fetch_sync_string 2019-03-19 14:50:41 -04:00
Ryan Dahl fa3c35301a
Rename //src/ to //cli/ (#1962)
To better distinguish the deno_core crate from the executable deno,
which will now be called "the cli" internally.
2019-03-19 12:18:05 -04:00