Commit b350024e authored by Andreas Haas's avatar Andreas Haas Committed by Commit Bot

[cleanup] Remove --wasm-grow-shaerd-memory

R=gdeepti@chromium.org

Bug: v8:11384
Change-Id: Icbf4ec5014bb1553da618b5958a3e1d5f487cfde
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2700037Reviewed-by: 's avatarDeepti Gandluri <gdeepti@chromium.org>
Commit-Queue: Andreas Haas <ahaas@chromium.org>
Cr-Commit-Position: refs/heads/master@{#72856}
parent 6c922e39
......@@ -932,9 +932,6 @@ DEFINE_DEBUG_BOOL(trace_wasm_lazy_compilation, false,
"trace lazy compilation of wasm functions")
DEFINE_BOOL(wasm_lazy_validation, false,
"enable lazy validation for lazily compiled wasm functions")
DEFINE_BOOL(wasm_grow_shared_memory, true,
"allow growing shared WebAssembly memory objects")
DEFINE_BOOL(wasm_simd_post_mvp, false,
"allow experimental SIMD operations for prototyping that are not "
"included in the current proposal")
......
......@@ -858,7 +858,7 @@ MaybeHandle<WasmMemoryObject> WasmMemoryObject::New(Isolate* isolate,
// limits the number of memories that can be allocated, causing OOMs in many
// tests. For now, on 32-bit we never reserve more than initial, unless the
// memory is shared.
if (shared == SharedFlag::kNotShared || !FLAG_wasm_grow_shared_memory) {
if (shared == SharedFlag::kNotShared) {
heuristic_maximum = initial;
}
#endif
......@@ -936,30 +936,27 @@ int32_t WasmMemoryObject::Grow(Isolate* isolate,
// Try to handle shared memory first.
if (old_buffer->is_shared()) {
if (FLAG_wasm_grow_shared_memory) {
base::Optional<size_t> result =
backing_store->GrowWasmMemoryInPlace(isolate, pages, maximum_pages);
// Shared memories can only be grown in place; no copying.
if (result.has_value()) {
BackingStore::BroadcastSharedWasmMemoryGrow(isolate, backing_store);
// Broadcasting the update should update this memory object too.
CHECK_NE(*old_buffer, memory_object->array_buffer());
size_t new_pages = result.value() + pages;
// If the allocation succeeded, then this can't possibly overflow:
size_t new_byte_length = new_pages * wasm::kWasmPageSize;
// This is a less than check, as it is not guaranteed that the SAB
// length here will be equal to the stashed length above as calls to
// grow the same memory object can come in from different workers.
// It is also possible that a call to Grow was in progress when
// handling this call.
CHECK_LE(new_byte_length, memory_object->array_buffer().byte_length());
// As {old_pages} was read racefully, we return here the synchronized
// value provided by {GrowWasmMemoryInPlace}, to provide the atomic
// read-modify-write behavior required by the spec.
return static_cast<int32_t>(result.value()); // success
}
}
return -1;
base::Optional<size_t> result =
backing_store->GrowWasmMemoryInPlace(isolate, pages, maximum_pages);
// Shared memories can only be grown in place; no copying.
if (!result.has_value()) return -1;
BackingStore::BroadcastSharedWasmMemoryGrow(isolate, backing_store);
// Broadcasting the update should update this memory object too.
CHECK_NE(*old_buffer, memory_object->array_buffer());
size_t new_pages = result.value() + pages;
// If the allocation succeeded, then this can't possibly overflow:
size_t new_byte_length = new_pages * wasm::kWasmPageSize;
// This is a less than check, as it is not guaranteed that the SAB
// length here will be equal to the stashed length above as calls to
// grow the same memory object can come in from different workers.
// It is also possible that a call to Grow was in progress when
// handling this call.
CHECK_LE(new_byte_length, memory_object->array_buffer().byte_length());
// As {old_pages} was read racefully, we return here the synchronized
// value provided by {GrowWasmMemoryInPlace}, to provide the atomic
// read-modify-write behavior required by the spec.
return static_cast<int32_t>(result.value()); // success
}
base::Optional<size_t> result =
......
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