summaryrefslogtreecommitdiff
path: root/core/isolate.rs
AgeCommit message (Collapse)Author
2019-11-16Use futures 0.3 API (#3358)Bartek Iwańczuk
2019-10-22core: gracefully handle bad op id (#3131)Bartek Iwańczuk
2019-10-15perf: fairer ops scheduling (#3128)Bartek Iwańczuk
2019-10-14perf: eager poll async ops in Isolate (#3046)Bartek Iwańczuk
2019-10-02remove legacy Isolate.set_dispatch API (#3041)Bartek Iwańczuk
* migrate deno_typescript crate to Isolate.register_op API * remove dual-dispatch mechanism * update Isolate tests to new dispatch mechanism
2019-09-30feat: op registration in core (#3002)Bartek Iwańczuk
2019-09-04perf: less aggresive dyn import polling (#2858)Bartek Iwańczuk
2019-08-26fix: shared queue requires aligned buffer (#2816)Bartek Iwańczuk
2019-08-21fix: dynamic import panic (#2792)Bartek Iwańczuk
2019-08-16Upgrade to rust 1.37.0 (#2786)Ryan Dahl
2019-08-09Dynamic import (#2516)Bert Belder
2019-08-07Add op_id throughout op API (#2734)Ryan Dahl
Removes the magic number hack to switch between flatbuffers and the minimal dispatcher. Adds machinery to pass the op_id through the shared_queue.
2019-08-05Remove dispatch optimization (#2732)Ryan Dahl
Deno.core.dispatch() used to push the "control" buf onto the shared array buffer before calling into V8, with the idea that it was one less argument to parse. Turns out there is no more overhead passing the control ArrayBuffer directly over. Furthermore this optimization was making the refactors outlined in #2730 more complex. Therefore it is being removed.
2019-07-31Use system rustfmt instead of fixed binary (#2701)Ryan Dahl
2019-07-24Add error handling for dynamic imports to libdeno (#2678)Bert Belder
2019-07-18only use Locker when calling into js (#2665)andy finch
2019-07-11Refactor error to use dynamic dispatch and traitsBert Belder
This is in preperation for dynamic import (#1789), which is more easily implemented when errors are dynamic.
2019-06-23Minor tweaks (#2569)Gurwinder Singh
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-18Add dyn to be rust nightly compatible (#2538)Kitson Kelly
2019-06-17refactor dispatch take 2 (#2533)andy finch
2019-06-14Revert "Refactor dispatch handling (#2452)"Ryan Dahl
Due to performance regression: https://github.com/denoland/deno/commit/dc60fe9f300043f191286ef804a365e16e455f87#commitcomment-33943711 This reverts commit dc60fe9f300043f191286ef804a365e16e455f87.
2019-06-13Refactor dispatch handling (#2452)andy finch
Promise id is now created in core and passed back to JS.
2019-06-12Remove Config struct from core (#2502)Ryan Dahl
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-10Expose dynamic import in core (#2472)Ryan Dahl
2019-05-03core,cli: fix clippy warningsBert Belder
2019-05-01core: express op as enum (#2255)Ryan Dahl
2019-05-01Refactor zero-copy buffers for performance and to prevent memory leaksBert Belder
* 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-04-24core: Add test for snapshotting from Rust (#2197)Ryan Dahl
2019-04-23core: make Isolate concrete, remove Dispatch trait (#2183)Ryan Dahl
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-16core: make Isolate use FuturesUnordered to track opsBert Belder
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-16core: run isolate tests within a taskBert Belder
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-09core: Rename Behavior to Dispatch (#2082)Ryan Dahl
And rename IsolateState to ThreadSafeState. Also make ThreadSafeState directly implement Dispatch. This is simpler.
2019-04-08core: poll ops round robinBert Belder
Also use a VecDeque to store pending ops to avoid exponential time complexity when removing completed ops from the list.
2019-04-08core: snapshot improvements (#2052)Ryan Dahl
* 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-04Improve docs in core (#2049)Ryan Dahl
2019-04-02Refactor deno_core::RecursiveLoad to be more idiomatic (#2034)Bert Belder
2019-04-02Add deno_core::RecursiveLoad for async module loading (#2034)Ryan Dahl
2019-03-30Move //libdeno to //core/libdeno (#2015)Ryan Dahl
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-28Clippy fixes (#2009)Bert Belder
2019-03-26namespace reorg: libdeno and DenoCore to Deno.core (#1998)Kitson Kelly
2019-03-25Resolve callback moved from Behavior to mod_instantiate() (#1999)Ryan Dahl
This simplifies the Behavior trait and makes it more explicit where the resolve callback is being made. Also s/StartupScript/Script
2019-03-24Handle overflown shared queue (#1992)Bartek Iwańczuk
Fixes #1988
2019-03-21core: Allow terminating an Isolate from another thread (#1982)Simon Menke
2019-03-18Re-implement init scripts in core (#1958)andy finch
Re-enables arm64 CI test
2019-03-18Integrate //core into existing code baseRyan Dahl
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-15core: remove reset() from SharedQueue APIBert Belder
2019-03-15core: Behavior shouldn't be genericRyan Dahl
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-12Small cleanups for //core (#1914)Ryan Dahl
* Privatize a few deno_core::Isolate methods * Add deno_core::Isolate docs
2019-03-11core: Abstract out Behavior from Isolate (#1904)Ryan Dahl
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.)