mirror of
https://github.com/denoland/deno.git
synced 2025-01-07 06:46:59 -05:00
chore: update rusty_v8 to 0.56.0 (#16814)
Co-authored-by: Divy Srivastava <dj.srivastava23@gmail.com>
This commit is contained in:
parent
bcbcc72996
commit
e095c54422
3 changed files with 36 additions and 15 deletions
5
Cargo.lock
generated
5
Cargo.lock
generated
|
@ -5387,14 +5387,13 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "v8"
|
name = "v8"
|
||||||
version = "0.55.0"
|
version = "0.56.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "46cd4f562bce7520fbb511850c5488366264caf346be221cf7e908f51ac33dbc"
|
checksum = "4182d3112bf61cc6bbc4839b728c27d5aa5c6b12ee26b91b039308715a61c208"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bitflags",
|
"bitflags",
|
||||||
"fslock",
|
"fslock",
|
||||||
"lazy_static",
|
"lazy_static",
|
||||||
"libc",
|
|
||||||
"which",
|
"which",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
|
@ -40,7 +40,7 @@ license = "MIT"
|
||||||
repository = "https://github.com/denoland/deno"
|
repository = "https://github.com/denoland/deno"
|
||||||
|
|
||||||
[workspace.dependencies]
|
[workspace.dependencies]
|
||||||
v8 = { version = "0.55.0", default-features = false }
|
v8 = { version = "0.56.0", default-features = false }
|
||||||
deno_ast = { version = "0.21.0", features = ["transpiling"] }
|
deno_ast = { version = "0.21.0", features = ["transpiling"] }
|
||||||
|
|
||||||
deno_core = { version = "0.161.0", path = "./core" }
|
deno_core = { version = "0.161.0", path = "./core" }
|
||||||
|
|
44
ops/lib.rs
44
ops/lib.rs
|
@ -458,9 +458,13 @@ fn codegen_u8_slice(core: &TokenStream2, idx: usize) -> TokenStream2 {
|
||||||
match #core::v8::Local::<#core::v8::ArrayBuffer>::try_from(value) {
|
match #core::v8::Local::<#core::v8::ArrayBuffer>::try_from(value) {
|
||||||
Ok(b) => {
|
Ok(b) => {
|
||||||
let byte_length = b.byte_length();
|
let byte_length = b.byte_length();
|
||||||
let store = b.data() as *mut u8;
|
if let Some(data) = b.data() {
|
||||||
// SAFETY: rust guarantees that lifetime of slice is no longer than the call.
|
let store = data.cast::<u8>().as_ptr();
|
||||||
unsafe { ::std::slice::from_raw_parts_mut(store, byte_length) }
|
// SAFETY: rust guarantees that lifetime of slice is no longer than the call.
|
||||||
|
unsafe { ::std::slice::from_raw_parts_mut(store, byte_length) }
|
||||||
|
} else {
|
||||||
|
&mut []
|
||||||
|
}
|
||||||
},
|
},
|
||||||
Err(_) => {
|
Err(_) => {
|
||||||
if let Ok(view) = #core::v8::Local::<#core::v8::ArrayBufferView>::try_from(value) {
|
if let Ok(view) = #core::v8::Local::<#core::v8::ArrayBufferView>::try_from(value) {
|
||||||
|
@ -472,9 +476,13 @@ fn codegen_u8_slice(core: &TokenStream2, idx: usize) -> TokenStream2 {
|
||||||
return #core::_ops::throw_type_error(scope, format!("Expected ArrayBufferView at position {}", #idx));
|
return #core::_ops::throw_type_error(scope, format!("Expected ArrayBufferView at position {}", #idx));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
let store = buffer.data() as *mut u8;
|
if let Some(data) = buffer.data() {
|
||||||
// SAFETY: rust guarantees that lifetime of slice is no longer than the call.
|
let store = data.cast::<u8>().as_ptr();
|
||||||
unsafe { ::std::slice::from_raw_parts_mut(store.add(offset), len) }
|
// SAFETY: rust guarantees that lifetime of slice is no longer than the call.
|
||||||
|
unsafe { ::std::slice::from_raw_parts_mut(store.add(offset), len) }
|
||||||
|
} else {
|
||||||
|
&mut []
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
return #core::_ops::throw_type_error(scope, format!("Expected ArrayBufferView at position {}", #idx));
|
return #core::_ops::throw_type_error(scope, format!("Expected ArrayBufferView at position {}", #idx));
|
||||||
}
|
}
|
||||||
|
@ -487,7 +495,13 @@ fn codegen_u8_ptr(core: &TokenStream2, idx: usize) -> TokenStream2 {
|
||||||
quote! {{
|
quote! {{
|
||||||
let value = args.get(#idx as i32);
|
let value = args.get(#idx as i32);
|
||||||
match #core::v8::Local::<#core::v8::ArrayBuffer>::try_from(value) {
|
match #core::v8::Local::<#core::v8::ArrayBuffer>::try_from(value) {
|
||||||
Ok(b) => b.data() as *const u8,
|
Ok(b) => {
|
||||||
|
if let Some(data) = b.data() {
|
||||||
|
data.cast::<u8>().as_ptr()
|
||||||
|
} else {
|
||||||
|
std::ptr::null::<u8>()
|
||||||
|
}
|
||||||
|
},
|
||||||
Err(_) => {
|
Err(_) => {
|
||||||
if let Ok(view) = #core::v8::Local::<#core::v8::ArrayBufferView>::try_from(value) {
|
if let Ok(view) = #core::v8::Local::<#core::v8::ArrayBufferView>::try_from(value) {
|
||||||
let offset = view.byte_offset();
|
let offset = view.byte_offset();
|
||||||
|
@ -497,7 +511,11 @@ fn codegen_u8_ptr(core: &TokenStream2, idx: usize) -> TokenStream2 {
|
||||||
return #core::_ops::throw_type_error(scope, format!("Expected ArrayBufferView at position {}", #idx));
|
return #core::_ops::throw_type_error(scope, format!("Expected ArrayBufferView at position {}", #idx));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
let store = buffer.data() as *mut u8;
|
let store = if let Some(data) = buffer.data() {
|
||||||
|
data.cast::<u8>().as_ptr()
|
||||||
|
} else {
|
||||||
|
std::ptr::null_mut::<u8>()
|
||||||
|
};
|
||||||
unsafe { store.add(offset) }
|
unsafe { store.add(offset) }
|
||||||
} else {
|
} else {
|
||||||
return #core::_ops::throw_type_error(scope, format!("Expected ArrayBufferView at position {}", #idx));
|
return #core::_ops::throw_type_error(scope, format!("Expected ArrayBufferView at position {}", #idx));
|
||||||
|
@ -517,9 +535,13 @@ fn codegen_u32_mut_slice(core: &TokenStream2, idx: usize) -> TokenStream2 {
|
||||||
return #core::_ops::throw_type_error(scope, format!("Expected Uint32Array at position {}", #idx));
|
return #core::_ops::throw_type_error(scope, format!("Expected Uint32Array at position {}", #idx));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
let store = buffer.data() as *mut u8;
|
if let Some(data) = buffer.data() {
|
||||||
// SAFETY: buffer from Uint32Array. Rust guarantees that lifetime of slice is no longer than the call.
|
let store = data.cast::<u8>().as_ptr();
|
||||||
unsafe { ::std::slice::from_raw_parts_mut(store.add(offset) as *mut u32, len / 4) }
|
// SAFETY: buffer from Uint32Array. Rust guarantees that lifetime of slice is no longer than the call.
|
||||||
|
unsafe { ::std::slice::from_raw_parts_mut(store.add(offset) as *mut u32, len / 4) }
|
||||||
|
} else {
|
||||||
|
&mut []
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
return #core::_ops::throw_type_error(scope, format!("Expected Uint32Array at position {}", #idx));
|
return #core::_ops::throw_type_error(scope, format!("Expected Uint32Array at position {}", #idx));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue