Commit ef7e896d authored by clemensh's avatar clemensh Committed by Commit bot

[wasm] Set externally passed memory non neuterable

If at instantiation we get an existing ArrayBuffer, set it non
neuterable, because we embed the backing memory address in wasm code.

With this fix, all tests pass if validate-asm is set to default=true.

R=titzer@chromium.org
BUG=v8:4203

Review-Url: https://codereview.chromium.org/2441353003
Cr-Commit-Position: refs/heads/master@{#40536}
parent f2d278a9
......@@ -990,7 +990,10 @@ class WasmInstanceBuilder {
isolate_->counters()->wasm_min_mem_pages_count()->AddSample(min_mem_pages);
// TODO(wasm): re-enable counter for max_mem_pages when we use that field.
if (memory_.is_null() && min_mem_pages > 0) {
if (!memory_.is_null()) {
// Set externally passed ArrayBuffer non neuterable.
memory_->set_is_neuterable(false);
} else if (min_mem_pages > 0) {
memory_ = AllocateMemory(min_mem_pages);
if (memory_.is_null()) return nothing; // failed to allocate memory
}
......
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