1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-12-23 15:49:44 -05:00

chore: update to rusty_v8 0.33.0 (#12564)

This commit is contained in:
Luca Casonato 2021-10-27 23:26:15 +02:00 committed by GitHub
parent 09dd77c13e
commit be68b82eb4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
30 changed files with 47 additions and 104 deletions

30
Cargo.lock generated
View file

@ -747,12 +747,12 @@ dependencies = [
"log",
"parking_lot",
"pin-project",
"rusty_v8",
"serde",
"serde_json",
"serde_v8",
"tokio",
"url",
"v8",
]
[[package]]
@ -3114,19 +3114,6 @@ dependencies = [
"security-framework",
]
[[package]]
name = "rusty_v8"
version = "0.32.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d2b311db3661f6b7631f94ad431133ff0f299c423e6bcc35b748ad0d57d6e604"
dependencies = [
"bitflags",
"fslock",
"lazy_static",
"libc",
"which",
]
[[package]]
name = "rustyline"
version = "9.0.0"
@ -3323,9 +3310,9 @@ name = "serde_v8"
version = "0.16.0"
dependencies = [
"bencher",
"rusty_v8",
"serde",
"serde_json",
"v8",
]
[[package]]
@ -4537,6 +4524,19 @@ dependencies = [
"serde",
]
[[package]]
name = "v8"
version = "0.33.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9b3adb16fd1af3e28d6fda8348a6d96b5363a128dc5a0216b137b64ecbae6641"
dependencies = [
"bitflags",
"fslock",
"lazy_static",
"libc",
"which",
]
[[package]]
name = "vcpkg"
version = "0.2.15"

View file

@ -70,7 +70,7 @@ opt-level = 3
opt-level = 3
[profile.bench.package.num-bigint-dig]
opt-level = 3
[profile.bench.package.rusty_v8]
[profile.bench.package.v8]
opt-level = 3
[profile.bench.package.serde_v8]
opt-level = 3
@ -104,7 +104,7 @@ opt-level = 3
opt-level = 3
[profile.release.package.num-bigint-dig]
opt-level = 3
[profile.release.package.rusty_v8]
[profile.release.package.v8]
opt-level = 3
[profile.release.package.serde_v8]
opt-level = 3

View file

@ -106,7 +106,7 @@ pub async fn check_if_should_use_esm_loader(
let use_esm_loader_global = js_runtime.resolve_value(result).await?;
let use_esm_loader = {
let scope = &mut js_runtime.handle_scope();
let use_esm_loader_local = use_esm_loader_global.get(scope);
let use_esm_loader_local = use_esm_loader_global.open(scope);
use_esm_loader_local.boolean_value(scope)
};

View file

@ -21,11 +21,11 @@ lazy_static = "1.4.0"
log = "0.4.14"
parking_lot = "0.11.1"
pin-project = "1.0.7"
rusty_v8 = "0.32.0"
serde = { version = "1.0.129", features = ["derive"] }
serde_json = { version = "1.0.66", features = ["preserve_order"] }
serde_v8 = { version = "0.16.0", path = "../serde_v8" }
url = { version = "2.2.2", features = ["serde"] }
v8 = "0.33.0"
[[example]]
name = "http_bench_json_ops"

View file

@ -13,7 +13,6 @@ use crate::OpTable;
use crate::PromiseId;
use crate::ZeroCopyBuf;
use log::debug;
use rusty_v8 as v8;
use serde::Deserialize;
use serde::Serialize;
use serde_v8::to_v8;
@ -633,7 +632,7 @@ fn set_wasm_streaming_callback(
let undefined = v8::undefined(scope);
let rid = serde_v8::to_v8(scope, streaming_rid).unwrap();
cb_handle
.get(scope)
.open(scope)
.call(scope, undefined.into(), &[arg, rid]);
});
}

View file

@ -3,7 +3,6 @@
pub use anyhow::anyhow;
pub use anyhow::bail;
pub use anyhow::Context;
use rusty_v8 as v8;
use std::borrow::Cow;
use std::convert::TryFrom;
use std::convert::TryInto;

View file

@ -1,6 +1,5 @@
// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license.
use rusty_v8 as v8;
/// Pass the command line arguments to v8.
/// Returns a vector of command line arguments that V8 did not understand.
pub fn v8_set_flags(args: Vec<String>) -> Vec<String> {

View file

@ -22,7 +22,6 @@ use crate::futures::task::Poll;
use crate::serde_json;
use crate::serde_json::json;
use crate::serde_json::Value;
use crate::v8;
use parking_lot::Mutex;
use std::cell::BorrowMutError;
use std::cell::RefCell;

View file

@ -20,7 +20,6 @@ mod runtime;
// Re-exports
pub use futures;
pub use parking_lot;
pub use rusty_v8 as v8;
pub use serde;
pub use serde_json;
pub use serde_v8;
@ -28,6 +27,7 @@ pub use serde_v8::Buffer as ZeroCopyBuf;
pub use serde_v8::ByteString;
pub use serde_v8::StringOrBuffer;
pub use url;
pub use v8;
pub use crate::async_cancel::CancelFuture;
pub use crate::async_cancel::CancelHandle;

View file

@ -1,7 +1,5 @@
// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license.
use rusty_v8 as v8;
use crate::bindings;
use crate::error::generic_error;
use crate::error::AnyError;

View file

@ -13,7 +13,6 @@ use futures::ready;
use futures::task::noop_waker;
use futures::Future;
use indexmap::IndexMap;
use rusty_v8 as v8;
use serde::de::DeserializeOwned;
use serde::Serialize;
use std::cell::RefCell;

View file

@ -98,7 +98,7 @@ pub fn op_print(
Ok(())
}
pub struct WasmStreamingResource(pub(crate) RefCell<rusty_v8::WasmStreaming>);
pub struct WasmStreamingResource(pub(crate) RefCell<v8::WasmStreaming>);
impl Resource for WasmStreamingResource {
fn close(self: Rc<Self>) {

View file

@ -1,7 +1,5 @@
// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license.
use rusty_v8 as v8;
use crate::bindings;
use crate::error::attach_handle_to_error;
use crate::error::generic_error;
@ -529,7 +527,7 @@ impl JsRuntime {
let scope = &mut self.handle_scope();
let state_rc = JsRuntime::state(scope);
let js_sync_cb_handle = state_rc.borrow().js_sync_cb.clone().unwrap();
let js_sync_cb = js_sync_cb_handle.get(scope);
let js_sync_cb = js_sync_cb_handle.open(scope);
let this = v8::undefined(scope).into();
js_sync_cb.call(scope, this, &[]);
}
@ -995,7 +993,7 @@ impl JsRuntime {
let status = {
let scope = &mut self.handle_scope();
let module = module_handle.get(scope);
let module = module_handle.open(scope);
module.get_status()
};
@ -1142,7 +1140,7 @@ impl JsRuntime {
.dynamic_import_map
.remove(&id)
.expect("Invalid dynamic import id");
let resolver = resolver_handle.get(scope);
let resolver = resolver_handle.open(scope);
let exception = err
.downcast_ref::<ErrWithV8Handle>()
@ -1171,7 +1169,7 @@ impl JsRuntime {
.dynamic_import_map
.remove(&id)
.expect("Invalid dynamic import id");
let resolver = resolver_handle.get(scope);
let resolver = resolver_handle.open(scope);
let module = {
module_map_rc
@ -1328,7 +1326,7 @@ impl JsRuntime {
let module_evaluation = maybe_module_evaluation.unwrap();
let scope = &mut self.handle_scope();
let promise = module_evaluation.promise.get(scope);
let promise = module_evaluation.promise.open(scope);
let promise_state = promise.state();
match promise_state {
@ -1364,8 +1362,8 @@ impl JsRuntime {
let scope = &mut self.handle_scope();
let module_id = pending_dyn_evaluate.module_id;
let promise = pending_dyn_evaluate.promise.get(scope);
let _module = pending_dyn_evaluate.module.get(scope);
let promise = pending_dyn_evaluate.promise.open(scope);
let _module = pending_dyn_evaluate.module.open(scope);
let promise_state = promise.state();
match promise_state {
@ -1545,7 +1543,7 @@ impl JsRuntime {
}
let tc_scope = &mut v8::TryCatch::new(scope);
let js_recv_cb = js_recv_cb_handle.get(tc_scope);
let js_recv_cb = js_recv_cb_handle.open(tc_scope);
let this = v8::undefined(tc_scope).into();
js_recv_cb.call(tc_scope, this, args.as_slice());
@ -1563,7 +1561,7 @@ impl JsRuntime {
};
let scope = &mut self.handle_scope();
let js_macrotask_cb = js_macrotask_cb_handle.get(scope);
let js_macrotask_cb = js_macrotask_cb_handle.open(scope);
// Repeatedly invoke macrotask callback until it returns true (done),
// such that ready microtasks would be automatically run before
@ -1729,13 +1727,13 @@ pub mod tests {
let value_global = runtime.execute_script("a.js", "a = 1 + 2").unwrap();
{
let scope = &mut runtime.handle_scope();
let value = value_global.get(scope);
let value = value_global.open(scope);
assert_eq!(value.integer_value(scope).unwrap(), 3);
}
let value_global = runtime.execute_script("b.js", "b = 'foobar'").unwrap();
{
let scope = &mut runtime.handle_scope();
let value = value_global.get(scope);
let value = value_global.open(scope);
assert!(value.is_string());
assert_eq!(
value.to_string(scope).unwrap().to_rust_string_lossy(scope),
@ -1753,7 +1751,7 @@ pub mod tests {
let result_global = runtime.resolve_value(value_global).await.unwrap();
{
let scope = &mut runtime.handle_scope();
let value = result_global.get(scope);
let value = result_global.open(scope);
assert_eq!(value.integer_value(scope).unwrap(), 3);
}
@ -1766,7 +1764,7 @@ pub mod tests {
let result_global = runtime.resolve_value(value_global).await.unwrap();
{
let scope = &mut runtime.handle_scope();
let value = result_global.get(scope);
let value = result_global.open(scope);
assert_eq!(value.integer_value(scope).unwrap(), 4);
}

View file

@ -10,8 +10,8 @@ repository = "https://github.com/denoland/deno"
description = "Rust to V8 serialization and deserialization"
[dependencies]
rusty_v8 = "0.32.0"
serde = { version = "1.0.130", features = ["derive"] }
v8 = "0.33.0"
[dev-dependencies]
bencher = "0.1"

View file

@ -1,7 +1,6 @@
// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license.
use bencher::{benchmark_group, benchmark_main, Bencher};
use rusty_v8 as v8;
use std::convert::TryFrom;
use serde::Deserialize;

View file

@ -1,8 +1,6 @@
// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license.
use bencher::{benchmark_group, benchmark_main, Bencher};
use rusty_v8 as v8;
use serde::Serialize;
use serde_v8::utils::v8_do;

View file

@ -1,6 +1,4 @@
// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license.
use rusty_v8 as v8;
use serde::Deserialize;
#[derive(Debug, Deserialize)]

View file

@ -1,5 +1,4 @@
// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license.
use rusty_v8 as v8;
use serde::de::{self, Visitor};
use serde::Deserialize;

View file

@ -1,6 +1,4 @@
// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license.
use rusty_v8 as v8;
use std::collections::HashMap;
// KeyCache stores a pool struct keys mapped to v8,

View file

@ -1,4 +1,4 @@
use rusty_v8 as v8;
// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license.
use std::fmt;
use std::ops::Deref;

View file

@ -1,5 +1,4 @@
// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license.
use rusty_v8 as v8;
use std::fmt;
use std::marker::PhantomData;

View file

@ -1,6 +1,5 @@
// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license.
use rusty_v8 as v8;
use std::cell::Cell;
use std::ops::Deref;
use std::ops::DerefMut;

View file

@ -1,5 +1,4 @@
// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license.
use rusty_v8 as v8;
// TODO: maybe add a Payload type that holds scope & v8::Value
// so it can implement Deserialize by itself

View file

@ -1,5 +1,4 @@
// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license.
use rusty_v8 as v8;
use serde::ser;
use serde::ser::Serialize;

View file

@ -1,5 +1,4 @@
// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license.
use rusty_v8 as v8;
use std::any::TypeId;
use std::mem::transmute_copy;

View file

@ -1,5 +1,4 @@
// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license.
use rusty_v8 as v8;
use std::sync::Once;
pub fn js_exec<'s>(

View file

@ -1,6 +1,4 @@
// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license.
use rusty_v8 as v8;
use serde::Deserialize;
use serde_v8::utils::{js_exec, v8_do};

View file

@ -1,6 +1,4 @@
// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license.
use rusty_v8 as v8;
use serde::{Deserialize, Serialize};
use serde_v8::utils::{js_exec, v8_do};

View file

@ -1,6 +1,4 @@
// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license.
use rusty_v8 as v8;
use serde::Serialize;
use serde_json::json;
use serde_v8::utils::{js_exec, v8_do};

View file

@ -6709,33 +6709,15 @@
"toString.any.html": true,
"toString.any.worker.html": true
},
"prototypes.any.html": false,
"prototypes.any.worker.html": false,
"prototypes.any.html": true,
"prototypes.any.worker.html": true,
"table": {
"constructor.any.html": [
"initialize externref table with default value"
],
"constructor.any.worker.html": [
"initialize externref table with default value"
],
"get-set.any.html": [
"Arguments for anyfunc table set",
"Arguments for externref table set"
],
"get-set.any.worker.html": [
"Arguments for anyfunc table set",
"Arguments for externref table set"
],
"grow.any.html": [
"Grow with exported-function argument",
"Grow with non-function argument",
"Grow with JS-function argument"
],
"grow.any.worker.html": [
"Grow with exported-function argument",
"Grow with non-function argument",
"Grow with JS-function argument"
],
"constructor.any.html": true,
"constructor.any.worker.html": true,
"get-set.any.html": true,
"get-set.any.worker.html": true,
"grow.any.html": true,
"grow.any.worker.html": true,
"length.any.html": true,
"length.any.worker.html": true,
"toString.any.html": true,
@ -6746,18 +6728,8 @@
"type.tentative.any.worker.html": false
},
"exception": {
"basic.tentative.any.html": [
"Wasm function throws argument",
"Wasm function throws null",
"Imported JS function throws",
"Imported JS function throws, Wasm catches and rethrows"
],
"basic.tentative.any.worker.html": [
"Wasm function throws argument",
"Wasm function throws null",
"Imported JS function throws",
"Imported JS function throws, Wasm catches and rethrows"
],
"basic.tentative.any.html": true,
"basic.tentative.any.worker.html": true,
"constructor.tentative.any.html": true,
"constructor.tentative.any.worker.html": true,
"getArg.tentative.any.html": true,