mirror of
https://github.com/denoland/deno.git
synced 2024-11-22 15:06:54 -05:00
perf(serde_v8): avoid extra is_array_buffer_view check (#15056)
This commit is contained in:
parent
43043d245f
commit
78d4dedcdb
1 changed files with 1 additions and 2 deletions
|
@ -70,8 +70,7 @@ pub(crate) fn to_ranged_buffer<'s>(
|
|||
scope: &mut v8::HandleScope<'s>,
|
||||
value: v8::Local<v8::Value>,
|
||||
) -> Result<(v8::Local<'s, v8::ArrayBuffer>, Range<usize>), v8::DataError> {
|
||||
if value.is_array_buffer_view() {
|
||||
let view: v8::Local<v8::ArrayBufferView> = value.try_into()?;
|
||||
if let Ok(view) = v8::Local::<v8::ArrayBufferView>::try_from(value) {
|
||||
let (offset, len) = (view.byte_offset(), view.byte_length());
|
||||
let buffer = view.buffer(scope).ok_or(v8::DataError::NoData {
|
||||
expected: "view to have a buffer",
|
||||
|
|
Loading…
Reference in a new issue