Upgrade V8 to 8.4.300 (#368)

This commit is contained in:
Bert Belder 2020-05-06 00:06:35 +02:00
parent 041bcd1797
commit 9ad0d35718
No known key found for this signature in database
GPG Key ID: 7A77887B2E2ED461
14 changed files with 77 additions and 55 deletions

2
build

@ -1 +1 @@
Subproject commit 56551e71dc0281cc1d9471caf6a02d02f18c830e
Subproject commit 17f96622d000d09a0712c55cb394c91095dccb62

View File

@ -143,7 +143,7 @@ fn download_ninja_gn_binaries() {
.parent()
.unwrap();
let bin_dir = target_dir
.join("ninja_gn_binaries-20200313")
.join("ninja_gn_binaries-20200506")
.join(platform());
let gn = bin_dir.join("gn");
let ninja = bin_dir.join("ninja");

@ -1 +1 @@
Subproject commit d0a9124cf0c6622fb2a790834b86bb51d90ad6a1
Subproject commit 4712bad481f1d938e4eae3693efe5a6183f639d9

View File

@ -16,7 +16,7 @@ using namespace support;
static_assert(sizeof(two_pointers_t) ==
sizeof(std::shared_ptr<v8::BackingStore>),
"two_pointers_t size mismatch");
"std::shared_ptr<v8::BackingStore> size mismatch");
static_assert(sizeof(v8::ScriptOrigin) == sizeof(size_t) * 7,
"ScriptOrigin size mismatch");
@ -53,6 +53,9 @@ static_assert(sizeof(v8::Location) == sizeof(size_t) * 1,
static_assert(sizeof(v8::SnapshotCreator) == sizeof(size_t) * 1,
"SnapshotCreator size mismatch");
static_assert(sizeof(three_pointers_t) == sizeof(v8_inspector::StringView),
"StringView size mismatch");
enum InternalSlots {
kSlotDynamicImport = 0,
kNumInternalSlots,
@ -1450,7 +1453,7 @@ v8_inspector::V8Inspector* v8_inspector__V8Inspector__create(
v8_inspector::V8InspectorSession* v8_inspector__V8Inspector__connect(
v8_inspector::V8Inspector* self, int context_group_id,
v8_inspector::V8Inspector::Channel* channel,
const v8_inspector::StringView& state) {
v8_inspector::StringView state) {
std::unique_ptr<v8_inspector::V8InspectorSession> u =
self->connect(context_group_id, channel, state);
return u.release();
@ -1458,7 +1461,7 @@ v8_inspector::V8InspectorSession* v8_inspector__V8Inspector__connect(
void v8_inspector__V8Inspector__contextCreated(
v8_inspector::V8Inspector* self, const v8::Context& context,
int contextGroupId, const v8_inspector::StringView& humanReadableName) {
int contextGroupId, v8_inspector::StringView humanReadableName) {
self->contextCreated(v8_inspector::V8ContextInfo(
ptr_to_local(&context), contextGroupId, humanReadableName));
}
@ -1469,15 +1472,13 @@ void v8_inspector__V8InspectorSession__DELETE(
}
void v8_inspector__V8InspectorSession__dispatchProtocolMessage(
v8_inspector::V8InspectorSession* self,
const v8_inspector::StringView& message) {
v8_inspector::V8InspectorSession* self, v8_inspector::StringView message) {
self->dispatchProtocolMessage(message);
}
void v8_inspector__V8InspectorSession__schedulePauseOnNextStatement(
v8_inspector::V8InspectorSession* self,
const v8_inspector::StringView& reason,
const v8_inspector::StringView& detail) {
v8_inspector::V8InspectorSession* self, v8_inspector::StringView reason,
v8_inspector::StringView detail) {
self->schedulePauseOnNextStatement(reason, detail);
}
} // extern "C"
@ -1600,13 +1601,13 @@ void v8_inspector__StringBuffer__DELETE(v8_inspector::StringBuffer* self) {
delete self;
}
const v8_inspector::StringView* v8_inspector__StringBuffer__string(
v8_inspector::StringBuffer* self) {
return &self->string();
three_pointers_t v8_inspector__StringBuffer__string(
const v8_inspector::StringBuffer& self) {
return make_pod<three_pointers_t>(self.string());
}
v8_inspector::StringBuffer* v8_inspector__StringBuffer__create(
const v8_inspector::StringView& source) {
v8_inspector::StringView source) {
return v8_inspector::StringBuffer::create(source).release();
}

View File

@ -72,19 +72,18 @@ extern "C" {
fn v8_inspector__V8InspectorSession__DELETE(this: &mut V8InspectorSession);
fn v8_inspector__V8InspectorSession__dispatchProtocolMessage(
session: *mut V8InspectorSession,
message: &StringView,
message: StringView,
);
fn v8_inspector__V8InspectorSession__schedulePauseOnNextStatement(
session: *mut V8InspectorSession,
break_reason: &StringView,
break_details: &StringView,
break_reason: StringView,
break_details: StringView,
);
fn v8_inspector__StringBuffer__DELETE(this: &mut StringBuffer);
fn v8_inspector__StringBuffer__string(this: &mut StringBuffer)
-> &StringView;
fn v8_inspector__StringBuffer__string(this: &StringBuffer) -> StringView;
fn v8_inspector__StringBuffer__create(
source: &StringView,
source: StringView,
) -> UniquePtr<StringBuffer>;
fn v8_inspector__V8Inspector__DELETE(this: &mut V8Inspector);
@ -96,13 +95,13 @@ extern "C" {
inspector: *mut V8Inspector,
context_group_id: int,
channel: *mut Channel,
state: *const StringView,
state: StringView,
) -> *mut V8InspectorSession;
fn v8_inspector__V8Inspector__contextCreated(
this: *mut V8Inspector,
context: *const Context,
contextGroupId: int,
humanReadableName: *const StringView,
humanReadableName: StringView,
);
}
@ -371,9 +370,9 @@ mod tests {
fn test_channel() {
let mut channel = TestChannel::new();
let msg_view = StringView::from(MESSAGE);
channel.send_response(999, StringBuffer::create(&msg_view));
channel.send_response(999, StringBuffer::create(msg_view));
assert_eq!(CALL_COUNT.swap(0, SeqCst), 1);
channel.send_notification(StringBuffer::create(&msg_view));
channel.send_notification(StringBuffer::create(msg_view));
assert_eq!(CALL_COUNT.swap(0, SeqCst), 1);
channel.flush_protocol_notifications();
assert_eq!(CALL_COUNT.swap(0, SeqCst), 1);
@ -559,7 +558,7 @@ impl V8InspectorClientBase {
pub struct V8InspectorSession(Opaque);
impl V8InspectorSession {
pub fn dispatch_protocol_message(&mut self, message: &StringView) {
pub fn dispatch_protocol_message(&mut self, message: StringView) {
unsafe {
v8_inspector__V8InspectorSession__dispatchProtocolMessage(self, message)
}
@ -567,8 +566,8 @@ impl V8InspectorSession {
pub fn schedule_pause_on_next_statement(
&mut self,
reason: &StringView,
detail: &StringView,
reason: StringView,
detail: StringView,
) {
unsafe {
v8_inspector__V8InspectorSession__schedulePauseOnNextStatement(
@ -600,12 +599,12 @@ impl StringBuffer {
// therefore we declare self as mutable here.
// TODO: figure out whether it'd be safe to assume a const receiver here.
// That would make it possible to implement `Deref<Target = StringBuffer>`.
pub fn string(&mut self) -> &StringView {
pub fn string(&self) -> StringView {
unsafe { v8_inspector__StringBuffer__string(self) }
}
/// This method copies contents.
pub fn create(source: &StringView) -> UniquePtr<StringBuffer> {
pub fn create(source: StringView) -> UniquePtr<StringBuffer> {
unsafe { v8_inspector__StringBuffer__create(source) }
}
}
@ -633,6 +632,7 @@ use std::string;
// `u8` have the same size. This is assumption is checked in 'support.h'.
// TODO: find/open upstream issue to allow #[repr(bool)] support.
#[derive(Clone, Copy)]
#[repr(u8)]
pub enum StringView<'a> {
// Do not reorder!
@ -701,8 +701,8 @@ impl<'a> StringView<'a> {
}
}
impl<'a: 'b, 'b> IntoIterator for &'a StringView<'b> {
type IntoIter = StringViewIterator<'a, 'b>;
impl<'a> IntoIterator for StringView<'a> {
type IntoIter = StringViewIterator<'a>;
type Item = u16;
fn into_iter(self) -> Self::IntoIter {
@ -797,12 +797,12 @@ impl<'a, T> Deref for CharacterArray<'a, T> {
}
#[derive(Copy, Clone)]
pub struct StringViewIterator<'a: 'b, 'b> {
view: &'a StringView<'b>,
pub struct StringViewIterator<'a> {
view: StringView<'a>,
pos: usize,
}
impl<'a: 'b, 'b> Iterator for StringViewIterator<'a, 'b> {
impl<'a> Iterator for StringViewIterator<'a> {
type Item = u16;
fn next(&mut self) -> Option<Self::Item> {
@ -815,7 +815,7 @@ impl<'a: 'b, 'b> Iterator for StringViewIterator<'a, 'b> {
}
}
impl<'a: 'b, 'b> ExactSizeIterator for StringViewIterator<'a, 'b> {
impl<'a> ExactSizeIterator for StringViewIterator<'a> {
fn len(&self) -> usize {
self.view.len()
}
@ -852,7 +852,7 @@ impl V8Inspector {
&mut self,
context_group_id: i32,
channel: &mut T,
state: &StringView,
state: StringView,
) -> UniqueRef<V8InspectorSession>
where
T: AsChannel,
@ -873,7 +873,7 @@ impl V8Inspector {
&mut self,
context: Local<Context>,
context_group_id: i32,
human_readable_name: &StringView,
human_readable_name: StringView,
) {
unsafe {
v8_inspector__V8Inspector__contextCreated(

View File

@ -101,6 +101,19 @@ impl CreateParams {
self
}
/// The following parameters describe the offsets for addressing type info
/// for wrapped API objects and are used by the fast C API
/// (for details see v8-fast-api-calls.h).
pub fn embedder_wrapper_type_info_offsets(
mut self,
embedder_wrapper_type_index: int,
embedder_wrapper_object_index: int,
) -> Self {
self.raw.embedder_wrapper_type_index = embedder_wrapper_type_index;
self.raw.embedder_wrapper_object_index = embedder_wrapper_object_index;
self
}
fn set_fallback_defaults(mut self) -> Self {
if self.raw.array_buffer_allocator_shared.is_null() {
self = self.array_buffer_allocator(array_buffer::new_default_allocator());
@ -142,6 +155,8 @@ pub(crate) mod raw {
pub external_references: *const intptr_t,
pub allow_atomics_wait: bool,
pub only_terminate_in_safe_scope: bool,
pub embedder_wrapper_type_index: int,
pub embedder_wrapper_object_index: int,
}
extern "C" {

View File

@ -138,6 +138,12 @@ struct two_pointers_t {
void* b;
};
struct three_pointers_t {
void* a;
void* b;
void* c;
};
} // namespace support
#endif // SUPPORT_H_

View File

@ -890,7 +890,7 @@ fn inspector_string_view() {
assert_eq!(chars.len(), view.into_iter().len());
assert_eq!(chars.len(), view.len());
for (c1, c2) in chars.iter().copied().map(u16::from).zip(&view) {
for (c1, c2) in chars.iter().copied().map(u16::from).zip(view) {
assert_eq!(c1, c2);
}
}
@ -900,7 +900,7 @@ fn inspector_string_buffer() {
let chars = b"Hello Venus!";
let mut buf = {
let src_view = v8::inspector::StringView::from(&chars[..]);
v8::inspector::StringBuffer::create(&src_view)
v8::inspector::StringBuffer::create(src_view)
};
let view = buf.as_mut().unwrap().string();
@ -2595,17 +2595,17 @@ fn inspector_dispatch_protocol_message() {
let name = b"";
let name_view = StringView::from(&name[..]);
inspector.context_created(context, 1, &name_view);
inspector.context_created(context, 1, name_view);
let mut channel = ChannelCounter::new();
let state = b"{}";
let state_view = StringView::from(&state[..]);
let mut session = inspector.connect(1, &mut channel, &state_view);
let mut session = inspector.connect(1, &mut channel, state_view);
let message = String::from(
r#"{"id":1,"method":"Network.enable","params":{"maxPostDataSize":65536}}"#,
);
let message = &message.into_bytes()[..];
let string_view = StringView::from(message);
session.dispatch_protocol_message(&string_view);
session.dispatch_protocol_message(string_view);
assert_eq!(channel.count_send_response, 1);
assert_eq!(channel.count_send_notification, 0);
assert_eq!(channel.count_flush_protocol_notifications, 0);
@ -2629,18 +2629,18 @@ fn inspector_schedule_pause_on_next_statement() {
let mut channel = ChannelCounter::new();
let state = b"{}";
let state_view = StringView::from(&state[..]);
let mut session = inspector.connect(1, &mut channel, &state_view);
let mut session = inspector.connect(1, &mut channel, state_view);
let name = b"";
let name_view = StringView::from(&name[..]);
inspector.context_created(context, 1, &name_view);
inspector.context_created(context, 1, name_view);
// In order for schedule_pause_on_next_statement to work, it seems you need
// to first enable the debugger.
let message = String::from(r#"{"id":1,"method":"Debugger.enable"}"#);
let message = &message.into_bytes()[..];
let message = StringView::from(message);
session.dispatch_protocol_message(&message);
session.dispatch_protocol_message(message);
// The following commented out block seems to act similarly to
// schedule_pause_on_next_statement. I'm not sure if they have the exact same
@ -2653,7 +2653,7 @@ fn inspector_schedule_pause_on_next_statement() {
let reason = StringView::from(&reason[..]);
let detail = b"";
let detail = StringView::from(&detail[..]);
session.schedule_pause_on_next_statement(&reason, &detail);
session.schedule_pause_on_next_statement(reason, detail);
assert_eq!(channel.count_send_response, 1);
assert_eq!(channel.count_send_notification, 0);
@ -2728,7 +2728,7 @@ fn inspector_console_api_message() {
let name = b"";
let name_view = StringView::from(&name[..]);
inspector.context_created(context, 1, &name_view);
inspector.context_created(context, 1, name_view);
let source = r#"
console.log("one");

2
third_party/jinja2 vendored

@ -1 +1 @@
Subproject commit b41863e42637544c2941b574c7877d3e1f663e25
Subproject commit 3f90fa05c85718505e28c9c3426c1ba52843b9b7

2
third_party/zlib vendored

@ -1 +1 @@
Subproject commit c2eb8a7f7a0fa7884234ebc1b836644084ccbec9
Subproject commit 21c6af6f18e5ad9c3b9d103f8cfdbf926ca35f7c

@ -1 +1 @@
Subproject commit 8bf2cd1b9f11b215fed4bbf9cbb9848c36fb4c6d
Subproject commit 116e3ee70d1877ee7d92e0d8bfdf9420b773cd43

View File

@ -18,7 +18,7 @@ except ImportError: # For Py3 compatibility
from urllib.error import HTTPError, URLError
from urllib.request import urlopen
URL = "https://github.com/denoland/ninja_gn_binaries/archive/20200313.tar.gz"
URL = "https://github.com/denoland/ninja_gn_binaries/archive/20200506.tar.gz"
DIR = None

View File

@ -1,7 +1,8 @@
# WARNING: This is not an automated tool! This is just some commands to copy and
# paste manually to upgrade V8.
export COMMITDATE=2020-03-12T13:37:01.000Z
export BRANCH=20200605_rusty_v8
export COMMITDATE=2020-05-05T17:39:10.000Z
git submodule foreach 'git remote rm upstream; true' &&
git -C build remote add upstream https://chromium.googlesource.com/chromium/src/build &&
@ -10,6 +11,5 @@ git submodule foreach 'git remote add upstream `git remote get-url origin`; true
git submodule foreach 'git remote update' &&
git submodule foreach 'export SHA=`git log upstream/master -n1 --until=$COMMITDATE --pretty=%H` && git merge $SHA -m "Merge commit $SHA from `git remote get-url upstream`"'
export BRANCH=20200313_rusty_v8
git -C build push git@github.com:denoland/chromium_build HEAD:refs/heads/$BRANCH
git -C buildtools push git@github.com:denoland/chromium_buildtools HEAD:refs/heads/$BRANCH

2
v8

@ -1 +1 @@
Subproject commit 3f53e61b1c062fc59791b04e32f7cdea69591ee9
Subproject commit 119b195598ed20a1fa4313810665fa40d98c93aa