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

Unified Diff: src/runtime/runtime-test.cc

Issue 2433273002: [wasm] Avoid double-serializing the wire bytes (Closed)
Patch Set: 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
Index: src/runtime/runtime-test.cc
diff --git a/src/runtime/runtime-test.cc b/src/runtime/runtime-test.cc
index 1f6efa168fcf89dbce5f4b4e1c2274da6b88aadc..272dc24d5eecb2201a6324fecbfe877474a632bc 100644
--- a/src/runtime/runtime-test.cc
+++ b/src/runtime/runtime-test.cc
@@ -754,15 +754,22 @@ RUNTIME_FUNCTION(Runtime_SerializeWasmModule) {
// Return undefined if unsuccessful.
RUNTIME_FUNCTION(Runtime_DeserializeWasmModule) {
HandleScope shs(isolate);
- DCHECK(args.length() == 1);
+ DCHECK(args.length() == 2);
CONVERT_ARG_HANDLE_CHECKED(JSArrayBuffer, buffer, 0);
+ CONVERT_ARG_HANDLE_CHECKED(JSArrayBuffer, wire_bytes, 1);
Address mem_start = static_cast<Address>(buffer->backing_store());
int mem_size = static_cast<int>(buffer->byte_length()->Number());
+ // DeserializeWasmModule will allocate. We assume JSArrayBuffer doesn't
+ // get relocated.
ScriptData sc(mem_start, mem_size);
MaybeHandle<FixedArray> maybe_compiled_module =
- WasmCompiledModuleSerializer::DeserializeWasmModule(isolate, &sc);
+ WasmCompiledModuleSerializer::DeserializeWasmModule(
+ isolate, &sc,
+ {reinterpret_cast<uint8_t*>(wire_bytes->backing_store()),
Yang 2016/10/20 06:46:17 I think it helps with readability if you use the V
Mircea Trofin 2016/10/20 07:22:30 Done.
+ static_cast<int>(wire_bytes->byte_length()->Number())});
+
Handle<FixedArray> compiled_module;
if (!maybe_compiled_module.ToHandle(&compiled_module)) {
return isolate->heap()->undefined_value();

Powered by Google App Engine
This is Rietveld 408576698