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

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

Issue 2411263004: [wasm] API renames for wasm serialization/deserialization (Closed)
Patch Set: [wasm] API renames for wasm serialization/deserialization Created 4 years, 2 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/api.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 8a45955b8dafd9b5e4b500ce905f71ffe3396b27..2763588bb27e8e73c7ab1ac447948b1f8d69d130 100644
--- a/test/cctest/wasm/test-run-wasm-module.cc
+++ b/test/cctest/wasm/test-run-wasm-module.cc
@@ -212,17 +212,18 @@ TEST(Run_WasmModule_Serialization) {
v8::Local<v8::WasmCompiledModule> v8_compiled_module =
v8_module_obj.As<v8::WasmCompiledModule>();
v8::Local<v8::String> uncompiled_bytes =
- v8_compiled_module->GetUncompiledBytes();
+ v8_compiled_module->GetWasmWireBytes();
bytes_size = static_cast<size_t>(uncompiled_bytes->Length());
bytes = zone.NewArray<uint8_t>(uncompiled_bytes->Length());
uncompiled_bytes->WriteOneByte(bytes);
data = v8_compiled_module->Serialize();
}
- v8::WasmCompiledModule::UncompiledBytes uncompressed_bytes = {
- std::unique_ptr<const uint8_t[]>(const_cast<const uint8_t*>(bytes)),
- bytes_size};
+ v8::WasmCompiledModule::CallerOwnedBuffer wire_bytes = {
+ const_cast<const uint8_t*>(bytes), bytes_size};
+ v8::WasmCompiledModule::CallerOwnedBuffer serialized_bytes = {
+ data.first.get(), data.second};
v8::Isolate::CreateParams create_params;
create_params.array_buffer_allocator =
CcTest::InitIsolateOnce()->array_buffer_allocator();
@@ -230,9 +231,9 @@ TEST(Run_WasmModule_Serialization) {
for (int i = 0; i < 2; ++i) {
v8::Isolate* v8_isolate = v8::Isolate::New(create_params);
if (i == 1) {
- // Mess with the serialized data to force recompilation.
- data.first.reset();
- data.second = 0;
+ // Provide no serialized data to force recompilation.
+ serialized_bytes.first = nullptr;
+ serialized_bytes.second = 0;
}
{
v8::Isolate::Scope isolate_scope(v8_isolate);
@@ -242,8 +243,8 @@ TEST(Run_WasmModule_Serialization) {
isolate = reinterpret_cast<Isolate*>(v8_isolate);
testing::SetupIsolateForWasmModule(isolate);
v8::MaybeLocal<v8::WasmCompiledModule> deserialized =
- v8::WasmCompiledModule::DeserializeOrCompile(v8_isolate, data,
- uncompressed_bytes);
+ v8::WasmCompiledModule::DeserializeOrCompile(
+ v8_isolate, serialized_bytes, wire_bytes);
v8::Local<v8::WasmCompiledModule> compiled_module;
CHECK(deserialized.ToLocal(&compiled_module));
Handle<JSObject> module_object =
@@ -262,9 +263,6 @@ TEST(Run_WasmModule_Serialization) {
}
v8_isolate->Dispose();
}
- // Release, because we allocated the bytes with the zone allocator, and
- // that doesn't have a delete.
- uncompressed_bytes.first.release();
}
TEST(MemorySize) {
« no previous file with comments | « src/api.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698