Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1050)

Unified Diff: src/wasm/wasm-module.cc

Issue 2867233002: [wasm] Do not unregister an ArrayBuffer if it is already external (Closed)
Patch Set: Eric's review Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/wasm/wasm-module.h ('k') | src/wasm/wasm-objects.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/wasm/wasm-module.cc
diff --git a/src/wasm/wasm-module.cc b/src/wasm/wasm-module.cc
index f406ee5f83fd7c0bc5f2b4232e3c4ca5aeb0129a..b88a8d7e7ef58372c63a5993b5edeaf98f311d26 100644
--- a/src/wasm/wasm-module.cc
+++ b/src/wasm/wasm-module.cc
@@ -855,7 +855,7 @@ Handle<JSArrayBuffer> wasm::SetupArrayBuffer(Isolate* isolate,
buffer->set_is_wasm_buffer(true);
buffer->set_has_guard_region(enable_guard_regions);
- if (is_external) {
+ if (enable_guard_regions) {
// We mark the buffer as external if we allocated it here with guard
// pages. That means we need to arrange for it to be freed.
@@ -2231,7 +2231,8 @@ bool wasm::IsWasmCodegenAllowed(Isolate* isolate, Handle<Context> context) {
}
void wasm::DetachWebAssemblyMemoryBuffer(Isolate* isolate,
- Handle<JSArrayBuffer> buffer) {
+ Handle<JSArrayBuffer> buffer,
+ bool free_memory) {
int64_t byte_length =
buffer->byte_length()->IsNumber()
? static_cast<uint32_t>(buffer->byte_length()->Number())
@@ -2247,6 +2248,9 @@ void wasm::DetachWebAssemblyMemoryBuffer(Isolate* isolate,
}
buffer->set_is_neuterable(true);
buffer->Neuter();
+ // Neuter but do not free, as when pages == 0, the backing store is being used
+ // by the new buffer.
+ if (!free_memory) return;
if (has_guard_regions) {
base::OS::Free(backing_store, RoundUp(i::wasm::kWasmMaxHeapOffset,
base::OS::CommitPageSize()));
« no previous file with comments | « src/wasm/wasm-module.h ('k') | src/wasm/wasm-objects.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698