Skip to content

Commit

Permalink
Clamp smi in fast calls by default (#941)
Browse files Browse the repository at this point in the history
Ref denoland/deno#26480

Matches Rust's `as` cast (used by slow calls)
  • Loading branch information
littledivy authored Oct 24, 2024
1 parent 5e67300 commit d2945fb
Show file tree
Hide file tree
Showing 28 changed files with 352 additions and 54 deletions.
14 changes: 12 additions & 2 deletions ops/op2/dispatch_fast.rs
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,8 @@ impl FastSignature {

quote!(
use deno_core::v8::fast_api::Type as CType;
use deno_core::v8;

deno_core::v8::fast_api::CFunction::new(
Self::#fast_function as _,
&deno_core::v8::fast_api::CFunctionInfo::new(
Expand Down Expand Up @@ -230,8 +232,16 @@ impl V8FastCallType {
match &self {
V8FastCallType::Void => quote!(CType::Void.scalar()),
V8FastCallType::Bool => quote!(CType::Bool.scalar()),
V8FastCallType::U32 => quote!(CType::Uint32.scalar()),
V8FastCallType::I32 => quote!(CType::Int32.scalar()),
V8FastCallType::U32 => quote!(v8::fast_api::CTypeInfo::new(
CType::Uint32,
v8::fast_api::SequenceType::Scalar,
v8::fast_api::Flags::Clamp
)),
V8FastCallType::I32 => quote!(v8::fast_api::CTypeInfo::new(
CType::Int32,
v8::fast_api::SequenceType::Scalar,
v8::fast_api::Flags::Clamp
)),
V8FastCallType::U64 => quote!(CType::Uint64.scalar()),
V8FastCallType::I64 => quote!(CType::Int64.scalar()),
V8FastCallType::F32 => quote!(CType::Float32.scalar()),
Expand Down
14 changes: 12 additions & 2 deletions ops/op2/test_cases/async/async_deferred.out

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 12 additions & 2 deletions ops/op2/test_cases/async/async_lazy.out

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

38 changes: 32 additions & 6 deletions ops/op2/test_cases/sync/add.out

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions ops/op2/test_cases/sync/bigint.out

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions ops/op2/test_cases/sync/bool.out

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions ops/op2/test_cases/sync/bool_result.out

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions ops/op2/test_cases/sync/buffers.out

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions ops/op2/test_cases/sync/buffers_copy.out

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions ops/op2/test_cases/sync/cfg.out

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions ops/op2/test_cases/sync/clippy_allow.out

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit d2945fb

Please sign in to comment.