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

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

Issue 2490663002: [wasm] Move all heap-allocated WASM structures into wasm-objects.h. (Closed)
Patch Set: [wasm] Move all heap-allocated WASM structures into wasm-objects.h. Created 4 years, 1 month 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
« no previous file with comments | « src/wasm/wasm-objects.cc ('k') | test/cctest/wasm/wasm-run-utils.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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"
11 #include "src/wasm/wasm-macro-gen.h" 11 #include "src/wasm/wasm-macro-gen.h"
12 #include "src/wasm/wasm-module-builder.h" 12 #include "src/wasm/wasm-module-builder.h"
13 #include "src/wasm/wasm-module.h" 13 #include "src/wasm/wasm-module.h"
14 #include "src/wasm/wasm-objects.h"
14 #include "src/wasm/wasm-opcodes.h" 15 #include "src/wasm/wasm-opcodes.h"
15 16
16 #include "test/cctest/cctest.h" 17 #include "test/cctest/cctest.h"
17 #include "test/common/wasm/test-signatures.h" 18 #include "test/common/wasm/test-signatures.h"
18 #include "test/common/wasm/wasm-module-runner.h" 19 #include "test/common/wasm/wasm-module-runner.h"
19 20
20 using namespace v8::base; 21 using namespace v8::base;
21 using namespace v8::internal; 22 using namespace v8::internal;
22 using namespace v8::internal::compiler; 23 using namespace v8::internal::compiler;
23 using namespace v8::internal::wasm; 24 using namespace v8::internal::wasm;
(...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after
310 false, kWasmOrigin); 311 false, kWasmOrigin);
311 CHECK(!decoding_result.failed()); 312 CHECK(!decoding_result.failed());
312 313
313 Handle<WasmModuleWrapper> module_wrapper = WasmModuleWrapper::New( 314 Handle<WasmModuleWrapper> module_wrapper = WasmModuleWrapper::New(
314 serialization_isolate, const_cast<WasmModule*>(decoding_result.val)); 315 serialization_isolate, const_cast<WasmModule*>(decoding_result.val));
315 316
316 MaybeHandle<WasmCompiledModule> compiled_module = 317 MaybeHandle<WasmCompiledModule> compiled_module =
317 decoding_result.val->CompileFunctions(serialization_isolate, 318 decoding_result.val->CompileFunctions(serialization_isolate,
318 module_wrapper, &thrower); 319 module_wrapper, &thrower);
319 CHECK(!compiled_module.is_null()); 320 CHECK(!compiled_module.is_null());
320 Handle<JSObject> module_obj = CreateWasmModuleObject( 321 Handle<JSObject> module_obj = WasmModuleObject::New(
321 serialization_isolate, compiled_module.ToHandleChecked(), 322 serialization_isolate, compiled_module.ToHandleChecked());
322 ModuleOrigin::kWasmOrigin);
323 v8::Local<v8::Object> v8_module_obj = v8::Utils::ToLocal(module_obj); 323 v8::Local<v8::Object> v8_module_obj = v8::Utils::ToLocal(module_obj);
324 CHECK(v8_module_obj->IsWebAssemblyCompiledModule()); 324 CHECK(v8_module_obj->IsWebAssemblyCompiledModule());
325 325
326 v8::Local<v8::WasmCompiledModule> v8_compiled_module = 326 v8::Local<v8::WasmCompiledModule> v8_compiled_module =
327 v8_module_obj.As<v8::WasmCompiledModule>(); 327 v8_module_obj.As<v8::WasmCompiledModule>();
328 v8::Local<v8::String> uncompiled_bytes = 328 v8::Local<v8::String> uncompiled_bytes =
329 v8_compiled_module->GetWasmWireBytes(); 329 v8_compiled_module->GetWasmWireBytes();
330 bytes_size = static_cast<size_t>(uncompiled_bytes->Length()); 330 bytes_size = static_cast<size_t>(uncompiled_bytes->Length());
331 bytes = zone()->NewArray<uint8_t>(bytes_size); 331 bytes = zone()->NewArray<uint8_t>(bytes_size);
332 uncompiled_bytes->WriteOneByte(bytes, 0, uncompiled_bytes->Length(), 332 uncompiled_bytes->WriteOneByte(bytes, 0, uncompiled_bytes->Length(),
(...skipping 471 matching lines...) Expand 10 before | Expand all | Expand 10 after
804 testing::CompileInstantiateWasmModuleForTesting(isolate, &thrower, data, 804 testing::CompileInstantiateWasmModuleForTesting(isolate, &thrower, data,
805 data + arraysize(data), 805 data + arraysize(data),
806 ModuleOrigin::kWasmOrigin); 806 ModuleOrigin::kWasmOrigin);
807 if (thrower.error()) { 807 if (thrower.error()) {
808 thrower.Reify()->Print(); 808 thrower.Reify()->Print();
809 CHECK(false); 809 CHECK(false);
810 } 810 }
811 } 811 }
812 Cleanup(); 812 Cleanup();
813 } 813 }
OLDNEW
« no previous file with comments | « src/wasm/wasm-objects.cc ('k') | test/cctest/wasm/wasm-run-utils.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698