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

Unified Diff: src/wasm/wasm-objects.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.cc ('k') | test/cctest/wasm/test-run-wasm-module.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/wasm/wasm-objects.cc
diff --git a/src/wasm/wasm-objects.cc b/src/wasm/wasm-objects.cc
index 967b68adc993c4182d6a3660c54243a406cad745..0137c87abc887284118bfee9dc5c12260112c29d 100644
--- a/src/wasm/wasm-objects.cc
+++ b/src/wasm/wasm-objects.cc
@@ -476,21 +476,13 @@ int32_t WasmMemoryObject::Grow(Isolate* isolate,
Handle<JSArrayBuffer> new_buffer;
// Return current size if grow by 0.
if (pages == 0) {
- // Even for pages == 0, we need to attach a new JSArrayBuffer and neuter the
- // old one to be spec compliant.
- if (!old_buffer.is_null() && old_buffer->backing_store() != nullptr) {
+ // Even for pages == 0, we need to attach a new JSArrayBuffer with the same
+ // backing store and neuter the old one to be spec compliant.
+ if (!old_buffer.is_null() && old_size != 0) {
new_buffer = SetupArrayBuffer(isolate, old_buffer->backing_store(),
old_size, old_buffer->is_external(),
old_buffer->has_guard_region());
memory_object->set_buffer(*new_buffer);
- old_buffer->set_is_neuterable(true);
- if (!old_buffer->has_guard_region()) {
- old_buffer->set_is_external(true);
- isolate->heap()->UnregisterArrayBuffer(*old_buffer);
- }
- // Neuter but don't free the memory because it is now being used by
- // new_buffer.
- old_buffer->Neuter();
}
DCHECK_EQ(0, old_size % WasmModule::kPageSize);
return old_size / WasmModule::kPageSize;
« no previous file with comments | « src/wasm/wasm-module.cc ('k') | test/cctest/wasm/test-run-wasm-module.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698