Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 0 additions & 15 deletions core/benches/ops/sync.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ deno_core::extension!(
op_buffer,
op_buffer_jsbuffer,
op_buffer_nofast,
op_arraybuffer,
],
state = |state| {
state.put(1234u32);
Expand Down Expand Up @@ -156,9 +155,6 @@ pub fn op_buffer_jsbuffer(#[buffer] _buffer: JsBuffer) {}
#[op2(nofast)]
pub fn op_buffer_nofast(#[buffer] _buffer: &[u8]) {}

#[op2(fast)]
pub fn op_arraybuffer(#[arraybuffer] _buffer: &[u8]) {}

fn bench_op(
b: &mut Bencher,
count: usize,
Expand Down Expand Up @@ -545,16 +541,6 @@ fn bench_op_buffer_nofast(b: &mut Bencher) {
);
}

fn bench_op_arraybuffer(b: &mut Bencher) {
bench_op(
b,
BENCH_COUNT,
"op_arraybuffer",
1,
"op_arraybuffer(ARRAYBUFFER)",
);
}

benchmark_group!(
benches,
baseline,
Expand Down Expand Up @@ -592,7 +578,6 @@ benchmark_group!(
bench_op_buffer,
bench_op_buffer_jsbuffer,
bench_op_buffer_nofast,
bench_op_arraybuffer,
);

benchmark_main!(benches);
36 changes: 0 additions & 36 deletions core/runtime/ops.rs
Original file line number Diff line number Diff line change
Expand Up @@ -619,7 +619,6 @@ mod tests {
op_buffer_bytesmut,
op_buffer_any,
op_buffer_any_length,
op_arraybuffer_slice,
op_test_get_cppgc_resource,
op_test_get_cppgc_resource_option,
op_test_make_cppgc_resource,
Expand Down Expand Up @@ -1779,41 +1778,6 @@ mod tests {
Ok(())
}

#[op2(fast)]
pub fn op_arraybuffer_slice(
#[arraybuffer] input: &[u8],
#[number] inlen: usize,
#[arraybuffer] output: &mut [u8],
#[number] outlen: usize,
) {
assert_eq!(inlen, input.len());
assert_eq!(outlen, output.len());
if inlen > 0 && outlen > 0 {
output[0] = input[0];
}
}

#[tokio::test]
pub async fn test_op_arraybuffer_slice()
-> Result<(), Box<dyn std::error::Error>> {
// Zero-length buffers
run_test2(
JIT_ITERATIONS,
"op_arraybuffer_slice",
"op_arraybuffer_slice(new ArrayBuffer(0), 0, new ArrayBuffer(0), 0);",
)?;
run_test2(
JIT_ITERATIONS,
"op_arraybuffer_slice",
r"let inbuf = new ArrayBuffer(10);
(new Uint8Array(inbuf))[0] = 1;
let outbuf = new ArrayBuffer(10);
op_arraybuffer_slice(inbuf, 10, outbuf, 10);
assert((new Uint8Array(outbuf))[0] == 1);",
)?;
Ok(())
}

// TODO(mmastrac): This is a dangerous op that we'll use to test resizable buffers in a later pass.
#[op2(fast)]
pub fn op_buffer_slice_unsafe_callback<'s, 'i>(
Expand Down
98 changes: 0 additions & 98 deletions ops/op2/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -588,104 +588,6 @@ any
<tr>
<td>

```text
#[arraybuffer] &mut [u8]
```

</td><td>
</td><td>
ArrayBuffer (resizable=true,false)
</td><td>
⚠️ JS may modify the contents of the slice if V8 is called re-entrantly.
</td></tr>
<tr>
<td>

```text
#[arraybuffer] &[u8]
```

</td><td>
</td><td>
ArrayBuffer (resizable=true,false)
</td><td>
⚠️ JS may modify the contents of the slice if V8 is called re-entrantly.
</td></tr>
<tr>
<td>

```text
#[arraybuffer] *mut u8
```

</td><td>
</td><td>
ArrayBuffer (resizable=true,false)
</td><td>
⚠️ JS may modify the contents of the slice if V8 is called re-entrantly. Because of how V8 treats empty arrays in fastcalls, they will always be passed as null.
</td></tr>
<tr>
<td>

```text
#[arraybuffer] *const u8
```

</td><td>
</td><td>
ArrayBuffer (resizable=true,false)
</td><td>
⚠️ JS may modify the contents of the slice if V8 is called re-entrantly. Because of how V8 treats empty arrays in fastcalls, they will always be passed as null.
</td></tr>
<tr>
<td>

```text
#[arraybuffer(copy)] Vec<u8>
```

</td><td>
</td><td>
ArrayBuffer (resizable=true,false)
</td><td>
Safe, but forces a copy.
</td></tr>
<tr>
<td>

```text
#[arraybuffer(copy)] Box<[u8]>
```

</td><td>
</td><td>
ArrayBuffer (resizable=true,false)
</td><td>
Safe, but forces a copy.
</td></tr>
<tr>
<td>

```text
#[arraybuffer(copy)] bytes::Bytes
```

</td><td>
</td><td>
ArrayBuffer (resizable=true,false)
</td><td>
Safe, but forces a copy.
</td></tr>
<tr>
<td>

```text
#[buffer(copy)] Vec<u8>
```
Expand Down
8 changes: 0 additions & 8 deletions ops/op2/signature.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1293,10 +1293,6 @@ fn parse_attribute(
(#[anybuffer(unsafe)]) => Some(AttributeModifier::Buffer(BufferMode::Unsafe, BufferSource::Any)),
(#[anybuffer(copy)]) => Some(AttributeModifier::Buffer(BufferMode::Copy, BufferSource::Any)),
(#[anybuffer(detach)]) => Some(AttributeModifier::Buffer(BufferMode::Detach, BufferSource::Any)),
(#[arraybuffer]) => Some(AttributeModifier::Buffer(BufferMode::Default, BufferSource::ArrayBuffer)),
(#[arraybuffer(unsafe)]) => Some(AttributeModifier::Buffer(BufferMode::Unsafe, BufferSource::ArrayBuffer)),
(#[arraybuffer(copy)]) => Some(AttributeModifier::Buffer(BufferMode::Copy, BufferSource::ArrayBuffer)),
(#[arraybuffer(detach)]) => Some(AttributeModifier::Buffer(BufferMode::Detach, BufferSource::ArrayBuffer)),
(#[global]) => Some(AttributeModifier::Global),
(#[this]) => Some(AttributeModifier::This),
(#[cppgc]) => Some(AttributeModifier::CppGcResource),
Expand Down Expand Up @@ -1972,10 +1968,6 @@ mod tests {
fn op_pointers(#[buffer] r#in: *const u8, #[buffer] out: *mut u8);
(Buffer(Ptr(Ref, u8), Default, TypedArray), Buffer(Ptr(Mut, u8), Default, TypedArray)) -> Infallible(Void, false)
);
test!(
fn op_arraybuffer(#[arraybuffer] r#in: &[u8]);
(Buffer(Slice(Ref, u8), Default, ArrayBuffer)) -> Infallible(Void, false)
);
test!(
#[serde] fn op_serde(#[serde] input: package::SerdeInputType) -> Result<package::SerdeReturnType, Error>;
(SerdeV8(package::SerdeInputType)) -> Result(SerdeV8(package::SerdeReturnType), false)
Expand Down
112 changes: 0 additions & 112 deletions ops/op2/test_cases/sync/buffers_out.out

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

14 changes: 0 additions & 14 deletions ops/op2/test_cases/sync/buffers_out.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,3 @@ fn op_buffers(#[buffer] buffer: JsBuffer) -> JsBuffer {
fn op_buffers_option(#[buffer] buffer: Option<JsBuffer>) -> Option<JsBuffer> {
buffer
}

#[op2]
#[arraybuffer]
fn op_arraybuffers(#[arraybuffer] buffer: JsBuffer) -> JsBuffer {
buffer
}

// TODO(mmastrac): Option + Marker doesn't work yet

// #[op2]
// #[arraybuffer]
// fn op_arraybuffers_option(#[arraybuffer] buffer: Option<JsBuffer>) -> Option<JsBuffer> {
// buffer
// }
Loading
Loading