@@ -267,6 +267,7 @@ std::unique_ptr<BackingStore> BackingStore::Allocate(
267267
268268 auto result = new BackingStore (buffer_start, // start
269269 byte_length, // length
270+ byte_length, // max length
270271 byte_length, // capacity
271272 shared, // shared
272273 ResizableFlag::kNotResizable , // resizable
@@ -305,8 +306,9 @@ std::unique_ptr<BackingStore> BackingStore::TryAllocateWasmMemory(
305306 maximum_pages = std::min (engine_max_pages, maximum_pages);
306307
307308 auto result = TryAllocateAndPartiallyCommitMemory (
308- isolate, initial_pages * wasm::kWasmPageSize , wasm::kWasmPageSize ,
309- initial_pages, maximum_pages, true , shared);
309+ isolate, initial_pages * wasm::kWasmPageSize ,
310+ maximum_pages * wasm::kWasmPageSize , wasm::kWasmPageSize , initial_pages,
311+ maximum_pages, true , shared);
310312 // Shared Wasm memories need an anchor for the memory object list.
311313 if (result && shared == SharedFlag::kShared ) {
312314 result->type_specific_data_ .shared_wasm_memory_data =
@@ -336,9 +338,9 @@ void BackingStore::ReleaseReservation(uint64_t num_bytes) {
336338}
337339
338340std::unique_ptr<BackingStore> BackingStore::TryAllocateAndPartiallyCommitMemory (
339- Isolate* isolate, size_t byte_length, size_t page_size ,
340- size_t initial_pages , size_t maximum_pages, bool is_wasm_memory ,
341- SharedFlag shared) {
341+ Isolate* isolate, size_t byte_length, size_t max_byte_length ,
342+ size_t page_size , size_t initial_pages, size_t maximum_pages ,
343+ bool is_wasm_memory, SharedFlag shared) {
342344 // Enforce engine limitation on the maximum number of pages.
343345 if (maximum_pages > std::numeric_limits<size_t >::max () / page_size) {
344346 return nullptr ;
@@ -445,16 +447,17 @@ std::unique_ptr<BackingStore> BackingStore::TryAllocateAndPartiallyCommitMemory(
445447 ResizableFlag resizable =
446448 is_wasm_memory ? ResizableFlag::kNotResizable : ResizableFlag::kResizable ;
447449
448- auto result = new BackingStore (buffer_start, // start
449- byte_length, // length
450- byte_capacity, // capacity
451- shared, // shared
452- resizable, // resizable
453- is_wasm_memory, // is_wasm_memory
454- true , // free_on_destruct
455- guards, // has_guard_regions
456- false , // custom_deleter
457- false ); // empty_deleter
450+ auto result = new BackingStore (buffer_start, // start
451+ byte_length, // length
452+ max_byte_length, // max_byte_length
453+ byte_capacity, // capacity
454+ shared, // shared
455+ resizable, // resizable
456+ is_wasm_memory, // is_wasm_memory
457+ true , // free_on_destruct
458+ guards, // has_guard_regions
459+ false , // custom_deleter
460+ false ); // empty_deleter
458461
459462 TRACE_BS (
460463 " BSw:alloc bs=%p mem=%p (length=%zu, capacity=%zu, reservation=%zu)\n " ,
@@ -707,6 +710,7 @@ std::unique_ptr<BackingStore> BackingStore::WrapAllocation(
707710 SharedFlag shared, bool free_on_destruct) {
708711 auto result = new BackingStore (allocation_base, // start
709712 allocation_length, // length
713+ allocation_length, // max length
710714 allocation_length, // capacity
711715 shared, // shared
712716 ResizableFlag::kNotResizable , // resizable
@@ -728,6 +732,7 @@ std::unique_ptr<BackingStore> BackingStore::WrapAllocation(
728732 bool is_empty_deleter = (deleter == v8::BackingStore::EmptyDeleter);
729733 auto result = new BackingStore (allocation_base, // start
730734 allocation_length, // length
735+ allocation_length, // max length
731736 allocation_length, // capacity
732737 shared, // shared
733738 ResizableFlag::kNotResizable , // resizable
@@ -746,6 +751,7 @@ std::unique_ptr<BackingStore> BackingStore::EmptyBackingStore(
746751 SharedFlag shared) {
747752 auto result = new BackingStore (nullptr , // start
748753 0 , // length
754+ 0 , // max length
749755 0 , // capacity
750756 shared, // shared
751757 ResizableFlag::kNotResizable , // resizable
0 commit comments