diff --git a/ext/fs/ops.rs b/ext/fs/ops.rs index 15711e227d..289c3de72a 100644 --- a/ext/fs/ops.rs +++ b/ext/fs/ops.rs @@ -371,11 +371,11 @@ where Ok(()) } -#[op] +#[op2(fast)] pub fn op_fs_stat_sync

( state: &mut OpState, - path: String, - stat_out_buf: &mut [u32], + #[string] path: String, + #[buffer] stat_out_buf: &mut [u32], ) -> Result<(), AnyError> where P: FsPermissions + 'static, @@ -414,11 +414,11 @@ where Ok(SerializableStat::from(stat)) } -#[op] +#[op2(fast)] pub fn op_fs_lstat_sync

( state: &mut OpState, - path: String, - stat_out_buf: &mut [u32], + #[string] path: String, + #[buffer] stat_out_buf: &mut [u32], ) -> Result<(), AnyError> where P: FsPermissions + 'static, @@ -1123,16 +1123,17 @@ where Ok(()) } -#[op] +#[op2(async)] +#[allow(clippy::too_many_arguments)] pub async fn op_fs_write_file_async

( state: Rc>, - path: String, - mode: Option, + #[string] path: String, + #[smi] mode: Option, append: bool, create: bool, create_new: bool, - data: JsBuffer, - cancel_rid: Option, + #[buffer] data: JsBuffer, + #[smi] cancel_rid: Option, ) -> Result<(), AnyError> where P: FsPermissions + 'static, @@ -1189,11 +1190,12 @@ where Ok(buf.into()) } -#[op] +#[op2(async)] +#[serde] pub async fn op_fs_read_file_async

( state: Rc>, - path: String, - cancel_rid: Option, + #[string] path: String, + #[smi] cancel_rid: Option, ) -> Result where P: FsPermissions + 'static, @@ -1228,10 +1230,11 @@ where Ok(buf.into()) } -#[op] +#[op2] +#[string] pub fn op_fs_read_file_text_sync

( state: &mut OpState, - path: String, + #[string] path: String, ) -> Result where P: FsPermissions + 'static, @@ -1247,11 +1250,12 @@ where Ok(string_from_utf8_lossy(buf)) } -#[op] +#[op2(async)] +#[string] pub async fn op_fs_read_file_text_async

( state: Rc>, - path: String, - cancel_rid: Option, + #[string] path: String, + #[smi] cancel_rid: Option, ) -> Result where P: FsPermissions + 'static, @@ -1375,11 +1379,11 @@ pub async fn op_fs_fsync_async( Ok(()) } -#[op] +#[op2(fast)] pub fn op_fs_fstat_sync( state: &mut OpState, - rid: ResourceId, - stat_out_buf: &mut [u32], + #[smi] rid: ResourceId, + #[buffer] stat_out_buf: &mut [u32], ) -> Result<(), AnyError> { let file = FileResource::get_file(state, rid)?; let stat = file.stat_sync()?; diff --git a/ext/http/http_next.rs b/ext/http/http_next.rs index c6e3ac3841..08d3f54b11 100644 --- a/ext/http/http_next.rs +++ b/ext/http/http_next.rs @@ -25,7 +25,6 @@ use deno_core::error::AnyError; use deno_core::futures::TryFutureExt; use deno_core::op; use deno_core::op2; -use deno_core::serde_v8; use deno_core::serde_v8::from_v8; use deno_core::unsync::spawn; use deno_core::unsync::JoinHandle; @@ -229,11 +228,11 @@ pub fn op_http_set_promise_complete(#[smi] slab_id: SlabId, status: u16) { http.complete(); } -#[op(v8)] +#[op2] pub fn op_http_get_request_method_and_url<'scope, HTTP>( scope: &mut v8::HandleScope<'scope>, - slab_id: SlabId, -) -> serde_v8::Value<'scope> + #[smi] slab_id: SlabId, +) -> v8::Local<'scope, v8::Array> where HTTP: HttpPropertyExtractor, { @@ -290,10 +289,7 @@ where }; let vec = [method, authority, path, peer_address, port]; - let array = v8::Array::new_with_elements(scope, vec.as_slice()); - let array_value: v8::Local = array.into(); - - array_value.into() + v8::Array::new_with_elements(scope, vec.as_slice()) } #[op2] @@ -307,11 +303,11 @@ pub fn op_http_get_request_header( value.map(|value| value.as_bytes().into()) } -#[op(v8)] +#[op2] pub fn op_http_get_request_headers<'scope>( scope: &mut v8::HandleScope<'scope>, - slab_id: SlabId, -) -> serde_v8::Value<'scope> { + #[smi] slab_id: SlabId, +) -> v8::Local<'scope, v8::Array> { let http = slab_get(slab_id); let headers = &http.request_parts().headers; // Two slots for each header key/value pair @@ -372,16 +368,14 @@ pub fn op_http_get_request_headers<'scope>( ); } - let array = v8::Array::new_with_elements(scope, vec.as_slice()); - let array_value: v8::Local = array.into(); - - array_value.into() + v8::Array::new_with_elements(scope, vec.as_slice()) } -#[op(fast)] +#[op2(fast)] +#[smi] pub fn op_http_read_request_body( state: Rc>, - slab_id: SlabId, + #[smi] slab_id: SlabId, ) -> ResourceId { let mut http = slab_get(slab_id); let rid = if let Some(incoming) = http.take_body() { diff --git a/ext/napi/lib.rs b/ext/napi/lib.rs index ada9aa13fb..e897e149d4 100644 --- a/ext/napi/lib.rs +++ b/ext/napi/lib.rs @@ -10,9 +10,8 @@ use deno_core::error::type_error; use deno_core::error::AnyError; use deno_core::futures::channel::mpsc; use deno_core::futures::StreamExt; -use deno_core::op; +use deno_core::op2; use deno_core::parking_lot::Mutex; -use deno_core::serde_v8; use deno_core::OpState; use std::cell::RefCell; use std::ffi::CString; @@ -536,13 +535,13 @@ pub unsafe fn weak_local( value } -#[op(v8)] +#[op2] fn op_napi_open( scope: &mut v8::HandleScope<'scope>, op_state: &mut OpState, - path: String, - global: serde_v8::Value, -) -> std::result::Result, AnyError> + #[string] path: String, + global: v8::Local<'scope, v8::Value>, +) -> std::result::Result, AnyError> where NP: NapiPermissions + 'static, { @@ -582,7 +581,7 @@ where let mut env = Env::new( isolate_ptr, v8::Global::new(scope, ctx), - v8::Global::new(scope, global.v8_value), + v8::Global::new(scope, global), async_work_sender, tsfn_sender, cleanup_hooks, @@ -640,7 +639,7 @@ where // NAPI addons can't be unloaded, so we're going to "forget" the library // object so it lives till the program exit. std::mem::forget(library); - return Ok(serde_v8::Value { v8_value: exports }); + return Ok(exports); } // Initializer callback. @@ -673,5 +672,5 @@ where // NAPI addons can't be unloaded, so we're going to "forget" the library // object so it lives till the program exit. std::mem::forget(library); - Ok(serde_v8::Value { v8_value: exports }) + Ok(exports) }