Commit graph

31 commits

Author SHA1 Message Date
Matt Mastracci 56f58a047e
chore: bump deno core (#22243)
Migrations:

- Error registration no longer required for Interrupted or BadResource
(these are core exception)
 - `include_js_files!`/`ExtensionFileSource` changes
2024-02-04 17:03:14 -07:00
David Sherret 7e72f3af61
chore: update copyright to 2024 (#21753) 2024-01-01 19:58:21 +00:00
Matt Mastracci 5e82fce0a0
chore: remove op_baseline and flamebench (#21120)
ops are better tested in deno_core, and flamebench has rotted quite a
bit.
2023-11-08 13:00:13 -07:00
Bartek Iwańczuk 8706a20d1f
bench: fix ops benchmarks (#20830)
https://github.com/denoland/deno/pull/20808 broke benchmarks, this
commit should fix it.
2023-10-08 18:43:14 +00:00
Bartek Iwańczuk edeccef499
refactor: migrate more ops to op2 macro (#20808)
Getting closer...
2023-10-07 21:04:03 +05:30
Nayeem Rahman d5efdeeff1
refactor: update core extension api usage (#19952) 2023-07-31 18:19:15 +00:00
Bartek Iwańczuk ad3c494b46
Revert "Reland "refactor(core): cleanup feature flags for js source i… (#19611)
…nclusion" (#19519)"

This reverts commit 28a4f3d0f5.

This change causes failures when used outside Deno repo:
```
============================================================
Deno has panicked. This is a bug in Deno. Please report this
at https://github.com/denoland/deno/issues/new.
If you can reliably reproduce this panic, include the
reproduction steps and re-run with the RUST_BACKTRACE=1 env
var set and include the backtrace in your report.

Platform: linux x86_64
Version: 1.34.3+b37b286
Args: ["/opt/hostedtoolcache/deno/0.0.0-b37b286f7fa68d5656f7c180f6127bdc38cf2cf5/x64/deno", "test", "--doc", "--unstable", "--allow-all", "--coverage=./cov"]

thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Failed to read "/home/runner/work/deno/deno/core/00_primordials.js"

Caused by:
    No such file or directory (os error 2)', core/runtime/jsruntime.rs:699:8
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
```
2023-06-26 13:54:10 +02:00
Nayeem Rahman 28a4f3d0f5
Reland "refactor(core): cleanup feature flags for js source inclusion" (#19519)
Relands #19463. This time the `ExtensionFileSourceCode` enum is
preserved, so this effectively just splits feature
`include_js_for_snapshotting` into `exclude_js_sources` and
`runtime_js_sources`, adds a `force_include_js_sources` option on
`extension!()`, and unifies `ext::Init_ops_and_esm()` and
`ext::init_ops()` into `ext::init()`.
2023-06-25 09:35:31 +02:00
Bartek Iwańczuk 60bf79c184
Revert "refactor(core): cleanup feature flags for js source inclusion… (#19490)
… (#19463)"

This reverts commit ceb03cfb03.

This is being reverted because it causes 3.5Mb increase in the binary
size,
due to runtime JS code being included in the binary, even though it's
already snapshotted.

CC @nayeemrmn
2023-06-13 22:36:16 +00:00
Nayeem Rahman ceb03cfb03
refactor(core): cleanup feature flags for js source inclusion (#19463)
Remove `ExtensionFileSourceCode::LoadedFromFsDuringSnapshot` and feature
`include_js_for_snapshotting` since they leak paths that are only
applicable in this repo to embedders. Replace with feature
`exclude_js_sources`. Additionally the feature
`force_include_js_sources` allows negating it, if both features are set.
We need both of these because features are additive and there must be a
way of force including sources for snapshot creation while still having
the `exclude_js_sources` feature. `force_include_js_sources` is only set
for build deps, so sources are still excluded from the final binary.

You can also specify `force_include_js_sources` on any extension to
override the above features for that extension. Towards #19398.

But there was still the snapshot-from-snapshot situation where code
could be executed twice, I addressed that by making `mod_evaluate()` and
scripts like `core/01_core.js` behave idempotently. This allowed
unifying `ext::init_ops()` and `ext::init_ops_and_esm()` into
`ext::init()`.
2023-06-13 09:45:06 -06:00
Bartek Iwańczuk 3c9771deb2
Reland "perf(core): preserve ops between snapshots (#18080)" (#18272)
Relanding 4b6305f4f2
2023-03-18 18:30:04 -04:00
Bartek Iwańczuk d33369c6c7
perf(core): use static specifier in ExtensionFileSource (#18271)
Relanding #18264

-------

Co-authored-by: Divy Srivastava <dj.srivastava23@gmail.com>
2023-03-18 20:09:13 +00:00
Bartek Iwańczuk f6c364fcf6
Revert "perf(core): use static specifier in ExtensionFileSource (#182… (#18270)
…64)"

This reverts commit 8af0c83519.

Causes bench stage to fail on CI.
2023-03-18 20:25:28 +01:00
Divy Srivastava 8af0c83519
perf(core): use static specifier in ExtensionFileSource (#18264)
Closes #18085

---------

Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2023-03-18 13:14:28 +00:00
Matt Mastracci e55b448730
feat(core) deno_core::extension! macro to simplify extension registration (#18210)
This implements two macros to simplify extension registration and centralize a lot of the boilerplate as a base for future improvements:

* `deno_core::ops!` registers a block of `#[op]`s, optionally with type
parameters, useful for places where we share lists of ops
* `deno_core::extension!` is used to register an extension, and creates
two methods that can be used at runtime/snapshot generation time:
`init_ops` and `init_ops_and_esm`.

---------

Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2023-03-17 18:22:15 +00:00
Bartek Iwańczuk a1cd2a5915
refactor(core): definition of "ExtensionFileSource" (#17823)
This commit changes definition of "ExtensionFileSource", by changing
"code" field to being "ExtensionFileSourceCode" enum. Currently the enum
has only a single variant "IncludedInBinary". It is done in preparation
to allow embedders to decide if they want to include the source code in the
binary when snapshotting (in most cases they shouldn't do that).

In the follow up commit we'll add more variants to
"ExtensionFileSourceCode".

"include_js_files_dir!" macro was removed in favor "include_js_files!"
macro which can now accept "dir" option.
2023-02-20 01:11:56 +01:00
Bartek Iwańczuk 161a4fea47
refactor(core): change SourcePair to ExtensionFileSource (#17686) 2023-02-08 00:21:43 +01:00
Divy Srivastava d5634164cb
chore: use rustfmt imports_granularity option (#17421)
Closes https://github.com/denoland/deno/issues/2699
Closes https://github.com/denoland/deno/issues/2347

Uses unstable rustfmt features. Since dprint invokes `rustfmt` we do not
need to switch the cargo toolchain to nightly. Do we care about
formatting stability of our codebase across Rust versions? (I don't)
2023-01-14 23:18:58 -05:00
Yiyu Lin a00e432297
chore: add copyright_checker tool and add the missing copyright (#17285) 2023-01-13 16:51:32 +09:00
Leo Kettmeir c41d4ff90e
feat(core): allow specifying name and dependencies of an Extension (#17301) 2023-01-08 23:48:46 +01:00
Divy Srivastava a7558196a7
perf: use fast api for core.isProxy (#15682) 2022-08-30 14:31:36 +05:30
Aapo Alasuutari 2164f6b1eb
perf(ops): Monomorphic sync op calls (#15337)
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-11 15:56:56 +02:00
Aaron O'Mullan f5c31b56e3
Revert "core: don't include_str extension js code (#10786)" (#14614)
This reverts commit 10e50a1207

Alternative to #13217, IMO the tradeoffs made by #10786 aren't worth it.

It breaks abstractions (crates being self-contained, deno_core without snapshotting etc...) and causes pain points / gotchas for both embedders & devs for a relatively minimal gain in incremental build time ...

Closes #11030
2022-05-15 13:27:56 +02:00
Andreu Botella 3e7afb8918
chore(runtime): Make some ops in ext and runtime infallible. (#14589)
Co-authored-by: Aaron O'Mullan <aaron.omullan@gmail.com>
2022-05-13 10:36:31 +02:00
Aaron O'Mullan bd481bf095
feat(ops): optional OpState (#13954) 2022-03-16 00:33:46 +01:00
Aaron O'Mullan 88d0f01948
feat(ops): custom arity (#13949)
Also cleanup & drop ignored wildcard op-args
2022-03-14 23:38:53 +01:00
Divy Srivastava b4e42953e1
feat(core): codegen ops (#13861)
Co-authored-by: Aaron O'Mullan <aaron.omullan@gmail.com>
2022-03-14 18:44:15 +01:00
Aaron O'Mullan 7122187bc7
bench: core.encode/decode (#13750) 2022-02-23 18:51:13 +01:00
Aaron O'Mullan c4b995ffe6
bench(op_baseline): measure Deno.core.isProxy() (#12347) 2021-10-06 20:18:25 +02:00
Aaron O'Mullan ee00b7c897
cleanup(bench_util): use Extensions for setup (#10737) 2021-05-21 15:46:26 +02:00
Aaron O'Mullan 24da0aa37d
tooling: re-enable bench_util (#10674) 2021-05-19 19:41:23 +02:00