Skip to content

Commit 84dbf9a

Browse files
authored
Revert "feat(op2): remove async attribute and make FromV8/ToV8 the default behaviour (#1262)" (#1275)
This reverts commit df40fcb.
1 parent c4797c0 commit 84dbf9a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+1454
-992
lines changed

core/benches/ops/async.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,10 @@ pub fn op_make_external() -> *const c_void {
5151
std::ptr::null()
5252
}
5353

54-
#[op2]
54+
#[op2(async)]
5555
pub async fn op_async_void() {}
5656

57-
#[op2]
57+
#[op2(async)]
5858
pub async fn op_async_yield() {
5959
tokio::task::yield_now().await
6060
}

core/benches/ops/sync.rs

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ deno_core::extension!(
2525
op_local,
2626
op_local_scope,
2727
op_local_nofast,
28+
op_global,
29+
op_global_scope,
2830
op_scope,
2931
op_isolate_nofast,
3032
op_make_external,
@@ -109,6 +111,16 @@ pub fn op_local_scope<'s>(
109111
#[op2(nofast)]
110112
pub fn op_local_nofast(_s: v8::Local<v8::String>) {}
111113

114+
#[op2]
115+
pub fn op_global(#[global] _s: v8::Global<v8::String>) {}
116+
117+
#[op2]
118+
pub fn op_global_scope(
119+
_scope: &mut v8::PinScope,
120+
#[global] _s: v8::Global<v8::String>,
121+
) {
122+
}
123+
112124
#[op2(fast)]
113125
pub fn op_scope(_scope: &mut v8::PinScope) {}
114126

@@ -443,6 +455,28 @@ fn bench_op_v8_local_nofast(b: &mut Bencher) {
443455
);
444456
}
445457

458+
/// A function that takes a v8::Global<String>
459+
fn bench_op_v8_global(b: &mut Bencher) {
460+
bench_op(
461+
b,
462+
BENCH_COUNT,
463+
"op_global",
464+
1,
465+
"op_global('this is a reasonably long string that we would like to get the length of!');",
466+
);
467+
}
468+
469+
/// A function that takes a v8::Global<String>
470+
fn bench_op_v8_global_scope(b: &mut Bencher) {
471+
bench_op(
472+
b,
473+
BENCH_COUNT,
474+
"op_global_scope",
475+
1,
476+
"op_global_scope('this is a reasonably long string that we would like to get the length of!');",
477+
);
478+
}
479+
446480
fn bench_op_bigint(b: &mut Bencher) {
447481
bench_op(b, BENCH_COUNT, "op_bigint", 1, "op_bigint(0n);");
448482
}
@@ -547,6 +581,8 @@ benchmark_group!(
547581
bench_op_v8_local,
548582
bench_op_v8_local_scope,
549583
bench_op_v8_local_nofast,
584+
bench_op_v8_global,
585+
bench_op_v8_global_scope,
550586
bench_op_bigint,
551587
bench_op_bigint_return,
552588
bench_op_v8_scope,

0 commit comments

Comments
 (0)