Skip to content
Merged
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
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,6 @@
[submodule "third_party/highway/src"]
path = third_party/highway/src
url = https://chromium.googlesource.com/external/github.com/google/highway.git
[submodule "third_party/partition_alloc"]
path = third_party/partition_alloc
url = https://chromium.googlesource.com/chromium/src/base/allocator/partition_allocator.git
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Rusty V8 Binding

V8 Version: 13.4.114.17
V8 Version: 13.5.212.0

[![ci](https://github.com/denoland/rusty_v8/workflows/ci/badge.svg?branch=main)](https://github.com/denoland/rusty_v8/actions)
[![crates](https://img.shields.io/crates/v/v8.svg)](https://crates.io/crates/v8)
Expand Down
2 changes: 1 addition & 1 deletion build
Submodule build updated 322 files
2 changes: 1 addition & 1 deletion buildtools
Submodule buildtools updated from 6b4eaa to b248db
7 changes: 6 additions & 1 deletion src/array_buffer_view.rs
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,12 @@ impl ArrayBufferView {
{
unsafe {
let (data, size) = self.get_contents_raw_parts(storage);
std::slice::from_raw_parts(data, size)
if data.is_null() {
debug_assert_eq!(size, 0);
std::slice::from_raw_parts(std::ptr::dangling(), size)
} else {
std::slice::from_raw_parts(data, size)
}
}
}
}
1 change: 1 addition & 0 deletions src/binding.cc
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#include <iostream>
#include <memory>

#include "cppgc/allocation.h"
#include "cppgc/platform.h"
#include "support.h"
#include "unicode/locid.h"
Expand Down
20 changes: 1 addition & 19 deletions src/function.rs
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ pub struct FunctionCallbackInfo {
impl FunctionCallbackInfo {
const kHolderIndex: i32 = 0;
const kIsolateIndex: i32 = 1;
const kUnusedIndex: i32 = 2;
const kContextIndex: i32 = 2;
const kReturnValueIndex: i32 = 3;
const kTargetIndex: i32 = 4;
const kNewTargetIndex: i32 = 5;
Expand All @@ -263,11 +263,6 @@ impl FunctionCallbackInfo {
self.get_implicit_arg_non_null::<Value>(Self::kReturnValueIndex)
}

#[inline(always)]
pub(crate) fn holder(&self) -> Local<Object> {
unsafe { self.get_implicit_arg_local(Self::kHolderIndex) }
}

#[inline(always)]
pub(crate) fn new_target(&self) -> Local<Value> {
unsafe { self.get_implicit_arg_local(Self::kNewTargetIndex) }
Expand Down Expand Up @@ -374,19 +369,6 @@ impl<'s> FunctionCallbackArguments<'s> {
unsafe { &mut *self.0.get_isolate_ptr() }
}

/// If the callback was created without a Signature, this is the same value as
/// `this()`. If there is a signature, and the signature didn't match `this()`
/// but one of its hidden prototypes, this will be the respective hidden
/// prototype.
///
/// Note that this is not the prototype of `this()` on which the accessor
/// referencing this callback was found (which in V8 internally is often
/// referred to as holder [sic]).
#[inline(always)]
pub fn holder(&self) -> Local<'s, Object> {
self.0.holder()
}

/// For construct calls, this returns the "new.target" value.
#[inline(always)]
pub fn new_target(&self) -> Local<'s, Value> {
Expand Down
9 changes: 9 additions & 0 deletions src/string.rs
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,11 @@ unsafe extern "C" fn one_byte_const_estimate_memory_usage(
) -> int {
-1
}
unsafe extern "C" fn one_byte_const_estimate_shared_memory_usage(
_this: *const OneByteConst,
_recorder: *mut (),
) {
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This function does nothing? 😕

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it doesn't need to do anything, it just needs to exist for the vtable shape to be correct


type OneByteConstNoOp = unsafe extern "C" fn(*const OneByteConst);
type OneByteConstIsCacheable =
Expand All @@ -297,6 +302,8 @@ type OneByteConstUnaccount =
unsafe extern "C" fn(*const OneByteConst, *mut Isolate);
type OneByteConstEstimateMemoryUsage =
unsafe extern "C" fn(*const OneByteConst) -> int;
type OneByteConstEstimateSharedMemoryUsage =
unsafe extern "C" fn(*const OneByteConst, *mut ());

#[repr(C)]
struct OneByteConstVtable {
Expand Down Expand Up @@ -327,6 +334,7 @@ struct OneByteConstVtable {
is_cacheable: OneByteConstIsCacheable,
unaccount: OneByteConstUnaccount,
estimate_memory_usage: OneByteConstEstimateMemoryUsage,
estimate_shared_memory_usage: OneByteConstEstimateSharedMemoryUsage,
dispose: OneByteConstNoOp,
lock: OneByteConstNoOp,
unlock: OneByteConstNoOp,
Expand All @@ -344,6 +352,7 @@ const ONE_BYTE_CONST_VTABLE: OneByteConstVtable = OneByteConstVtable {
is_cacheable: one_byte_const_is_cacheable,
unaccount: one_byte_const_unaccount,
estimate_memory_usage: one_byte_const_estimate_memory_usage,
estimate_shared_memory_usage: one_byte_const_estimate_shared_memory_usage,
dispose: one_byte_const_no_op,
lock: one_byte_const_no_op,
unlock: one_byte_const_no_op,
Expand Down
2 changes: 0 additions & 2 deletions tests/test_api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1938,7 +1938,6 @@ fn instance_template_with_internal_field() {
) {
let this = args.this();

assert_eq!(args.holder(), this);
assert!(args.data().is_undefined());

assert!(this.set_internal_field(0, v8::Integer::new(scope, 42).into()));
Expand Down Expand Up @@ -2135,7 +2134,6 @@ fn object_template_set_accessor() {
) {
let this = args.this();

assert_eq!(args.holder(), this);
assert!(args.data().is_undefined());

let ret = v8::Integer::new(scope, 69);
Expand Down
2 changes: 1 addition & 1 deletion third_party/abseil-cpp
Submodule abseil-cpp updated from aaed37 to 2705c6
2 changes: 1 addition & 1 deletion third_party/icu
Submodule icu updated from bbccc2 to d30b7b
2 changes: 1 addition & 1 deletion third_party/libc++/src
Submodule src updated from 2e2515 to 7f8b68
2 changes: 1 addition & 1 deletion third_party/libc++abi/src
Submodule src updated from 634228 to 94c5d7
2 changes: 1 addition & 1 deletion third_party/libunwind/src
Submodule src updated from e55d8c to 62e217
2 changes: 1 addition & 1 deletion third_party/llvm-libc/src
Submodule src updated from 6b4e37 to 2f5bf1
1 change: 1 addition & 0 deletions third_party/partition_alloc
Submodule partition_alloc added at 46d880
2 changes: 1 addition & 1 deletion tools/clang
Submodule clang updated from a037c8 to ab2d3e
2 changes: 1 addition & 1 deletion v8
Submodule v8 updated 1531 files
Loading