1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-11-25 15:29:32 -05:00

upgrade: rusty_v8 0.5.0 (#6070)

This commit is contained in:
Ryan Dahl 2020-06-03 12:19:21 -04:00 committed by GitHub
parent a90d9fbd34
commit aa39dfc62f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 30 additions and 24 deletions

12
Cargo.lock generated
View file

@ -247,9 +247,9 @@ dependencies = [
[[package]]
name = "bumpalo"
version = "3.3.0"
version = "3.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5356f1d23ee24a1f785a56d1d1a5f0fd5b0f6a0c0fb2412ce11da71649ab78f6"
checksum = "2e8c087f005730276d1096a652e92a8bacee2e2472bcc9715a74d2bec38b5820"
[[package]]
name = "byte-tools"
@ -1066,9 +1066,9 @@ checksum = "4bac95d9aa0624e7b78187d6fb8ab012b41d9f6f54b1bcb61e61c4845f8357ec"
[[package]]
name = "indexmap"
version = "1.3.2"
version = "1.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "076f042c5b7b98f31d205f1249267e12a6518c1481e9dae9764af19b707d2292"
checksum = "c398b2b113b55809ceb9ee3e753fcbac793f1956663f3c36549c1346015c2afe"
dependencies = [
"autocfg 1.0.0",
]
@ -2028,9 +2028,9 @@ dependencies = [
[[package]]
name = "rusty_v8"
version = "0.4.2"
version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "acb0ad56a57c42009a8d16df5fa94ae882ad0ffe0e88fe1a23b261b3affbccf2"
checksum = "66491597ce62f02c48f0194fc9574ec0b50c648e84947400ba13882394b6d56c"
dependencies = [
"bitflags",
"cargo_gn",

View file

@ -19,7 +19,7 @@ futures = { version = "0.3.5", features = ["thread-pool", "compat"] }
lazy_static = "1.4.0"
libc = "0.2.71"
log = "0.4.8"
rusty_v8 = "0.4.2"
rusty_v8 = "0.5.0"
serde_json = "1.0.53"
url = "2.1.1"

View file

@ -239,7 +239,8 @@ pub fn boxed_slice_to_uint8array<'sc>(
let backing_store = v8::ArrayBuffer::new_backing_store_from_boxed_slice(buf);
let backing_store_shared = backing_store.make_shared();
let ab = v8::ArrayBuffer::with_backing_store(scope, &backing_store_shared);
v8::Uint8Array::new(ab, 0, buf_len).expect("Failed to create UintArray8")
v8::Uint8Array::new(scope, ab, 0, buf_len)
.expect("Failed to create UintArray8")
}
pub extern "C" fn host_import_module_dynamically_callback(
@ -442,7 +443,7 @@ fn send(
let control_backing_store: v8::SharedRef<v8::BackingStore>;
let control = match v8::Local::<v8::ArrayBufferView>::try_from(args.get(1)) {
Ok(view) => unsafe {
control_backing_store = view.buffer().unwrap().get_backing_store();
control_backing_store = view.buffer(scope).unwrap().get_backing_store();
get_backing_store_slice(
&control_backing_store,
view.byte_offset(),
@ -458,7 +459,7 @@ fn send(
let mut buf_iter = (2..args.length()).map(|idx| {
v8::Local::<v8::ArrayBufferView>::try_from(args.get(idx))
.map(ZeroCopyBuf::new)
.map(|view| ZeroCopyBuf::new(scope, view))
.map_err(|err| {
let msg = format!("Invalid argument at position {}: {}", idx, err);
let msg = v8::String::new(scope, &msg).unwrap();
@ -575,7 +576,7 @@ fn eval_context(
if maybe_script.is_none() {
assert!(tc.has_caught());
let exception = tc.exception().unwrap();
let exception = tc.exception(scope).unwrap();
output.set(
context,
@ -616,7 +617,7 @@ fn eval_context(
if result.is_none() {
assert!(tc.has_caught());
let exception = tc.exception().unwrap();
let exception = tc.exception(scope).unwrap();
output.set(
context,
@ -701,14 +702,15 @@ fn encode(
let buf = if text_bytes.is_empty() {
let ab = v8::ArrayBuffer::new(scope, 0);
v8::Uint8Array::new(ab, 0, 0).expect("Failed to create UintArray8")
v8::Uint8Array::new(scope, ab, 0, 0).expect("Failed to create UintArray8")
} else {
let buf_len = text_bytes.len();
let backing_store =
v8::ArrayBuffer::new_backing_store_from_boxed_slice(text_bytes);
let backing_store_shared = backing_store.make_shared();
let ab = v8::ArrayBuffer::with_backing_store(scope, &backing_store_shared);
v8::Uint8Array::new(ab, 0, buf_len).expect("Failed to create UintArray8")
v8::Uint8Array::new(scope, ab, 0, buf_len)
.expect("Failed to create UintArray8")
};
rv.set(buf.into())
@ -729,7 +731,7 @@ fn decode(
}
};
let backing_store = view.buffer().unwrap().get_backing_store();
let backing_store = view.buffer(scope).unwrap().get_backing_store();
let buf = unsafe {
get_backing_store_slice(
&backing_store,

View file

@ -315,7 +315,7 @@ impl CoreIsolate {
match v8::Script::compile(scope, context, source, Some(&origin)) {
Some(script) => script,
None => {
let exception = tc.exception().unwrap();
let exception = tc.exception(scope).unwrap();
return exception_to_err_result(scope, exception);
}
};
@ -324,7 +324,7 @@ impl CoreIsolate {
Some(_) => Ok(()),
None => {
assert!(tc.has_caught());
let exception = tc.exception().unwrap();
let exception = tc.exception(scope).unwrap();
exception_to_err_result(scope, exception)
}
}
@ -571,7 +571,7 @@ fn async_op_response<'s>(
None => js_recv_cb.call(scope, context, global, &[]),
};
match tc.exception() {
match tc.exception(scope) {
None => Ok(()),
Some(exception) => exception_to_err_result(scope, exception),
}
@ -602,7 +602,7 @@ fn drain_macrotasks<'s>(
let is_done = js_macrotask_cb.call(scope, context, global, &[]);
if let Some(exception) = tc.exception() {
if let Some(exception) = tc.exception(scope) {
return exception_to_err_result(scope, exception);
}

View file

@ -133,7 +133,8 @@ impl EsIsolate {
if tc.has_caught() {
assert!(maybe_module.is_none());
return exception_to_err_result(scope, tc.exception().unwrap());
let e = tc.exception(scope).unwrap();
return exception_to_err_result(scope, e);
}
let module = maybe_module.unwrap();
@ -198,7 +199,7 @@ impl EsIsolate {
match result {
Some(_) => Ok(()),
None => {
let exception = tc.exception().unwrap();
let exception = tc.exception(scope).unwrap();
exception_to_err_result(scope, exception)
}
}
@ -352,7 +353,7 @@ impl EsIsolate {
let resolver = resolver_handle.get(scope).unwrap();
resolver_handle.reset(scope);
let mut module = {
let module = {
let state = state_rc.borrow();
let info = state
.modules

View file

@ -18,8 +18,11 @@ pub struct ZeroCopyBuf {
unsafe impl Send for ZeroCopyBuf {}
impl ZeroCopyBuf {
pub fn new(view: v8::Local<v8::ArrayBufferView>) -> Self {
let backing_store = view.buffer().unwrap().get_backing_store();
pub fn new<'s>(
scope: &mut impl v8::ToLocal<'s>,
view: v8::Local<v8::ArrayBufferView>,
) -> Self {
let backing_store = view.buffer(scope).unwrap().get_backing_store();
let byte_offset = view.byte_offset();
let byte_length = view.byte_length();
Self {