mirror of
https://github.com/denoland/deno.git
synced 2024-12-24 16:19:12 -05:00
parent
be7e2bd8c1
commit
edeccef499
7 changed files with 29 additions and 33 deletions
|
@ -9,7 +9,8 @@ use deno_bench_util::bench_js_sync};
|
|||
|
||||
use deno_core::Extension;
|
||||
|
||||
#[op]
|
||||
#[op2]
|
||||
#[number]
|
||||
fn op_nop() -> usize {
|
||||
9
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@ use deno_bench_util::bench_or_profile;
|
|||
use deno_bench_util::bencher::benchmark_group;
|
||||
use deno_bench_util::bencher::Bencher;
|
||||
|
||||
use deno_core::op;
|
||||
use deno_core::op2;
|
||||
use deno_core::Extension;
|
||||
|
||||
deno_core::extension!(
|
||||
|
@ -22,25 +22,25 @@ fn setup() -> Vec<Extension> {
|
|||
vec![bench_setup::init_ops()]
|
||||
}
|
||||
|
||||
#[op]
|
||||
#[op2(fast)]
|
||||
fn op_nop() {}
|
||||
|
||||
// TODO(bartlomieju): reenable, currently this op generates a fast function,
|
||||
// which is wrong, because i64 is not a compatible type for fast call.
|
||||
// #[op]
|
||||
// fn op_pi_json() -> i64 {
|
||||
// 314159
|
||||
// }
|
||||
#[op2(fast)]
|
||||
#[number]
|
||||
fn op_pi_json() -> i64 {
|
||||
314159
|
||||
}
|
||||
|
||||
// this is a function since async closures aren't stable
|
||||
#[op]
|
||||
#[op2(async)]
|
||||
#[number]
|
||||
async fn op_pi_async() -> i64 {
|
||||
314159
|
||||
}
|
||||
|
||||
// fn bench_op_pi_json(b: &mut Bencher) {
|
||||
// bench_js_sync(b, r#"Deno.core.ops.op_pi_json();"#, setup);
|
||||
// }
|
||||
fn bench_op_pi_json(b: &mut Bencher) {
|
||||
bench_js_sync(b, r#"Deno.core.ops.op_pi_json();"#, setup);
|
||||
}
|
||||
|
||||
fn bench_op_nop(b: &mut Bencher) {
|
||||
bench_js_sync(b, r#"Deno.core.ops.op_nop();"#, setup);
|
||||
|
@ -50,11 +50,6 @@ fn bench_op_async(b: &mut Bencher) {
|
|||
bench_js_async(b, r#"Deno.core.opAsync("op_pi_async");"#, setup);
|
||||
}
|
||||
|
||||
benchmark_group!(
|
||||
benches,
|
||||
// bench_op_pi_json,
|
||||
bench_op_nop,
|
||||
bench_op_async,
|
||||
);
|
||||
benchmark_group!(benches, bench_op_pi_json, bench_op_nop, bench_op_async,);
|
||||
|
||||
bench_or_profile!(benches);
|
||||
|
|
|
@ -1,9 +1,5 @@
|
|||
// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
|
||||
|
||||
// TODO: allow everywhere because `#[allow(clippy::too_many_arguments)]` on
|
||||
// `#[op(fast)]` does not work. https://github.com/denoland/rusty_v8/issues/1332
|
||||
#![allow(clippy::too_many_arguments)]
|
||||
|
||||
use crate::tools::test::TestDescription;
|
||||
use crate::tools::test::TestEvent;
|
||||
use crate::tools::test::TestEventSender;
|
||||
|
@ -117,6 +113,7 @@ struct TestRegisterResult {
|
|||
|
||||
static NEXT_ID: AtomicUsize = AtomicUsize::new(0);
|
||||
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
#[op2]
|
||||
#[string]
|
||||
fn op_register_test(
|
||||
|
|
|
@ -372,6 +372,8 @@ pub async fn upgrade(
|
|||
};
|
||||
|
||||
let download_url = if upgrade_flags.canary {
|
||||
// NOTE(bartlomieju): to keep clippy happy on M1 macs.
|
||||
#[allow(clippy::eq_op)]
|
||||
if env!("TARGET") == "aarch64-apple-darwin" {
|
||||
bail!("Canary builds are not available for M1/M2");
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
use deno_core::error::type_error;
|
||||
use deno_core::error::AnyError;
|
||||
use deno_core::op;
|
||||
use deno_core::op2;
|
||||
use deno_core::url::Url;
|
||||
use deno_core::AsyncRefCell;
|
||||
use deno_core::ByteString;
|
||||
|
@ -23,13 +23,14 @@ use reqwest::header::CONTENT_LENGTH;
|
|||
use reqwest::Body;
|
||||
use reqwest::Method;
|
||||
|
||||
#[op]
|
||||
#[op2]
|
||||
#[serde]
|
||||
pub fn op_node_http_request<P>(
|
||||
state: &mut OpState,
|
||||
method: ByteString,
|
||||
url: String,
|
||||
headers: Vec<(ByteString, ByteString)>,
|
||||
client_rid: Option<u32>,
|
||||
#[serde] method: ByteString,
|
||||
#[string] url: String,
|
||||
#[serde] headers: Vec<(ByteString, ByteString)>,
|
||||
#[smi] client_rid: Option<u32>,
|
||||
has_body: bool,
|
||||
) -> Result<FetchReturn, AnyError>
|
||||
where
|
||||
|
|
|
@ -5,7 +5,6 @@ use crate::permissions::PermissionsContainer;
|
|||
use crate::worker::ExitCode;
|
||||
use deno_core::error::type_error;
|
||||
use deno_core::error::AnyError;
|
||||
use deno_core::op;
|
||||
use deno_core::op2;
|
||||
use deno_core::url::Url;
|
||||
use deno_core::v8;
|
||||
|
@ -476,7 +475,8 @@ fn os_uptime(state: &mut OpState) -> Result<u64, AnyError> {
|
|||
Ok(sys_info::os_uptime())
|
||||
}
|
||||
|
||||
#[op]
|
||||
#[op2(fast)]
|
||||
#[number]
|
||||
fn op_os_uptime(state: &mut OpState) -> Result<u64, AnyError> {
|
||||
os_uptime(state)
|
||||
}
|
||||
|
|
|
@ -5,7 +5,6 @@ mod sync_fetch;
|
|||
use crate::web_worker::WebWorkerInternalHandle;
|
||||
use crate::web_worker::WebWorkerType;
|
||||
use deno_core::error::AnyError;
|
||||
use deno_core::op;
|
||||
use deno_core::op2;
|
||||
|
||||
use deno_core::CancelFuture;
|
||||
|
@ -38,7 +37,8 @@ fn op_worker_post_message(
|
|||
Ok(())
|
||||
}
|
||||
|
||||
#[op(deferred)]
|
||||
#[op2(async(lazy))]
|
||||
#[serde]
|
||||
async fn op_worker_recv_message(
|
||||
state: Rc<RefCell<OpState>>,
|
||||
) -> Result<Option<JsMessageData>, AnyError> {
|
||||
|
|
Loading…
Reference in a new issue