summaryrefslogtreecommitdiff
path: root/ops/optimizer_tests
diff options
context:
space:
mode:
Diffstat (limited to 'ops/optimizer_tests')
-rw-r--r--ops/optimizer_tests/cow_str.expected2
-rw-r--r--ops/optimizer_tests/cow_str.out13
-rw-r--r--ops/optimizer_tests/op_blob_revoke_object_url.expected2
-rw-r--r--ops/optimizer_tests/op_print.expected2
-rw-r--r--ops/optimizer_tests/owned_string.expected2
-rw-r--r--ops/optimizer_tests/owned_string.out11
-rw-r--r--ops/optimizer_tests/strings.expected2
-rw-r--r--ops/optimizer_tests/strings.out11
-rw-r--r--ops/optimizer_tests/strings_result.expected2
9 files changed, 35 insertions, 12 deletions
diff --git a/ops/optimizer_tests/cow_str.expected b/ops/optimizer_tests/cow_str.expected
index 8b28965ba..9db8cfaf3 100644
--- a/ops/optimizer_tests/cow_str.expected
+++ b/ops/optimizer_tests/cow_str.expected
@@ -3,7 +3,7 @@ returns_result: false
has_ref_opstate: false
has_rc_opstate: false
has_fast_callback_option: false
-needs_fast_callback_option: false
+needs_fast_callback_option: true
fast_result: Some(Void)
fast_parameters: [V8Value, SeqOneByteString]
transforms: {0: Transform { kind: SeqOneByteString(Cow), index: 0 }}
diff --git a/ops/optimizer_tests/cow_str.out b/ops/optimizer_tests/cow_str.out
index 8ee82078b..dc909da81 100644
--- a/ops/optimizer_tests/cow_str.out
+++ b/ops/optimizer_tests/cow_str.out
@@ -31,7 +31,7 @@ impl op_cow_str {
use deno_core::v8::fast_api::CType;
Some(
deno_core::v8::fast_api::FastFunction::new(
- &[V8Value, SeqOneByteString],
+ &[V8Value, SeqOneByteString, CallbackOptions],
CType::Void,
op_cow_str_fast_fn as *const ::std::ffi::c_void,
),
@@ -77,10 +77,19 @@ impl op_cow_str {
fn op_cow_str_fast_fn<'scope>(
_: deno_core::v8::Local<deno_core::v8::Object>,
c: *const deno_core::v8::fast_api::FastApiOneByteString,
+ fast_api_callback_options: *mut deno_core::v8::fast_api::FastApiCallbackOptions,
) -> () {
use deno_core::v8;
use deno_core::_ops;
- let c = ::std::borrow::Cow::Borrowed(unsafe { &*c }.as_str());
+ let c = ::std::borrow::Cow::Borrowed(
+ match ::std::str::from_utf8(unsafe { &*c }.as_bytes()) {
+ Ok(v) => v,
+ Err(_) => {
+ unsafe { &mut *fast_api_callback_options }.fallback = true;
+ return Default::default();
+ }
+ },
+ );
let result = op_cow_str::call(c);
result
}
diff --git a/ops/optimizer_tests/op_blob_revoke_object_url.expected b/ops/optimizer_tests/op_blob_revoke_object_url.expected
index 00a896433..a412eceb8 100644
--- a/ops/optimizer_tests/op_blob_revoke_object_url.expected
+++ b/ops/optimizer_tests/op_blob_revoke_object_url.expected
@@ -3,7 +3,7 @@ returns_result: true
has_ref_opstate: true
has_rc_opstate: false
has_fast_callback_option: false
-needs_fast_callback_option: false
+needs_fast_callback_option: true
fast_result: Some(Void)
fast_parameters: [V8Value, SeqOneByteString]
transforms: {1: Transform { kind: SeqOneByteString(Owned), index: 1 }}
diff --git a/ops/optimizer_tests/op_print.expected b/ops/optimizer_tests/op_print.expected
index 0390be396..6095c138e 100644
--- a/ops/optimizer_tests/op_print.expected
+++ b/ops/optimizer_tests/op_print.expected
@@ -3,7 +3,7 @@ returns_result: true
has_ref_opstate: true
has_rc_opstate: false
has_fast_callback_option: false
-needs_fast_callback_option: false
+needs_fast_callback_option: true
fast_result: Some(Void)
fast_parameters: [V8Value, SeqOneByteString, Bool]
transforms: {1: Transform { kind: SeqOneByteString(Ref), index: 1 }}
diff --git a/ops/optimizer_tests/owned_string.expected b/ops/optimizer_tests/owned_string.expected
index a15275412..4c47a0525 100644
--- a/ops/optimizer_tests/owned_string.expected
+++ b/ops/optimizer_tests/owned_string.expected
@@ -3,7 +3,7 @@ returns_result: false
has_ref_opstate: false
has_rc_opstate: false
has_fast_callback_option: false
-needs_fast_callback_option: false
+needs_fast_callback_option: true
fast_result: Some(U32)
fast_parameters: [V8Value, SeqOneByteString]
transforms: {0: Transform { kind: SeqOneByteString(Owned), index: 0 }}
diff --git a/ops/optimizer_tests/owned_string.out b/ops/optimizer_tests/owned_string.out
index 5b516ac5c..f8b195b2f 100644
--- a/ops/optimizer_tests/owned_string.out
+++ b/ops/optimizer_tests/owned_string.out
@@ -31,7 +31,7 @@ impl op_string_length {
use deno_core::v8::fast_api::CType;
Some(
deno_core::v8::fast_api::FastFunction::new(
- &[V8Value, SeqOneByteString],
+ &[V8Value, SeqOneByteString, CallbackOptions],
CType::Uint32,
op_string_length_fast_fn as *const ::std::ffi::c_void,
),
@@ -89,10 +89,17 @@ impl op_string_length {
fn op_string_length_fast_fn<'scope>(
_: deno_core::v8::Local<deno_core::v8::Object>,
string: *const deno_core::v8::fast_api::FastApiOneByteString,
+ fast_api_callback_options: *mut deno_core::v8::fast_api::FastApiCallbackOptions,
) -> u32 {
use deno_core::v8;
use deno_core::_ops;
- let string = unsafe { &*string }.as_str().to_owned();
+ let string = match ::std::str::from_utf8(unsafe { &*string }.as_bytes()) {
+ Ok(v) => v.to_owned(),
+ Err(_) => {
+ unsafe { &mut *fast_api_callback_options }.fallback = true;
+ return Default::default();
+ }
+ };
let result = op_string_length::call(string);
result
}
diff --git a/ops/optimizer_tests/strings.expected b/ops/optimizer_tests/strings.expected
index ead741054..4a6bb1556 100644
--- a/ops/optimizer_tests/strings.expected
+++ b/ops/optimizer_tests/strings.expected
@@ -3,7 +3,7 @@ returns_result: false
has_ref_opstate: false
has_rc_opstate: false
has_fast_callback_option: false
-needs_fast_callback_option: false
+needs_fast_callback_option: true
fast_result: Some(U32)
fast_parameters: [V8Value, SeqOneByteString]
transforms: {0: Transform { kind: SeqOneByteString(Ref), index: 0 }}
diff --git a/ops/optimizer_tests/strings.out b/ops/optimizer_tests/strings.out
index 8a72c8cab..3238bfc42 100644
--- a/ops/optimizer_tests/strings.out
+++ b/ops/optimizer_tests/strings.out
@@ -31,7 +31,7 @@ impl op_string_length {
use deno_core::v8::fast_api::CType;
Some(
deno_core::v8::fast_api::FastFunction::new(
- &[V8Value, SeqOneByteString],
+ &[V8Value, SeqOneByteString, CallbackOptions],
CType::Uint32,
op_string_length_fast_fn as *const ::std::ffi::c_void,
),
@@ -90,10 +90,17 @@ impl op_string_length {
fn op_string_length_fast_fn<'scope>(
_: deno_core::v8::Local<deno_core::v8::Object>,
string: *const deno_core::v8::fast_api::FastApiOneByteString,
+ fast_api_callback_options: *mut deno_core::v8::fast_api::FastApiCallbackOptions,
) -> u32 {
use deno_core::v8;
use deno_core::_ops;
- let string = unsafe { &*string }.as_str();
+ let string = match ::std::str::from_utf8(unsafe { &*string }.as_bytes()) {
+ Ok(v) => v,
+ Err(_) => {
+ unsafe { &mut *fast_api_callback_options }.fallback = true;
+ return Default::default();
+ }
+ };
let result = op_string_length::call(string);
result
}
diff --git a/ops/optimizer_tests/strings_result.expected b/ops/optimizer_tests/strings_result.expected
index 68c753cab..3866751fd 100644
--- a/ops/optimizer_tests/strings_result.expected
+++ b/ops/optimizer_tests/strings_result.expected
@@ -3,7 +3,7 @@ returns_result: true
has_ref_opstate: false
has_rc_opstate: false
has_fast_callback_option: false
-needs_fast_callback_option: false
+needs_fast_callback_option: true
fast_result: Some(U32)
fast_parameters: [V8Value, SeqOneByteString]
transforms: {0: Transform { kind: SeqOneByteString(Ref), index: 0 }}