summaryrefslogtreecommitdiff
path: root/runtime/js/99_main.js
AgeCommit message (Collapse)Author
2023-03-05refactor(core): include_js_files! 'dir' option doesn't change specifiers ↵Bartek Iwańczuk
(#18019) This commit changes "include_js_files!" macro from "deno_core" in a way that "dir" option doesn't cause specifiers to be rewritten to include it. Example: ``` include_js_files! { dir "js", "hello.js", } ``` The above definition required embedders to use: `import ... from "internal:<ext_name>/js/hello.js"`. But with this change, the "js" directory in which the files are stored is an implementation detail, which for embedders results in: `import ... from "internal:<ext_name>/hello.js"`. The directory the files are stored in, is an implementation detail and in some cases might result in a significant size difference for the snapshot. As an example, in "deno_node" extension, we store the source code in "polyfills" directory; which resulted in each specifier to look like "internal:deno_node/polyfills/<module_name>", but with this change it's "internal:deno_node/<module_name>". Given that "deno_node" has over 100 files, many of them having several import specifiers to the same extension, this change removes 10 characters from each import specifier.
2023-02-23fix(core): remove async op inlining optimization (#17899)Divy Srivastava
Runtime generation of async op wrappers contributed to increased startup time and core became unusable with `--disallow-code-generation-from-strings` flag. The optimization only affects very small microbenchmarks so this revert will not cause any regressions.
2023-02-22perf(core, runtime): Further improve startup time (#17860)Bartek Iwańczuk
This commit further improves startup time by: - no relying on "JsRuntime::execute_script" for runtime bootstrapping, this is instead done using V8 APIs directly - registering error classes during the snapshot time, instead of on startup Further improvements can be made, mainly around removing "core.initializeAsyncOps()" which takes around 2ms. This commit should result in ~1ms startup time improvement.
2023-02-16test: add unit tests from std/node (#17794)Bartek Iwańczuk
Adds two test files: "cli/tests/unit_node/process_test.ts" and "cli/tests/unit_node/child_process_test.ts" --------- Co-authored-by: Yoshiya Hinosawa <stibium121@gmail.com>
2023-02-14feat(ext/node): embed std/node into the snapshot (#17724)Bartek Iwańczuk
This commit moves "deno_std/node" in "ext/node" crate. The code is transpiled and snapshotted during the build process. During the first pass a minimal amount of work was done to create the snapshot, a lot of code in "ext/node" depends on presence of "Deno" global. This code will be gradually fixed in the follow up PRs to migrate it to import relevant APIs from "internal:" modules. Currently the code from snapshot is not used in any way, and all Node/npm compatibility still uses code from "https://deno.land/std/node" (or from the location specified by "DENO_NODE_COMPAT_URL"). This will also be handled in a follow up PRs. --------- Co-authored-by: crowlkats <crowlkats@toaxl.com> Co-authored-by: Divy Srivastava <dj.srivastava23@gmail.com> Co-authored-by: Yoshiya Hinosawa <stibium121@gmail.com>
2023-02-14feat: stabilize Deno.osUptime() (#17554)Bartek Iwańczuk
This commit stabilizes "Deno.osUptime()" API. The "--unstable" flag is no longer required to use this API.
2023-02-13feat: Stabilize Deno.Command API (#17628)Bartek Iwańczuk
This commit stabilizes "Deno.Command" API with all its related APIs. "--unstable" flag is no longer required to use this API.
2023-02-12fix: add WouldBlock error (#17339)Leo Kettmeir
2023-02-08refactor: internal runtime code TS support (#17672)Leo Kettmeir
This is a proof of concept for being able to snapshot TypeScript files. Currently only a single runtime file is authored in TypeScript - "runtime/js/01_version.ts". Not needed infrastructure was removed from "core/snapshot_util.rs". --------- Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2023-02-07 refactor: remove prefix from include_js_files & use extension name (#17683)Leo Kettmeir
2023-02-07refactor: Use ES modules for internal runtime code (#17648)Leo Kettmeir
This PR refactors all internal js files (except core) to be written as ES modules. `__bootstrap`has been mostly replaced with static imports in form in `internal:[path to file from repo root]`. To specify if files are ESM, an `esm` method has been added to `Extension`, similar to the `js` method. A new ModuleLoader called `InternalModuleLoader` has been added to enable the loading of internal specifiers, which is used in all situations except when a snapshot is only loaded, and not a new one is created from it. --------- Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2023-01-24refactor: remove Deno.core (#16881)Bartek Iwańczuk
This commit removes "Deno.core" namespace. It is strictly private API that has no stability guarantees, we were supposed to remove it long time ago. Co-authored-by: Yoshiya Hinosawa <stibium121@gmail.com>
2023-01-20feat: Stabilize Deno.Listener.ref/unref (#17477)Bartek Iwańczuk
2023-01-16refactor(core): rename pending_promise_exception to ↵Bartek Iwańczuk
pending_promise_rejection (#17441) These are technically rejections - a rejection can then raise an exception.
2023-01-06fix(core): get v8 console from context extra bindings (#17243)Chengzhong Wu
Explicitly get `console` object from V8 instead of relying on `console` defined on the global object.
2023-01-06perf(ext,runtime): remove using `SafeArrayIterator` from `for-of` (#17255)Kenta Moriuchi
2023-01-02chore: update copyright year to 2023 (#17247)David Sherret
Yearly tradition of creating extra noise in git.
2022-12-28fix(node): Add op_node_unstable_os_uptime to allow for node interop (#17208)Kamil Ogórek
2022-12-20chore: Update dlint (#17031)Kenta Moriuchi
Introduces `SafeSetIterator` and `SafeMapIterator` to primordials
2022-12-09unstable: remove Deno.spawn, Deno.spawnSync, Deno.spawnChild APIs (#16893)Bartek Iwańczuk
This commit removes three unstable Deno APIs: - "Deno.spawn()" - "Deno.spawnSync()" - "Deno.spawnChild()" These APIs were replaced by a unified "Deno.Command" API.
2022-11-28feat(unstable): rework Deno.Command (#16812)Leo Kettmeir
Refactors the `Deno.Command` class to not handle any state, but only being an intermediary to calling its methods, and as such any methods and properties besides `output`, `outputSync` & `spawn` have been removed. Interracting with a `spawn`ed subprocess now works by using the methods and properties on the returned class of the `spawn` method.
2022-11-21feat(core): Ability to create snapshots from existing snapshots (#16597)Bartek Iwańczuk
Co-authored-by: crowlkats <crowlkats@toaxl.com>
2022-11-17fix(ext/webstorage): make web storages re-assignable (#16661)Yoshiya Hinosawa
2022-11-10feat: don't require --unstable flag for npm programs (#16520)Bartek Iwańczuk
This PR adds copies of several unstable APIs that are available in "Deno[Deno.internal].nodeUnstable" namespace. These copies do not perform unstable check (ie. don't require "--unstable" flag to be present). Otherwise they work exactly the same, including permission checks. These APIs are not meant to be used by users directly and can change at any time. Copies of following APIs are available in that namespace: - Deno.spawnChild - Deno.spawn - Deno.spawnSync - Deno.serve - Deno.upgradeHttpRaw - Deno.listenDatagram
2022-10-28Reland "perf(core): generate inlined wrappers for async ops" (#16455)Divy Srivastava
Reland https://github.com/denoland/deno/pull/16428
2022-10-27Revert "perf(core): generate inlined wrappers for async ops (#16428)" (#16443)Divy Srivastava
2022-10-27perf(core): generate inlined wrappers for async ops (#16428)Divy Srivastava
V8's JIT can do a better job knowing the argument count and also enable fast call path (in future). This also lets us call async ops without `opAsync`: ```js const { ops } = Deno.core; await ops.op_void_async(); ``` this patch: 4405286 ops/sec main: 3508771 ops/sec
2022-10-25Revert "Revert "refactor(ext/net): clean up variadic network ops (#16… ↵Bartek Iwańczuk
(#16422) …392)" (#16417)" This reverts commit 8e3f825c921b38141afa7a69a0664881c5c94461.
2022-10-25Revert "refactor(ext/net): clean up variadic network ops (#16392)" (#16417)Bartek Iwańczuk
Should fix https://github.com/denoland/deno_std/issues/2807
2022-10-24experiment(ext/web): Don't expose event classes during the bootstrap phase ↵Andreu Botella
(#16213)
2022-10-24refactor(ext/net): clean up variadic network ops (#16392)Luca Casonato
Previously `op_net_listen`, `op_net_accept`, and various other ops in ext/net where variadic on the transport. This created a lot of code bloat. This commit updates the code to instead have separate ops for each transport.
2022-10-18feat: introduce navigator.language (#12322)Luca Matei Pintilie
Link to the spec: https://html.spec.whatwg.org/multipage/system-state.html#dom-navigator-language-dev Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2022-09-28feat: implement Web Cache API (#15829)Satya Rohith
2022-09-28refactor(runtime): don't use destructuring assignment in JS code (#16050)Bartek Iwańczuk
2022-09-17perf(ext/console): avoid `wrapConsole` when not inspecting (#15931)Divy Srivastava
2022-08-21feat: `queueMicrotask()` error handling (#15522)Nayeem Rahman
Adds error event dispatching for queueMicrotask(). Consequently unhandled errors are now reported with Deno.core.terminate(), which is immune to the existing quirk with plainly thrown errors (#14158).
2022-08-11perf(ops): Monomorphic sync op calls (#15337)Aapo Alasuutari
Welcome to better optimised op calls! Currently opSync is called with parameters of every type and count. This most definitely makes the call megamorphic. Additionally, it seems that spread params leads to V8 not being able to optimise the calls quite as well (apparently Fast Calls cannot be used with spread params). Monomorphising op calls should lead to some improved performance. Now that unwrapping of sync ops results is done on Rust side, this is pretty simple: ``` opSync("op_foo", param1, param2); // -> turns to ops.op_foo(param1, param2); ``` This means sync op calls are now just directly calling the native binding function. When V8 Fast API Calls are enabled, this will enable those to be called on the optimised path. Monomorphising async ops likely requires using callbacks and is left as an exercise to the reader.
2022-08-10fix: allow setting `globalThis.location` when no `--location` is provided ↵Kayla Washburn
(#15448)
2022-08-04fix: Update `Object.prototype.__proto__` related comments (#15394)Yongwook Choi
2022-07-23fix: unhandledrejection handling for sync throw in top level (#15279)Bartek Iwańczuk
Fixes an edge in "unhandledrejection" event that prevent synchronous errors being surfaced when throw from a top-level scope.
2022-07-20Reland "feat: add "unhandledrejection" event support" (#15211)Bartek Iwańczuk
2022-07-15Revert "feat: add "unhandledrejection" event support (#12994) (#15080)" (#15210)Bartek Iwańczuk
This reverts commit 1a7259b04b7229f6350a7a7c21b50497b5c80c17.
2022-07-14feat: add "unhandledrejection" event support (#12994) (#15080)Bartek Iwańczuk
Relanding #12994 This commit adds support for "unhandledrejection" event. This event will trigger event listeners registered using: "globalThis.addEventListener("unhandledrejection") "globalThis.onunhandledrejection" This is done by registering a default handler using "Deno.core.setPromiseRejectCallback" that allows to handle rejected promises in JavaScript instead of Rust. This commit will make it possible to polyfill "process.on("unhandledRejection")" in the Node compat layer. Co-authored-by: Colin Ihrig <cjihrig@gmail.com>
2022-07-04Revert "feat: add "unhandledrejection" event support (#12994)" (#15075)Bartek Iwańczuk
This reverts commit f7af0b01a59aaac91473e2f920137004d39a310a.
2022-07-04feat: add "unhandledrejection" event support (#12994)Bartek Iwańczuk
This commit adds support for "unhandledrejection" event. This event will trigger event listeners registered using: "globalThis.addEventListener("unhandledrejection") "globalThis.onunhandledrejection" This is done by registering a default handler using "Deno.core.setPromiseRejectCallback" that allows to handle rejected promises in JavaScript instead of Rust. This commit will make it possible to polyfill "process.on("unhandledRejection")" in the Node compat layer. Co-authored-by: Colin Ihrig <cjihrig@gmail.com>
2022-06-28feat(web): add beforeunload event (#14830)Colin Ihrig
This commit adds the 'beforeunload' event. Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2022-06-15BREAKING: remove `Intl.v8BreakIterator` (#14864)Luca Casonato
This is a non-standard API that is mostly replaced by `Intl.Segmenter`.
2022-06-13Deno.exit() is an alias to self.close() in worker contexts (#14826)Bartek Iwańczuk
This commit changes Deno.exit() to be an alias to self.close() in worker contexts, and the provided exit code becomes is ignored.
2022-06-07refactor(core): Move Deno.core bindings to ops (#14793)Nayeem Rahman
2022-06-06fix: Format non-error exceptions (#14604)Nayeem Rahman
This commit adds "Deno.core.setFormatExceptionCallback" which can be used to provide custom formatting for errors. It is useful in cases when user throws something that is non-Error (eg. a string, plain object, etc).