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

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

Issue 2748473004: [wasm] Transferrable modules (Closed)
Patch Set: Transferrable modules 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
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 a3dd35713dfb23ca4c54fdd2a978716de1b8e544..b0d0fd2cccdd7c4dabf071bfccf0c484c3c95ff7 100644
--- a/test/cctest/wasm/test-run-wasm-module.cc
+++ b/test/cctest/wasm/test-run-wasm-module.cc
@@ -469,6 +469,43 @@ TEST(BlockWasmCodeGenAtDeserialization) {
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->AsTransferrableModule());
+ }
+
+ {
+ 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) {
{
// Initial memory size is 16, see wasm-module-builder.cc

Powered by Google App Engine
This is Rietveld 408576698