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

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

Issue 2433273002: [wasm] Avoid double-serializing the wire bytes (Closed)
Patch Set: formatting 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/runtime/runtime.h ('k') | src/snapshot/code-serializer.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/runtime/runtime-test.cc
diff --git a/src/runtime/runtime-test.cc b/src/runtime/runtime-test.cc
index 1f6efa168fcf89dbce5f4b4e1c2274da6b88aadc..7d9e90450bf6dc69b1e4eccaf3f5bbddf1e3d846 100644
--- a/src/runtime/runtime-test.cc
+++ b/src/runtime/runtime-test.cc
@@ -754,15 +754,23 @@ 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,
+ Vector<const uint8_t>(
+ reinterpret_cast<uint8_t*>(wire_bytes->backing_store()),
titzer 2016/10/20 08:32:08 This raw pointer is unsafe unless the buffer is ex
Mircea Trofin 2016/10/20 16:06:41 Done, and added mlippautz to double-check this is
+ static_cast<int>(wire_bytes->byte_length()->Number())));
+
Handle<FixedArray> compiled_module;
if (!maybe_compiled_module.ToHandle(&compiled_module)) {
return isolate->heap()->undefined_value();
« no previous file with comments | « src/runtime/runtime.h ('k') | src/snapshot/code-serializer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698