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

Unified Diff: test/cctest/wasm/test-run-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-objects.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/cctest/wasm/test-run-wasm-module.cc
diff --git a/test/cctest/wasm/test-run-wasm-module.cc b/test/cctest/wasm/test-run-wasm-module.cc
index 44476bec2f46f4a434963c4be5b741fa171f6a9e..99a86bd16a49074d9a6c566f4700838a9b6475fe 100644
--- a/test/cctest/wasm/test-run-wasm-module.cc
+++ b/test/cctest/wasm/test-run-wasm-module.cc
@@ -1112,6 +1112,7 @@ TEST(Run_WasmModule_Buffer_Externalized_GrowMem) {
void* backing_store = memory->backing_store();
uint64_t byte_length = NumberToSize(memory->byte_length());
uint32_t result = WasmMemoryObject::Grow(isolate, mem_obj, 4);
+ wasm::DetachWebAssemblyMemoryBuffer(isolate, memory, true);
CHECK_EQ(16, result);
if (!memory->has_guard_region()) {
isolate->array_buffer_allocator()->Free(backing_store, byte_length);
@@ -1133,3 +1134,24 @@ TEST(Run_WasmModule_Buffer_Externalized_GrowMem) {
}
Cleanup();
}
+
+TEST(Run_WasmModule_Buffer_Externalized_GrowMemMemSize) {
+ {
+ Isolate* isolate = CcTest::InitIsolateOnce();
+ HandleScope scope(isolate);
+ void* backing_store =
+ isolate->array_buffer_allocator()->Allocate(16 * WasmModule::kPageSize);
+ Handle<JSArrayBuffer> buffer = wasm::SetupArrayBuffer(
+ isolate, backing_store, 16 * WasmModule::kPageSize, false, false);
+ Handle<WasmMemoryObject> mem_obj =
+ WasmMemoryObject::New(isolate, buffer, 100);
+ v8::Utils::ToLocal(buffer)->Externalize();
+ int32_t result = WasmMemoryObject::Grow(isolate, mem_obj, 0);
+ wasm::DetachWebAssemblyMemoryBuffer(isolate, buffer, false);
+ CHECK_EQ(16, result);
+
+ isolate->array_buffer_allocator()->Free(backing_store,
+ 16 * WasmModule::kPageSize);
+ }
+ Cleanup();
+}
« no previous file with comments | « src/wasm/wasm-objects.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698