From 0231a18812c2d4b7a6a31ffde125ea63933cd8bd Mon Sep 17 00:00:00 2001 From: Divy Srivastava Date: Thu, 2 Jan 2025 03:38:34 -0800 Subject: [PATCH] Symbol keys in object wrap (#1017) ```rust #[fast] #[symbol("symbolMethod")] fn something(&self) {} ``` Equivalent to `Symbol.for("symbolMethod")` --- core/extensions.rs | 3 +++ core/runtime/bindings.rs | 22 +++++++++++++++---- ops/op2/config.rs | 6 +++++ ops/op2/mod.rs | 3 +++ ops/op2/test_cases/async/async_arg_return.out | 1 + .../async/async_arg_return_result.out | 1 + ops/op2/test_cases/async/async_cppgc.out | 3 +++ ops/op2/test_cases/async/async_deferred.out | 1 + ops/op2/test_cases/async/async_jsbuffer.out | 1 + ops/op2/test_cases/async/async_lazy.out | 1 + .../test_cases/async/async_op_metadata.out | 2 ++ ops/op2/test_cases/async/async_opstate.out | 1 + ops/op2/test_cases/async/async_result.out | 1 + .../test_cases/async/async_result_impl.out | 1 + ops/op2/test_cases/async/async_result_smi.out | 1 + .../test_cases/async/async_stack_trace.out | 1 + ops/op2/test_cases/async/async_v8_global.out | 1 + ops/op2/test_cases/async/async_void.out | 1 + ops/op2/test_cases/sync/add.out | 1 + ops/op2/test_cases/sync/add_options.out | 1 + ops/op2/test_cases/sync/bigint.out | 1 + ops/op2/test_cases/sync/bool.out | 1 + ops/op2/test_cases/sync/bool_result.out | 1 + ops/op2/test_cases/sync/buffers.out | 3 +++ ops/op2/test_cases/sync/buffers_copy.out | 2 ++ ops/op2/test_cases/sync/buffers_out.out | 3 +++ ops/op2/test_cases/sync/cfg.out | 2 ++ ops/op2/test_cases/sync/clippy_allow.out | 2 ++ ops/op2/test_cases/sync/cppgc_resource.out | 6 +++++ ops/op2/test_cases/sync/doc_comment.out | 1 + ops/op2/test_cases/sync/fast_alternative.out | 4 ++++ ops/op2/test_cases/sync/from_v8.out | 1 + ops/op2/test_cases/sync/generics.out | 3 +++ ops/op2/test_cases/sync/nofast.out | 1 + ops/op2/test_cases/sync/object_wrap.out | 9 ++++++++ ops/op2/test_cases/sync/op_state_attr.out | 1 + ops/op2/test_cases/sync/op_state_rc.out | 1 + ops/op2/test_cases/sync/op_state_ref.out | 4 ++++ ops/op2/test_cases/sync/result_external.out | 1 + ops/op2/test_cases/sync/result_primitive.out | 1 + ops/op2/test_cases/sync/result_scope.out | 1 + ops/op2/test_cases/sync/result_void.out | 1 + ops/op2/test_cases/sync/serde_v8.out | 1 + ops/op2/test_cases/sync/smi.out | 3 +++ ops/op2/test_cases/sync/stack_trace.out | 1 + ops/op2/test_cases/sync/stack_trace_scope.out | 1 + ops/op2/test_cases/sync/string_cow.out | 1 + ops/op2/test_cases/sync/string_onebyte.out | 1 + .../test_cases/sync/string_option_return.out | 1 + ops/op2/test_cases/sync/string_owned.out | 1 + ops/op2/test_cases/sync/string_ref.out | 1 + ops/op2/test_cases/sync/string_return.out | 3 +++ ops/op2/test_cases/sync/to_v8.out | 1 + ops/op2/test_cases/sync/v8_global.out | 1 + ops/op2/test_cases/sync/v8_handlescope.out | 1 + ops/op2/test_cases/sync/v8_lifetime.out | 1 + ops/op2/test_cases/sync/v8_ref_option.out | 1 + ops/op2/test_cases/sync/v8_string.out | 1 + testing/checkin/runner/ops.rs | 4 ++++ testing/unit/resource_test.ts | 3 +++ 60 files changed, 126 insertions(+), 4 deletions(-) diff --git a/core/extensions.rs b/core/extensions.rs index 49ddda805..98ce47288 100644 --- a/core/extensions.rs +++ b/core/extensions.rs @@ -199,6 +199,7 @@ pub struct OpDecl { pub name_fast: FastStaticString, pub is_async: bool, pub is_reentrant: bool, + pub symbol_for: bool, pub accessor_type: AccessorType, pub arg_count: u8, pub no_side_effects: bool, @@ -222,6 +223,7 @@ impl OpDecl { name: (&'static str, FastStaticString), is_async: bool, is_reentrant: bool, + symbol_for: bool, arg_count: u8, no_side_effects: bool, slow_fn: OpFnRef, @@ -237,6 +239,7 @@ impl OpDecl { name_fast: name.1, is_async, is_reentrant, + symbol_for, arg_count, no_side_effects, slow_fn, diff --git a/core/runtime/bindings.rs b/core/runtime/bindings.rs index d24fe10c1..52995b06f 100644 --- a/core/runtime/bindings.rs +++ b/core/runtime/bindings.rs @@ -10,6 +10,7 @@ use v8::MapFnTo; use super::jsruntime::BUILTIN_SOURCES; use super::jsruntime::CONTEXT_SETUP_SOURCES; use super::v8_static_strings::*; +use crate::OpDecl; use crate::_ops::OpMethodDecl; use crate::cppgc::cppgc_template_constructor; use crate::cppgc::FunctionTemplateData; @@ -328,6 +329,18 @@ pub(crate) fn initialize_primordials_and_infra( Ok(()) } +fn name_key<'s>( + scope: &mut v8::HandleScope<'s>, + decl: &OpDecl, +) -> v8::Local<'s, v8::Name> { + let key_str = decl.name_fast.v8_string(scope).unwrap(); + if decl.symbol_for { + v8::Symbol::for_key(scope, key_str).into() + } else { + key_str.into() + } +} + /// Set up JavaScript bindings for ops. pub(crate) fn initialize_deno_core_ops_bindings<'s>( scope: &mut v8::HandleScope<'s>, @@ -389,8 +402,9 @@ pub(crate) fn initialize_deno_core_ops_bindings<'s>( let static_method_ctxs = &op_ctxs[index..index + decl.static_methods.len()]; for method in static_method_ctxs.iter() { let op_fn = op_ctx_template(scope, method); - let method_key = method.decl.name_fast; - tmpl.set(method_key.v8_string(scope).unwrap().into(), op_fn.into()); + let method_key = name_key(scope, &method.decl); + + tmpl.set(method_key, op_fn.into()); } index += decl.static_methods.len(); @@ -434,7 +448,7 @@ fn op_ctx_template_or_accessor<'s>( ) { if !op_ctx.decl.is_accessor() { let op_fn = op_ctx_template(scope, op_ctx); - let method_key = op_ctx.decl.name_fast.v8_string(scope).unwrap(); + let method_key = name_key(scope, &op_ctx.decl); if op_ctx.decl.is_async { let undefined = v8::undefined(scope); let op_fn = op_fn.get_function(scope).unwrap(); @@ -452,7 +466,7 @@ fn op_ctx_template_or_accessor<'s>( return; } - tmpl.set(method_key.into(), op_fn.into()); + tmpl.set(method_key, op_fn.into()); return; } diff --git a/ops/op2/config.rs b/ops/op2/config.rs index bbb033967..df9ce7f4d 100644 --- a/ops/op2/config.rs +++ b/ops/op2/config.rs @@ -43,6 +43,8 @@ pub(crate) struct MacroConfig { pub required: u8, /// Rename the op to the given name. pub rename: Option, + /// Symbol.for("op_name") for the op. + pub symbol: bool, } impl MacroConfig { @@ -144,6 +146,10 @@ impl MacroConfig { } else if flag.starts_with("rename(") { let tokens = syn::parse_str::(&flag[7..flag.len() - 1])?; config.rename = Some(tokens.value()); + } else if flag.starts_with("symbol(") { + let tokens = syn::parse_str::(&flag[7..flag.len() - 1])?; + config.rename = Some(tokens.value()); + config.symbol = true; } else { return Err(Op2Error::InvalidAttribute(flag)); } diff --git a/ops/op2/mod.rs b/ops/op2/mod.rs index 668a7a572..b4177c5d2 100644 --- a/ops/op2/mod.rs +++ b/ops/op2/mod.rs @@ -310,6 +310,8 @@ pub(crate) fn generate_op2( quote!(::deno_core::AccessorType::None) }; + let symbol_for = config.symbol; + Ok(quote! { #[allow(non_camel_case_types)] #vis const fn #rust_name <#(#generic : #bound),*> () -> ::deno_core::_ops::OpDecl { @@ -326,6 +328,7 @@ pub(crate) fn generate_op2( /*name*/ ::deno_core::__op_name_fast!(#name), /*is_async*/ #is_async, /*is_reentrant*/ #is_reentrant, + /*symbol_for*/ #symbol_for, /*arg_count*/ #arg_count as u8, /*no_side_effect*/ #no_side_effect, /*slow_fn*/ Self::#slow_function as _, diff --git a/ops/op2/test_cases/async/async_arg_return.out b/ops/op2/test_cases/async/async_arg_return.out index a7f0c0d10..e6794157e 100644 --- a/ops/op2/test_cases/async/async_arg_return.out +++ b/ops/op2/test_cases/async/async_arg_return.out @@ -10,6 +10,7 @@ pub const fn op_async() -> ::deno_core::_ops::OpDecl { ::deno_core::__op_name_fast!(op_async), true, false, + false, 2usize as u8, false, Self::v8_fn_ptr as _, diff --git a/ops/op2/test_cases/async/async_arg_return_result.out b/ops/op2/test_cases/async/async_arg_return_result.out index b5bdb0dfb..0e3f3a9c0 100644 --- a/ops/op2/test_cases/async/async_arg_return_result.out +++ b/ops/op2/test_cases/async/async_arg_return_result.out @@ -10,6 +10,7 @@ pub const fn op_async() -> ::deno_core::_ops::OpDecl { ::deno_core::__op_name_fast!(op_async), true, false, + false, 2usize as u8, false, Self::v8_fn_ptr as _, diff --git a/ops/op2/test_cases/async/async_cppgc.out b/ops/op2/test_cases/async/async_cppgc.out index b4a39ae9f..0d3d376b3 100644 --- a/ops/op2/test_cases/async/async_cppgc.out +++ b/ops/op2/test_cases/async/async_cppgc.out @@ -10,6 +10,7 @@ const fn op_make_cppgc_object() -> ::deno_core::_ops::OpDecl { ::deno_core::__op_name_fast!(op_make_cppgc_object), true, false, + false, 1usize as u8, false, Self::v8_fn_ptr as _, @@ -134,6 +135,7 @@ const fn op_use_cppgc_object() -> ::deno_core::_ops::OpDecl { ::deno_core::__op_name_fast!(op_use_cppgc_object), true, false, + false, 2usize as u8, false, Self::v8_fn_ptr as _, @@ -258,6 +260,7 @@ const fn op_use_optional_cppgc_object() -> ::deno_core::_ops::OpDecl { ::deno_core::__op_name_fast!(op_use_optional_cppgc_object), true, false, + false, 2usize as u8, false, Self::v8_fn_ptr as _, diff --git a/ops/op2/test_cases/async/async_deferred.out b/ops/op2/test_cases/async/async_deferred.out index 2e409510a..c447f4ff1 100644 --- a/ops/op2/test_cases/async/async_deferred.out +++ b/ops/op2/test_cases/async/async_deferred.out @@ -10,6 +10,7 @@ pub const fn op_async_deferred() -> ::deno_core::_ops::OpDecl { ::deno_core::__op_name_fast!(op_async_deferred), true, false, + false, 1usize as u8, false, Self::v8_fn_ptr as _, diff --git a/ops/op2/test_cases/async/async_jsbuffer.out b/ops/op2/test_cases/async/async_jsbuffer.out index fae7506ff..02a9ff897 100644 --- a/ops/op2/test_cases/async/async_jsbuffer.out +++ b/ops/op2/test_cases/async/async_jsbuffer.out @@ -10,6 +10,7 @@ pub const fn op_async_v8_buffer() -> ::deno_core::_ops::OpDecl { ::deno_core::__op_name_fast!(op_async_v8_buffer), true, false, + false, 2usize as u8, false, Self::v8_fn_ptr as _, diff --git a/ops/op2/test_cases/async/async_lazy.out b/ops/op2/test_cases/async/async_lazy.out index c262c975a..948dfa9ed 100644 --- a/ops/op2/test_cases/async/async_lazy.out +++ b/ops/op2/test_cases/async/async_lazy.out @@ -10,6 +10,7 @@ pub const fn op_async_lazy() -> ::deno_core::_ops::OpDecl { ::deno_core::__op_name_fast!(op_async_lazy), true, false, + false, 1usize as u8, false, Self::v8_fn_ptr as _, diff --git a/ops/op2/test_cases/async/async_op_metadata.out b/ops/op2/test_cases/async/async_op_metadata.out index 70bbf2667..8f8045b43 100644 --- a/ops/op2/test_cases/async/async_op_metadata.out +++ b/ops/op2/test_cases/async/async_op_metadata.out @@ -10,6 +10,7 @@ const fn op_blob_read_part() -> ::deno_core::_ops::OpDecl { ::deno_core::__op_name_fast!(op_blob_read_part), true, false, + false, 1usize as u8, false, Self::v8_fn_ptr as _, @@ -117,6 +118,7 @@ const fn op_broadcast_recv() -> ::deno_core::_ops::OpDecl { ::deno_core::__op_name_fast!(op_broadcast_recv), true, false, + false, 1usize as u8, false, Self::v8_fn_ptr as _, diff --git a/ops/op2/test_cases/async/async_opstate.out b/ops/op2/test_cases/async/async_opstate.out index b7546b84f..bf82a040b 100644 --- a/ops/op2/test_cases/async/async_opstate.out +++ b/ops/op2/test_cases/async/async_opstate.out @@ -10,6 +10,7 @@ pub const fn op_async_opstate() -> ::deno_core::_ops::OpDecl { ::deno_core::__op_name_fast!(op_async_opstate), true, false, + false, 2usize as u8, false, Self::v8_fn_ptr as _, diff --git a/ops/op2/test_cases/async/async_result.out b/ops/op2/test_cases/async/async_result.out index cdfa74725..34efefc3c 100644 --- a/ops/op2/test_cases/async/async_result.out +++ b/ops/op2/test_cases/async/async_result.out @@ -10,6 +10,7 @@ pub const fn op_async() -> ::deno_core::_ops::OpDecl { ::deno_core::__op_name_fast!(op_async), true, false, + false, 1usize as u8, false, Self::v8_fn_ptr as _, diff --git a/ops/op2/test_cases/async/async_result_impl.out b/ops/op2/test_cases/async/async_result_impl.out index cf37255e3..ee648425f 100644 --- a/ops/op2/test_cases/async/async_result_impl.out +++ b/ops/op2/test_cases/async/async_result_impl.out @@ -10,6 +10,7 @@ pub const fn op_async_result_impl() -> ::deno_core::_ops::OpDecl { ::deno_core::__op_name_fast!(op_async_result_impl), true, false, + false, 2usize as u8, false, Self::v8_fn_ptr as _, diff --git a/ops/op2/test_cases/async/async_result_smi.out b/ops/op2/test_cases/async/async_result_smi.out index 6e41c6915..17285ceed 100644 --- a/ops/op2/test_cases/async/async_result_smi.out +++ b/ops/op2/test_cases/async/async_result_smi.out @@ -10,6 +10,7 @@ pub const fn op_async() -> ::deno_core::_ops::OpDecl { ::deno_core::__op_name_fast!(op_async), true, false, + false, 2usize as u8, false, Self::v8_fn_ptr as _, diff --git a/ops/op2/test_cases/async/async_stack_trace.out b/ops/op2/test_cases/async/async_stack_trace.out index b3d39a1dd..4c05fd3f3 100644 --- a/ops/op2/test_cases/async/async_stack_trace.out +++ b/ops/op2/test_cases/async/async_stack_trace.out @@ -10,6 +10,7 @@ pub const fn op_async_stack_trace() -> ::deno_core::_ops::OpDecl { ::deno_core::__op_name_fast!(op_async_stack_trace), true, false, + false, 1usize as u8, false, Self::v8_fn_ptr as _, diff --git a/ops/op2/test_cases/async/async_v8_global.out b/ops/op2/test_cases/async/async_v8_global.out index 4f1bca458..f35e48664 100644 --- a/ops/op2/test_cases/async/async_v8_global.out +++ b/ops/op2/test_cases/async/async_v8_global.out @@ -10,6 +10,7 @@ pub const fn op_async_v8_global() -> ::deno_core::_ops::OpDecl { ::deno_core::__op_name_fast!(op_async_v8_global), true, false, + false, 2usize as u8, false, Self::v8_fn_ptr as _, diff --git a/ops/op2/test_cases/async/async_void.out b/ops/op2/test_cases/async/async_void.out index 1b23b5fd0..4f7028bdb 100644 --- a/ops/op2/test_cases/async/async_void.out +++ b/ops/op2/test_cases/async/async_void.out @@ -10,6 +10,7 @@ pub const fn op_async() -> ::deno_core::_ops::OpDecl { ::deno_core::__op_name_fast!(op_async), true, false, + false, 1usize as u8, false, Self::v8_fn_ptr as _, diff --git a/ops/op2/test_cases/sync/add.out b/ops/op2/test_cases/sync/add.out index 40eb0beab..15f87d058 100644 --- a/ops/op2/test_cases/sync/add.out +++ b/ops/op2/test_cases/sync/add.out @@ -10,6 +10,7 @@ const fn op_add() -> ::deno_core::_ops::OpDecl { ::deno_core::__op_name_fast!(op_add), false, false, + false, 2usize as u8, false, Self::v8_fn_ptr as _, diff --git a/ops/op2/test_cases/sync/add_options.out b/ops/op2/test_cases/sync/add_options.out index c81fe7e7e..0e3b76710 100644 --- a/ops/op2/test_cases/sync/add_options.out +++ b/ops/op2/test_cases/sync/add_options.out @@ -10,6 +10,7 @@ pub const fn op_test_add_option() -> ::deno_core::_ops::OpDecl { ::deno_core::__op_name_fast!(op_test_add_option), false, false, + false, 2usize as u8, false, Self::v8_fn_ptr as _, diff --git a/ops/op2/test_cases/sync/bigint.out b/ops/op2/test_cases/sync/bigint.out index cdb3b55f6..e1b1fb167 100644 --- a/ops/op2/test_cases/sync/bigint.out +++ b/ops/op2/test_cases/sync/bigint.out @@ -10,6 +10,7 @@ pub const fn op_bigint() -> ::deno_core::_ops::OpDecl { ::deno_core::__op_name_fast!(op_bigint), false, false, + false, 0usize as u8, false, Self::v8_fn_ptr as _, diff --git a/ops/op2/test_cases/sync/bool.out b/ops/op2/test_cases/sync/bool.out index 6628843c7..d43d92b3e 100644 --- a/ops/op2/test_cases/sync/bool.out +++ b/ops/op2/test_cases/sync/bool.out @@ -10,6 +10,7 @@ pub const fn op_bool() -> ::deno_core::_ops::OpDecl { ::deno_core::__op_name_fast!(op_bool), false, false, + false, 1usize as u8, false, Self::v8_fn_ptr as _, diff --git a/ops/op2/test_cases/sync/bool_result.out b/ops/op2/test_cases/sync/bool_result.out index 098f82676..dc4332280 100644 --- a/ops/op2/test_cases/sync/bool_result.out +++ b/ops/op2/test_cases/sync/bool_result.out @@ -10,6 +10,7 @@ pub const fn op_bool() -> ::deno_core::_ops::OpDecl { ::deno_core::__op_name_fast!(op_bool), false, false, + false, 1usize as u8, false, Self::v8_fn_ptr as _, diff --git a/ops/op2/test_cases/sync/buffers.out b/ops/op2/test_cases/sync/buffers.out index e1ef77eaf..8fc0153c8 100644 --- a/ops/op2/test_cases/sync/buffers.out +++ b/ops/op2/test_cases/sync/buffers.out @@ -10,6 +10,7 @@ const fn op_buffers() -> ::deno_core::_ops::OpDecl { ::deno_core::__op_name_fast!(op_buffers), false, false, + false, 4usize as u8, false, Self::v8_fn_ptr as _, @@ -292,6 +293,7 @@ const fn op_buffers_32() -> ::deno_core::_ops::OpDecl { ::deno_core::__op_name_fast!(op_buffers_32), false, false, + false, 4usize as u8, false, Self::v8_fn_ptr as _, @@ -574,6 +576,7 @@ const fn op_buffers_option() -> ::deno_core::_ops::OpDecl { ::deno_core::__op_name_fast!(op_buffers_option), false, false, + false, 2usize as u8, false, Self::v8_fn_ptr as _, diff --git a/ops/op2/test_cases/sync/buffers_copy.out b/ops/op2/test_cases/sync/buffers_copy.out index fa799ccb4..49190ace3 100644 --- a/ops/op2/test_cases/sync/buffers_copy.out +++ b/ops/op2/test_cases/sync/buffers_copy.out @@ -10,6 +10,7 @@ const fn op_buffers() -> ::deno_core::_ops::OpDecl { ::deno_core::__op_name_fast!(op_buffers), false, false, + false, 3usize as u8, false, Self::v8_fn_ptr as _, @@ -248,6 +249,7 @@ const fn op_buffers_32() -> ::deno_core::_ops::OpDecl { ::deno_core::__op_name_fast!(op_buffers_32), false, false, + false, 2usize as u8, false, Self::v8_fn_ptr as _, diff --git a/ops/op2/test_cases/sync/buffers_out.out b/ops/op2/test_cases/sync/buffers_out.out index dfe156fe9..8f04e7e7e 100644 --- a/ops/op2/test_cases/sync/buffers_out.out +++ b/ops/op2/test_cases/sync/buffers_out.out @@ -10,6 +10,7 @@ const fn op_buffers() -> ::deno_core::_ops::OpDecl { ::deno_core::__op_name_fast!(op_buffers), false, false, + false, 1usize as u8, false, Self::v8_fn_ptr as _, @@ -132,6 +133,7 @@ const fn op_buffers_option() -> ::deno_core::_ops::OpDecl { ::deno_core::__op_name_fast!(op_buffers_option), false, false, + false, 1usize as u8, false, Self::v8_fn_ptr as _, @@ -264,6 +266,7 @@ const fn op_arraybuffers() -> ::deno_core::_ops::OpDecl { ::deno_core::__op_name_fast!(op_arraybuffers), false, false, + false, 1usize as u8, false, Self::v8_fn_ptr as _, diff --git a/ops/op2/test_cases/sync/cfg.out b/ops/op2/test_cases/sync/cfg.out index 86dfb9ead..6ee6e06ac 100644 --- a/ops/op2/test_cases/sync/cfg.out +++ b/ops/op2/test_cases/sync/cfg.out @@ -12,6 +12,7 @@ pub const fn op_maybe_windows() -> ::deno_core::_ops::OpDecl { ::deno_core::__op_name_fast!(op_maybe_windows), false, false, + false, 0usize as u8, false, Self::v8_fn_ptr as _, @@ -158,6 +159,7 @@ pub const fn op_maybe_windows() -> ::deno_core::_ops::OpDecl { ::deno_core::__op_name_fast!(op_maybe_windows), false, false, + false, 0usize as u8, false, Self::v8_fn_ptr as _, diff --git a/ops/op2/test_cases/sync/clippy_allow.out b/ops/op2/test_cases/sync/clippy_allow.out index 4b930d978..63640a431 100644 --- a/ops/op2/test_cases/sync/clippy_allow.out +++ b/ops/op2/test_cases/sync/clippy_allow.out @@ -12,6 +12,7 @@ pub const fn op_extra_annotation() -> ::deno_core::_ops::OpDecl { ::deno_core::__op_name_fast!(op_extra_annotation), false, false, + false, 0usize as u8, false, Self::v8_fn_ptr as _, @@ -156,6 +157,7 @@ pub const fn op_clippy_internal() -> ::deno_core::_ops::OpDecl { ::deno_core::__op_name_fast!(op_clippy_internal), false, false, + false, 0usize as u8, false, Self::v8_fn_ptr as _, diff --git a/ops/op2/test_cases/sync/cppgc_resource.out b/ops/op2/test_cases/sync/cppgc_resource.out index f2f67878b..c3f2c3305 100644 --- a/ops/op2/test_cases/sync/cppgc_resource.out +++ b/ops/op2/test_cases/sync/cppgc_resource.out @@ -10,6 +10,7 @@ const fn op_cppgc_object() -> ::deno_core::_ops::OpDecl { ::deno_core::__op_name_fast!(op_cppgc_object), false, false, + false, 1usize as u8, false, Self::v8_fn_ptr as _, @@ -214,6 +215,7 @@ const fn op_option_cppgc_object() -> ::deno_core::_ops::OpDecl { ::deno_core::__op_name_fast!(op_option_cppgc_object), false, false, + false, 1usize as u8, false, Self::v8_fn_ptr as _, @@ -426,6 +428,7 @@ const fn op_make_cppgc_object() -> ::deno_core::_ops::OpDecl { ::deno_core::__op_name_fast!(op_make_cppgc_object), false, false, + false, 0usize as u8, false, Self::v8_fn_ptr as _, @@ -519,6 +522,7 @@ const fn op_use_cppgc_object() -> ::deno_core::_ops::OpDecl { ::deno_core::__op_name_fast!(op_use_cppgc_object), false, false, + false, 1usize as u8, false, Self::v8_fn_ptr as _, @@ -723,6 +727,7 @@ const fn op_make_cppgc_object_option() -> ::deno_core::_ops::OpDecl { ::deno_core::__op_name_fast!(op_make_cppgc_object_option), false, false, + false, 0usize as u8, false, Self::v8_fn_ptr as _, @@ -819,6 +824,7 @@ const fn op_use_cppgc_object_option() -> ::deno_core::_ops::OpDecl { ::deno_core::__op_name_fast!(op_use_cppgc_object_option), false, false, + false, 1usize as u8, false, Self::v8_fn_ptr as _, diff --git a/ops/op2/test_cases/sync/doc_comment.out b/ops/op2/test_cases/sync/doc_comment.out index 5200b8a1b..b43365f08 100644 --- a/ops/op2/test_cases/sync/doc_comment.out +++ b/ops/op2/test_cases/sync/doc_comment.out @@ -11,6 +11,7 @@ pub const fn op_has_doc_comment() -> ::deno_core::_ops::OpDecl { ::deno_core::__op_name_fast!(op_has_doc_comment), false, false, + false, 0usize as u8, false, Self::v8_fn_ptr as _, diff --git a/ops/op2/test_cases/sync/fast_alternative.out b/ops/op2/test_cases/sync/fast_alternative.out index 6ddf2687a..56ae00199 100644 --- a/ops/op2/test_cases/sync/fast_alternative.out +++ b/ops/op2/test_cases/sync/fast_alternative.out @@ -10,6 +10,7 @@ const fn op_slow() -> ::deno_core::_ops::OpDecl { ::deno_core::__op_name_fast!(op_slow), false, false, + false, 3usize as u8, false, Self::v8_fn_ptr as _, @@ -127,6 +128,7 @@ const fn op_fast() -> ::deno_core::_ops::OpDecl { ::deno_core::__op_name_fast!(op_fast), false, false, + false, 2usize as u8, false, Self::v8_fn_ptr as _, @@ -345,6 +347,7 @@ const fn op_slow_generic() -> ::deno_core::_ops::OpDecl { ::deno_core::__op_name_fast!(op_slow_generic), false, false, + false, 3usize as u8, false, Self::v8_fn_ptr as _, @@ -462,6 +465,7 @@ const fn op_fast_generic() -> ::deno_core::_ops::OpDecl { ::deno_core::__op_name_fast!(op_fast_generic), false, false, + false, 2usize as u8, false, Self::v8_fn_ptr as _, diff --git a/ops/op2/test_cases/sync/from_v8.out b/ops/op2/test_cases/sync/from_v8.out index 5fe93baf0..45d328dca 100644 --- a/ops/op2/test_cases/sync/from_v8.out +++ b/ops/op2/test_cases/sync/from_v8.out @@ -10,6 +10,7 @@ pub const fn op_from_v8_arg() -> ::deno_core::_ops::OpDecl { ::deno_core::__op_name_fast!(op_from_v8_arg), false, false, + false, 1usize as u8, false, Self::v8_fn_ptr as _, diff --git a/ops/op2/test_cases/sync/generics.out b/ops/op2/test_cases/sync/generics.out index 1d2c43ba7..95e7a4325 100644 --- a/ops/op2/test_cases/sync/generics.out +++ b/ops/op2/test_cases/sync/generics.out @@ -10,6 +10,7 @@ pub const fn op_generics() -> ::deno_core::_ops::OpDecl { ::deno_core::__op_name_fast!(op_generics), false, false, + false, 0usize as u8, false, Self::v8_fn_ptr as _, @@ -152,6 +153,7 @@ pub const fn op_generics_static() -> ::deno_core::_ops::OpDe ::deno_core::__op_name_fast!(op_generics_static), false, false, + false, 0usize as u8, false, Self::v8_fn_ptr as _, @@ -294,6 +296,7 @@ pub const fn op_generics_static_where() -> ::deno_core::_ops ::deno_core::__op_name_fast!(op_generics_static_where), false, false, + false, 0usize as u8, false, Self::v8_fn_ptr as _, diff --git a/ops/op2/test_cases/sync/nofast.out b/ops/op2/test_cases/sync/nofast.out index 4b68f48e7..98cdeaa50 100644 --- a/ops/op2/test_cases/sync/nofast.out +++ b/ops/op2/test_cases/sync/nofast.out @@ -10,6 +10,7 @@ const fn op_nofast() -> ::deno_core::_ops::OpDecl { ::deno_core::__op_name_fast!(op_nofast), false, false, + false, 2usize as u8, false, Self::v8_fn_ptr as _, diff --git a/ops/op2/test_cases/sync/object_wrap.out b/ops/op2/test_cases/sync/object_wrap.out index ba9ca6ea1..714646406 100644 --- a/ops/op2/test_cases/sync/object_wrap.out +++ b/ops/op2/test_cases/sync/object_wrap.out @@ -26,6 +26,7 @@ impl Foo { ::deno_core::__op_name_fast!(constructor), false, false, + false, 1usize as u8, false, Self::v8_fn_ptr as _, @@ -156,6 +157,7 @@ impl Foo { ::deno_core::__op_name_fast!(x), false, false, + false, 0usize as u8, false, Self::v8_fn_ptr as _, @@ -264,6 +266,7 @@ impl Foo { ::deno_core::__op_name_fast!(x), false, false, + false, 1usize as u8, false, Self::v8_fn_ptr as _, @@ -386,6 +389,7 @@ impl Foo { ::deno_core::__op_name_fast!(bar), false, false, + false, 1usize as u8, false, Self::v8_fn_ptr as _, @@ -526,6 +530,7 @@ impl Foo { ::deno_core::__op_name_fast!(zzz), false, false, + false, 0usize as u8, false, Self::v8_fn_ptr as _, @@ -720,6 +725,7 @@ impl Foo { ::deno_core::__op_name_fast!(withVarargs), false, false, + false, 1usize as u8, false, Self::v8_fn_ptr as _, @@ -829,6 +835,7 @@ impl Foo { ::deno_core::__op_name_fast!(with_RENAME), false, false, + false, 0usize as u8, false, Self::v8_fn_ptr as _, @@ -935,6 +942,7 @@ impl Foo { ::deno_core::__op_name_fast!(doThing), false, false, + false, 0usize as u8, false, Self::v8_fn_ptr as _, @@ -1020,6 +1028,7 @@ impl Foo { ::deno_core::__op_name_fast!(doThing), false, false, + false, 0usize as u8, false, Self::v8_fn_ptr as _, diff --git a/ops/op2/test_cases/sync/op_state_attr.out b/ops/op2/test_cases/sync/op_state_attr.out index 06c7662f3..5ef3451b2 100644 --- a/ops/op2/test_cases/sync/op_state_attr.out +++ b/ops/op2/test_cases/sync/op_state_attr.out @@ -10,6 +10,7 @@ const fn op_state_rc() -> ::deno_core::_ops::OpDecl { ::deno_core::__op_name_fast!(op_state_rc), false, false, + false, 2usize as u8, false, Self::v8_fn_ptr as _, diff --git a/ops/op2/test_cases/sync/op_state_rc.out b/ops/op2/test_cases/sync/op_state_rc.out index ed702d6f5..77f5d2fe9 100644 --- a/ops/op2/test_cases/sync/op_state_rc.out +++ b/ops/op2/test_cases/sync/op_state_rc.out @@ -10,6 +10,7 @@ const fn op_state_rc() -> ::deno_core::_ops::OpDecl { ::deno_core::__op_name_fast!(op_state_rc), false, false, + false, 1usize as u8, false, Self::v8_fn_ptr as _, diff --git a/ops/op2/test_cases/sync/op_state_ref.out b/ops/op2/test_cases/sync/op_state_ref.out index 327af9ec3..b8335407c 100644 --- a/ops/op2/test_cases/sync/op_state_ref.out +++ b/ops/op2/test_cases/sync/op_state_ref.out @@ -10,6 +10,7 @@ const fn op_state_ref() -> ::deno_core::_ops::OpDecl { ::deno_core::__op_name_fast!(op_state_ref), false, false, + false, 1usize as u8, false, Self::v8_fn_ptr as _, @@ -180,6 +181,7 @@ const fn op_state_mut() -> ::deno_core::_ops::OpDecl { ::deno_core::__op_name_fast!(op_state_mut), false, false, + false, 1usize as u8, false, Self::v8_fn_ptr as _, @@ -350,6 +352,7 @@ const fn op_state_and_v8() -> ::deno_core::_ops::OpDecl { ::deno_core::__op_name_fast!(op_state_and_v8), false, false, + false, 2usize as u8, false, Self::v8_fn_ptr as _, @@ -462,6 +465,7 @@ const fn op_state_and_v8_local() -> ::deno_core::_ops::OpDecl { ::deno_core::__op_name_fast!(op_state_and_v8_local), false, false, + false, 2usize as u8, false, Self::v8_fn_ptr as _, diff --git a/ops/op2/test_cases/sync/result_external.out b/ops/op2/test_cases/sync/result_external.out index 13adf5fd4..be160bdd1 100644 --- a/ops/op2/test_cases/sync/result_external.out +++ b/ops/op2/test_cases/sync/result_external.out @@ -10,6 +10,7 @@ pub const fn op_external_with_result() -> ::deno_core::_ops::OpDecl { ::deno_core::__op_name_fast!(op_external_with_result), false, false, + false, 0usize as u8, false, Self::v8_fn_ptr as _, diff --git a/ops/op2/test_cases/sync/result_primitive.out b/ops/op2/test_cases/sync/result_primitive.out index a97669aa4..17c4716bf 100644 --- a/ops/op2/test_cases/sync/result_primitive.out +++ b/ops/op2/test_cases/sync/result_primitive.out @@ -10,6 +10,7 @@ pub const fn op_u32_with_result() -> ::deno_core::_ops::OpDecl { ::deno_core::__op_name_fast!(op_u32_with_result), false, false, + false, 0usize as u8, false, Self::v8_fn_ptr as _, diff --git a/ops/op2/test_cases/sync/result_scope.out b/ops/op2/test_cases/sync/result_scope.out index 04bea82ad..1b942e603 100644 --- a/ops/op2/test_cases/sync/result_scope.out +++ b/ops/op2/test_cases/sync/result_scope.out @@ -10,6 +10,7 @@ pub const fn op_void_with_result() -> ::deno_core::_ops::OpDecl { ::deno_core::__op_name_fast!(op_void_with_result), false, false, + false, 1usize as u8, false, Self::v8_fn_ptr as _, diff --git a/ops/op2/test_cases/sync/result_void.out b/ops/op2/test_cases/sync/result_void.out index 89e52f310..14fe66e62 100644 --- a/ops/op2/test_cases/sync/result_void.out +++ b/ops/op2/test_cases/sync/result_void.out @@ -10,6 +10,7 @@ pub const fn op_void_with_result() -> ::deno_core::_ops::OpDecl { ::deno_core::__op_name_fast!(op_void_with_result), false, false, + false, 0usize as u8, false, Self::v8_fn_ptr as _, diff --git a/ops/op2/test_cases/sync/serde_v8.out b/ops/op2/test_cases/sync/serde_v8.out index c0a210e42..bbc9564d2 100644 --- a/ops/op2/test_cases/sync/serde_v8.out +++ b/ops/op2/test_cases/sync/serde_v8.out @@ -10,6 +10,7 @@ pub const fn op_serde_v8() -> ::deno_core::_ops::OpDecl { ::deno_core::__op_name_fast!(op_serde_v8), false, false, + false, 1usize as u8, false, Self::v8_fn_ptr as _, diff --git a/ops/op2/test_cases/sync/smi.out b/ops/op2/test_cases/sync/smi.out index 846357333..cbfb1e7a0 100644 --- a/ops/op2/test_cases/sync/smi.out +++ b/ops/op2/test_cases/sync/smi.out @@ -10,6 +10,7 @@ const fn op_smi_unsigned_return() -> ::deno_core::_ops::OpDecl { ::deno_core::__op_name_fast!(op_smi_unsigned_return), false, false, + false, 4usize as u8, false, Self::v8_fn_ptr as _, @@ -288,6 +289,7 @@ const fn op_smi_signed_return() -> ::deno_core::_ops::OpDecl { ::deno_core::__op_name_fast!(op_smi_signed_return), false, false, + false, 4usize as u8, false, Self::v8_fn_ptr as _, @@ -566,6 +568,7 @@ const fn op_smi_option() -> ::deno_core::_ops::OpDecl { ::deno_core::__op_name_fast!(op_smi_option), false, false, + false, 1usize as u8, false, Self::v8_fn_ptr as _, diff --git a/ops/op2/test_cases/sync/stack_trace.out b/ops/op2/test_cases/sync/stack_trace.out index e7a6897bf..76983c681 100644 --- a/ops/op2/test_cases/sync/stack_trace.out +++ b/ops/op2/test_cases/sync/stack_trace.out @@ -10,6 +10,7 @@ const fn op_stack_trace() -> ::deno_core::_ops::OpDecl { ::deno_core::__op_name_fast!(op_stack_trace), false, false, + false, 0usize as u8, false, Self::v8_fn_ptr as _, diff --git a/ops/op2/test_cases/sync/stack_trace_scope.out b/ops/op2/test_cases/sync/stack_trace_scope.out index 3ee86c690..078d788bf 100644 --- a/ops/op2/test_cases/sync/stack_trace_scope.out +++ b/ops/op2/test_cases/sync/stack_trace_scope.out @@ -10,6 +10,7 @@ const fn op_stack_trace() -> ::deno_core::_ops::OpDecl { ::deno_core::__op_name_fast!(op_stack_trace), false, false, + false, 1usize as u8, false, Self::v8_fn_ptr as _, diff --git a/ops/op2/test_cases/sync/string_cow.out b/ops/op2/test_cases/sync/string_cow.out index 9a8a9fdbc..87d40c551 100644 --- a/ops/op2/test_cases/sync/string_cow.out +++ b/ops/op2/test_cases/sync/string_cow.out @@ -10,6 +10,7 @@ const fn op_string_cow() -> ::deno_core::_ops::OpDecl { ::deno_core::__op_name_fast!(op_string_cow), false, false, + false, 1usize as u8, false, Self::v8_fn_ptr as _, diff --git a/ops/op2/test_cases/sync/string_onebyte.out b/ops/op2/test_cases/sync/string_onebyte.out index 0fe71bfa5..a74f7d50f 100644 --- a/ops/op2/test_cases/sync/string_onebyte.out +++ b/ops/op2/test_cases/sync/string_onebyte.out @@ -10,6 +10,7 @@ const fn op_string_onebyte() -> ::deno_core::_ops::OpDecl { ::deno_core::__op_name_fast!(op_string_onebyte), false, false, + false, 1usize as u8, false, Self::v8_fn_ptr as _, diff --git a/ops/op2/test_cases/sync/string_option_return.out b/ops/op2/test_cases/sync/string_option_return.out index 2185b301f..99306812a 100644 --- a/ops/op2/test_cases/sync/string_option_return.out +++ b/ops/op2/test_cases/sync/string_option_return.out @@ -10,6 +10,7 @@ pub const fn op_string_return() -> ::deno_core::_ops::OpDecl { ::deno_core::__op_name_fast!(op_string_return), false, false, + false, 1usize as u8, false, Self::v8_fn_ptr as _, diff --git a/ops/op2/test_cases/sync/string_owned.out b/ops/op2/test_cases/sync/string_owned.out index 345e46175..5d3a8214e 100644 --- a/ops/op2/test_cases/sync/string_owned.out +++ b/ops/op2/test_cases/sync/string_owned.out @@ -10,6 +10,7 @@ const fn op_string_owned() -> ::deno_core::_ops::OpDecl { ::deno_core::__op_name_fast!(op_string_owned), false, false, + false, 1usize as u8, false, Self::v8_fn_ptr as _, diff --git a/ops/op2/test_cases/sync/string_ref.out b/ops/op2/test_cases/sync/string_ref.out index cb0b3191f..4c6e741ac 100644 --- a/ops/op2/test_cases/sync/string_ref.out +++ b/ops/op2/test_cases/sync/string_ref.out @@ -10,6 +10,7 @@ const fn op_string_owned() -> ::deno_core::_ops::OpDecl { ::deno_core::__op_name_fast!(op_string_owned), false, false, + false, 1usize as u8, false, Self::v8_fn_ptr as _, diff --git a/ops/op2/test_cases/sync/string_return.out b/ops/op2/test_cases/sync/string_return.out index e37640045..d5e3713a6 100644 --- a/ops/op2/test_cases/sync/string_return.out +++ b/ops/op2/test_cases/sync/string_return.out @@ -10,6 +10,7 @@ pub const fn op_string_return() -> ::deno_core::_ops::OpDecl { ::deno_core::__op_name_fast!(op_string_return), false, false, + false, 0usize as u8, false, Self::v8_fn_ptr as _, @@ -107,6 +108,7 @@ pub const fn op_string_return_ref() -> ::deno_core::_ops::OpDecl { ::deno_core::__op_name_fast!(op_string_return_ref), false, false, + false, 0usize as u8, false, Self::v8_fn_ptr as _, @@ -204,6 +206,7 @@ pub const fn op_string_return_cow() -> ::deno_core::_ops::OpDecl { ::deno_core::__op_name_fast!(op_string_return_cow), false, false, + false, 0usize as u8, false, Self::v8_fn_ptr as _, diff --git a/ops/op2/test_cases/sync/to_v8.out b/ops/op2/test_cases/sync/to_v8.out index b20abc582..df5b81981 100644 --- a/ops/op2/test_cases/sync/to_v8.out +++ b/ops/op2/test_cases/sync/to_v8.out @@ -10,6 +10,7 @@ pub const fn op_to_v8_return() -> ::deno_core::_ops::OpDecl { ::deno_core::__op_name_fast!(op_to_v8_return), false, false, + false, 0usize as u8, false, Self::v8_fn_ptr as _, diff --git a/ops/op2/test_cases/sync/v8_global.out b/ops/op2/test_cases/sync/v8_global.out index cbc6ce12a..1aa3f2bce 100644 --- a/ops/op2/test_cases/sync/v8_global.out +++ b/ops/op2/test_cases/sync/v8_global.out @@ -10,6 +10,7 @@ pub const fn op_global() -> ::deno_core::_ops::OpDecl { ::deno_core::__op_name_fast!(op_global), false, false, + false, 1usize as u8, false, Self::v8_fn_ptr as _, diff --git a/ops/op2/test_cases/sync/v8_handlescope.out b/ops/op2/test_cases/sync/v8_handlescope.out index 14a50c95c..139e9b73f 100644 --- a/ops/op2/test_cases/sync/v8_handlescope.out +++ b/ops/op2/test_cases/sync/v8_handlescope.out @@ -10,6 +10,7 @@ const fn op_handlescope() -> ::deno_core::_ops::OpDecl { ::deno_core::__op_name_fast!(op_handlescope), false, false, + false, 2usize as u8, false, Self::v8_fn_ptr as _, diff --git a/ops/op2/test_cases/sync/v8_lifetime.out b/ops/op2/test_cases/sync/v8_lifetime.out index 246977304..a1d6ab6f8 100644 --- a/ops/op2/test_cases/sync/v8_lifetime.out +++ b/ops/op2/test_cases/sync/v8_lifetime.out @@ -10,6 +10,7 @@ pub const fn op_v8_lifetime() -> ::deno_core::_ops::OpDecl { ::deno_core::__op_name_fast!(op_v8_lifetime), false, false, + false, 1usize as u8, false, Self::v8_fn_ptr as _, diff --git a/ops/op2/test_cases/sync/v8_ref_option.out b/ops/op2/test_cases/sync/v8_ref_option.out index ed11c5091..6a3d0f612 100644 --- a/ops/op2/test_cases/sync/v8_ref_option.out +++ b/ops/op2/test_cases/sync/v8_ref_option.out @@ -10,6 +10,7 @@ pub const fn op_v8_lifetime() -> ::deno_core::_ops::OpDecl { ::deno_core::__op_name_fast!(op_v8_lifetime), false, false, + false, 2usize as u8, false, Self::v8_fn_ptr as _, diff --git a/ops/op2/test_cases/sync/v8_string.out b/ops/op2/test_cases/sync/v8_string.out index eabae5b64..c9551a1b8 100644 --- a/ops/op2/test_cases/sync/v8_string.out +++ b/ops/op2/test_cases/sync/v8_string.out @@ -10,6 +10,7 @@ const fn op_v8_string() -> ::deno_core::_ops::OpDecl { ::deno_core::__op_name_fast!(op_v8_string), false, false, + false, 2usize as u8, false, Self::v8_fn_ptr as _, diff --git a/testing/checkin/runner/ops.rs b/testing/checkin/runner/ops.rs index f20a3579d..a1074cab8 100644 --- a/testing/checkin/runner/ops.rs +++ b/testing/checkin/runner/ops.rs @@ -201,6 +201,10 @@ impl DOMPoint { fn wrapping_smi(&self, #[smi] t: u32) -> u32 { t } + + #[fast] + #[symbol("symbolMethod")] + fn with_symbol(&self) {} } #[op2(fast)] diff --git a/testing/unit/resource_test.ts b/testing/unit/resource_test.ts index 89710791a..468b6fb03 100644 --- a/testing/unit/resource_test.ts +++ b/testing/unit/resource_test.ts @@ -95,6 +95,9 @@ test(async function testDomPoint() { DOMPoint.prototype.wrappingSmi.toString(), ); + const f = Symbol.for("symbolMethod"); + p1[f](); + const wrap = new TestObjectWrap(); assertEquals(wrap.withVarargs(1, 2, 3), 3); assertEquals(wrap.withVarargs(1, 2, 3, 4, 5), 5);