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

Side by Side Diff: test/cctest/wasm/test-run-wasm-module.cc

Issue 2629523007: [wasm] JS-API: enable WebAssembly.instantiate tests; fix LinkError (Closed)
Patch Set: initialize module_ upfront Created 3 years, 11 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 unified diff | Download patch
OLDNEW
1 // Copyright 2015 the V8 project authors. All rights reserved. 1 // Copyright 2015 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include <stdlib.h> 5 #include <stdlib.h>
6 #include <string.h> 6 #include <string.h>
7 7
8 #include "src/snapshot/code-serializer.h" 8 #include "src/snapshot/code-serializer.h"
9 #include "src/version.h" 9 #include "src/version.h"
10 #include "src/wasm/module-decoder.h" 10 #include "src/wasm/module-decoder.h"
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after
233 v8::MaybeLocal<v8::WasmCompiledModule> deserialized = 233 v8::MaybeLocal<v8::WasmCompiledModule> deserialized =
234 v8::WasmCompiledModule::DeserializeOrCompile( 234 v8::WasmCompiledModule::DeserializeOrCompile(
235 current_isolate_v8(), serialized_bytes(), wire_bytes()); 235 current_isolate_v8(), serialized_bytes(), wire_bytes());
236 return deserialized; 236 return deserialized;
237 } 237 }
238 238
239 void DeserializeAndRun() { 239 void DeserializeAndRun() {
240 ErrorThrower thrower(current_isolate(), ""); 240 ErrorThrower thrower(current_isolate(), "");
241 v8::Local<v8::WasmCompiledModule> deserialized_module; 241 v8::Local<v8::WasmCompiledModule> deserialized_module;
242 CHECK(Deserialize().ToLocal(&deserialized_module)); 242 CHECK(Deserialize().ToLocal(&deserialized_module));
243 Handle<JSObject> module_object = 243 Handle<WasmModuleObject> module_object = Handle<WasmModuleObject>::cast(
244 Handle<JSObject>::cast(v8::Utils::OpenHandle(*deserialized_module)); 244 v8::Utils::OpenHandle(*deserialized_module));
245 { 245 {
246 DisallowHeapAllocation assume_no_gc; 246 DisallowHeapAllocation assume_no_gc;
247 Handle<WasmCompiledModule> compiled_part( 247 Handle<WasmCompiledModule> compiled_part(
248 WasmCompiledModule::cast(module_object->GetInternalField(0)), 248 WasmCompiledModule::cast(module_object->GetInternalField(0)),
249 current_isolate()); 249 current_isolate());
250 CHECK_EQ(memcmp(compiled_part->module_bytes()->GetCharsAddress(), 250 CHECK_EQ(memcmp(compiled_part->module_bytes()->GetCharsAddress(),
251 wire_bytes().first, wire_bytes().second), 251 wire_bytes().first, wire_bytes().second),
252 0); 252 0);
253 } 253 }
254 Handle<JSObject> instance = 254 Handle<JSObject> instance =
(...skipping 656 matching lines...) Expand 10 before | Expand all | Expand 10 after
911 }; 911 };
912 912
913 testing::CompileInstantiateWasmModuleForTesting(isolate, &thrower, data, 913 testing::CompileInstantiateWasmModuleForTesting(isolate, &thrower, data,
914 data + arraysize(data), 914 data + arraysize(data),
915 ModuleOrigin::kWasmOrigin); 915 ModuleOrigin::kWasmOrigin);
916 // It should be possible to instantiate this module. 916 // It should be possible to instantiate this module.
917 CHECK(!thrower.error()); 917 CHECK(!thrower.error());
918 } 918 }
919 Cleanup(); 919 Cleanup();
920 } 920 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698