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

Unified Diff: test/cctest/wasm/test-run-wasm-module.cc

Issue 2762273002: Reland of [wasm] Transferrable modules (Closed)
Patch Set: Created 3 years, 9 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/value-serializer.cc ('k') | test/unittests/value-serializer-unittest.cc » ('j') | 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 4e79e422f08cce6cfcfd4996ffc5c8e52bc8ed94..70c0eb012960087362c399a737089a714a5943b7 100644
--- a/test/cctest/wasm/test-run-wasm-module.cc
+++ b/test/cctest/wasm/test-run-wasm-module.cc
@@ -467,6 +467,43 @@
}
Cleanup(test.current_isolate());
Cleanup();
+}
+
+TEST(TransferrableWasmModules) {
+ v8::internal::AccountingAllocator allocator;
+ Zone zone(&allocator, ZONE_NAME);
+
+ ZoneBuffer buffer(&zone);
+ WasmSerializationTest::BuildWireBytes(&zone, &buffer);
+
+ Isolate* from_isolate = CcTest::InitIsolateOnce();
+ ErrorThrower thrower(from_isolate, "");
+ std::vector<v8::WasmCompiledModule::TransferrableModule> store;
+ {
+ HandleScope scope(from_isolate);
+ testing::SetupIsolateForWasmModule(from_isolate);
+
+ MaybeHandle<WasmModuleObject> module_object = SyncCompile(
+ from_isolate, &thrower, ModuleWireBytes(buffer.begin(), buffer.end()));
+ v8::Local<v8::WasmCompiledModule> v8_module =
+ v8::Local<v8::WasmCompiledModule>::Cast(v8::Utils::ToLocal(
+ Handle<JSObject>::cast(module_object.ToHandleChecked())));
+ store.push_back(v8_module->GetTransferrableModule());
+ }
+
+ {
+ v8::Isolate::CreateParams create_params;
+ create_params.array_buffer_allocator =
+ from_isolate->array_buffer_allocator();
+ v8::Isolate* to_isolate = v8::Isolate::New(create_params);
+ v8::HandleScope new_scope(to_isolate);
+ v8::Local<v8::Context> deserialization_context =
+ v8::Context::New(to_isolate);
+ deserialization_context->Enter();
+ v8::MaybeLocal<v8::WasmCompiledModule> mod =
+ v8::WasmCompiledModule::FromTransferrableModule(to_isolate, store[0]);
+ CHECK(!mod.IsEmpty());
+ }
}
TEST(MemorySize) {
« no previous file with comments | « src/value-serializer.cc ('k') | test/unittests/value-serializer-unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698