Skip to content

Commit

Permalink
chore: small clean ups (denoland#1073)
Browse files Browse the repository at this point in the history
  • Loading branch information
ry committed Sep 19, 2022
1 parent 5cc0a85 commit 0d1ada4
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 9 deletions.
6 changes: 6 additions & 0 deletions .gn
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,12 @@ default_args = {
v8_use_external_startup_data = false
v8_use_snapshot = true

# Ensure allocation of typed arrays and arraybuffers always goes through
# the embedder's ArrayBufferAllocator, otherwise small buffers get moved
# around by the garbage collector but embedders normally want them to have
# fixed addresses.
v8_typed_array_max_size_in_heap = 0

# To avoid test failure:
# Fatal error in ../../../v8/src/heap/read-only-spaces.cc, line 69
# Check failed: read_only_blob_checksum_ == snapshot_checksum (<unprintable>
Expand Down
6 changes: 0 additions & 6 deletions build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -204,12 +204,6 @@ fn build_v8() {
gn_args.push(r#"target_cpu="x86""#.to_string());
}

// Ensure allocation of typed arrays and arraybuffers always goes through
// the embedder's ArrayBufferAllocator, otherwise small buffers get moved
// around by the garbage collector but embedders normally want them to have
// fixed addresses.
gn_args.push(r#"v8_typed_array_max_size_in_heap=0"#.into());

let gn_root = env::var("CARGO_MANIFEST_DIR").unwrap();

let gn_out = maybe_gen(&gn_root, gn_args);
Expand Down
7 changes: 4 additions & 3 deletions src/binding.cc
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@

using namespace support;

template<typename T>
template <typename T>
constexpr size_t align_to(size_t size) {
return (size + sizeof(T) - 1) & ~(sizeof(T) - 1);
return (size + sizeof(T) - 1) & ~(sizeof(T) - 1);
}

static_assert(sizeof(two_pointers_t) ==
Expand All @@ -45,7 +45,8 @@ 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) == align_to<size_t>(sizeof(size_t) * 6 + sizeof(int) * 3),
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,
Expand Down

0 comments on commit 0d1ada4

Please sign in to comment.