mirror of
https://github.com/denoland/rusty_v8.git
synced 2024-11-30 16:41:03 -05:00
Fix compilation for 32-bit targets (#1050)
This commit is contained in:
parent
a9595da180
commit
fa01b39f32
2 changed files with 18 additions and 2 deletions
|
@ -22,6 +22,11 @@
|
||||||
|
|
||||||
using namespace support;
|
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) ==
|
static_assert(sizeof(two_pointers_t) ==
|
||||||
sizeof(std::shared_ptr<v8::BackingStore>),
|
sizeof(std::shared_ptr<v8::BackingStore>),
|
||||||
"std::shared_ptr<v8::BackingStore> size mismatch");
|
"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::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");
|
"Source size mismatch");
|
||||||
|
|
||||||
static_assert(sizeof(v8::FunctionCallbackInfo<v8::Value>) == sizeof(size_t) * 3,
|
static_assert(sizeof(v8::FunctionCallbackInfo<v8::Value>) == sizeof(size_t) * 3,
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
// Copyright 2019-2021 the Deno authors. All rights reserved. MIT license.
|
// Copyright 2019-2021 the Deno authors. All rights reserved. MIT license.
|
||||||
|
use std::os::raw::c_int;
|
||||||
use std::{marker::PhantomData, mem::MaybeUninit};
|
use std::{marker::PhantomData, mem::MaybeUninit};
|
||||||
|
|
||||||
use crate::Function;
|
use crate::Function;
|
||||||
|
@ -61,7 +62,17 @@ extern "C" {
|
||||||
/// Source code which can then be compiled to a UnboundScript or Script.
|
/// Source code which can then be compiled to a UnboundScript or Script.
|
||||||
#[repr(C)]
|
#[repr(C)]
|
||||||
#[derive(Debug)]
|
#[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
|
/// 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
|
/// compilations. The data is produced if the CompilerOptions passed to the compilation
|
||||||
|
|
Loading…
Reference in a new issue