Commit f78a6778 authored by Clemens Hammacher's avatar Clemens Hammacher Committed by Commit Bot

[Liftoff] Store memory sizes as uint64_t

This prepares a reland of https://crrev.com/c/869468.

Drive-by: Add a static_assert, also to document why
kV8MaxWasmMemoryPages was chosed to be slightly below 2GB.

R=titzer@chromium.org
CC=bradnelson@chromium.org

Bug: v8:6600
Change-Id: I6417bec191803c791fa5b218024ebcfde27e2aea
Reviewed-on: https://chromium-review.googlesource.com/873912Reviewed-by: 's avatarBen Titzer <titzer@chromium.org>
Commit-Queue: Clemens Hammacher <clemensh@chromium.org>
Cr-Commit-Position: refs/heads/master@{#50692}
parent 9c5053bf
......@@ -115,23 +115,17 @@ class LiftoffCompiler {
: asm_(liftoff_asm),
call_desc_(call_desc),
env_(env),
min_size_(env_->module->initial_pages * wasm::kWasmPageSize),
max_size_((env_->module->has_maximum_pages
? env_->module->maximum_pages
: wasm::kV8MaxWasmMemoryPages) *
min_size_(uint64_t{env_->module->initial_pages} * wasm::kWasmPageSize),
max_size_(uint64_t{env_->module->has_maximum_pages
? env_->module->maximum_pages
: wasm::kV8MaxWasmMemoryPages} *
wasm::kWasmPageSize),
runtime_exception_support_(runtime_exception_support),
source_position_table_builder_(source_position_table_builder),
protected_instructions_(protected_instructions),
compilation_zone_(compilation_zone),
codegen_zone_(codegen_zone),
safepoint_table_builder_(compilation_zone_) {
// Check for overflow in max_size_.
DCHECK_EQ(max_size_, uint64_t{env_->module->has_maximum_pages
? env_->module->maximum_pages
: wasm::kV8MaxWasmMemoryPages} *
wasm::kWasmPageSize);
}
safepoint_table_builder_(compilation_zone_) {}
bool ok() const { return ok_; }
......@@ -1012,8 +1006,8 @@ class LiftoffCompiler {
compiler::CallDescriptor* const call_desc_;
compiler::ModuleEnv* const env_;
// {min_size_} and {max_size_} are cached values computed from the ModuleEnv.
const uint32_t min_size_;
const uint32_t max_size_;
const uint64_t min_size_;
const uint64_t max_size_;
const compiler::RuntimeExceptionSupport runtime_exception_support_;
bool ok_ = true;
std::vector<OutOfLineCode> out_of_line_code_;
......
......@@ -48,6 +48,8 @@ static_assert(kV8MaxWasmMemoryPages <= kSpecMaxWasmMemoryPages,
constexpr size_t kSpecMaxWasmTableSize = 0xFFFFFFFFu;
constexpr size_t kV8MaxWasmMemoryBytes = kV8MaxWasmMemoryPages * kWasmPageSize;
static_assert(kV8MaxWasmMemoryBytes <= std::numeric_limits<int32_t>::max(),
"max memory bytes should fit in int32_t");
constexpr uint64_t kWasmMaxHeapOffset =
static_cast<uint64_t>(
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment