0
0
Fork 0
mirror of https://github.com/denoland/rusty_v8.git synced 2024-11-24 15:19:31 -05:00

Fix compilation for 32-bit targets (#1050)

This commit is contained in:
Will Glozer 2022-08-21 13:46:43 +09:00 committed by GitHub
parent a9595da180
commit fa01b39f32
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 18 additions and 2 deletions

View file

@ -22,6 +22,11 @@
using namespace support;
template<typename T>
constexpr size_t align_to(size_t size) {
return (size + sizeof(T) - 1) & ~(sizeof(T) - 1);
}
static_assert(sizeof(two_pointers_t) ==
sizeof(std::shared_ptr<v8::BackingStore>),
"std::shared_ptr<v8::BackingStore> size mismatch");
@ -40,7 +45,7 @@ static_assert(sizeof(v8::PromiseRejectMessage) == sizeof(size_t) * 3,
static_assert(sizeof(v8::Locker) == sizeof(size_t) * 2, "Locker size mismatch");
static_assert(sizeof(v8::ScriptCompiler::Source) <= sizeof(size_t) * 8,
static_assert(sizeof(v8::ScriptCompiler::Source) == align_to<size_t>(sizeof(size_t) * 6 + sizeof(int) * 3),
"Source size mismatch");
static_assert(sizeof(v8::FunctionCallbackInfo<v8::Value>) == sizeof(size_t) * 3,

View file

@ -1,4 +1,5 @@
// Copyright 2019-2021 the Deno authors. All rights reserved. MIT license.
use std::os::raw::c_int;
use std::{marker::PhantomData, mem::MaybeUninit};
use crate::Function;
@ -61,7 +62,17 @@ extern "C" {
/// Source code which can then be compiled to a UnboundScript or Script.
#[repr(C)]
#[derive(Debug)]
pub struct Source([usize; 8]);
pub struct Source {
_source_string: usize,
_resource_name: usize,
_resource_line_offset: c_int,
_resource_column_offset: c_int,
_resource_options: c_int,
_source_map_url: usize,
_host_defined_options: usize,
_cached_data: usize,
_consume_cache_task: usize,
}
/// Compilation data that the embedder can cache and pass back to speed up future
/// compilations. The data is produced if the CompilerOptions passed to the compilation