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

Side by Side Diff: test/common/wasm/wasm-module-runner.h

Issue 2540133002: [wasm] Remove raw byte pointers from WasmModule (Closed)
Patch Set: Address comments Created 4 years 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 | « test/cctest/wasm/wasm-run-utils.h ('k') | test/common/wasm/wasm-module-runner.cc » ('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 2016 the V8 project authors. All rights reserved. 1 // Copyright 2016 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 #ifndef V8_WASM_MODULE_RUNNER_H_ 5 #ifndef V8_WASM_MODULE_RUNNER_H_
6 #define V8_WASM_MODULE_RUNNER_H_ 6 #define V8_WASM_MODULE_RUNNER_H_
7 7
8 #include "src/handles.h" 8 #include "src/handles.h"
9 #include "src/isolate.h" 9 #include "src/isolate.h"
10 #include "src/objects.h" 10 #include "src/objects.h"
11 #include "src/wasm/wasm-interpreter.h" 11 #include "src/wasm/wasm-interpreter.h"
12 #include "src/wasm/wasm-module.h" 12 #include "src/wasm/wasm-module.h"
13 #include "src/wasm/wasm-objects.h" 13 #include "src/wasm/wasm-objects.h"
14 #include "src/wasm/wasm-result.h" 14 #include "src/wasm/wasm-result.h"
15 #include "src/zone/zone.h" 15 #include "src/zone/zone.h"
16 16
17 namespace v8 { 17 namespace v8 {
18 namespace internal { 18 namespace internal {
19 namespace wasm { 19 namespace wasm {
20 namespace testing { 20 namespace testing {
21 21
22 // Decodes the given encoded module. 22 // Decodes the given encoded module.
23 const WasmModule* DecodeWasmModuleForTesting( 23 const WasmModule* DecodeWasmModuleForTesting(
24 Isolate* isolate, ErrorThrower* thrower, const byte* module_start, 24 Isolate* isolate, ErrorThrower* thrower, const byte* module_start,
25 const byte* module_end, ModuleOrigin origin, bool verify_functions = false); 25 const byte* module_end, ModuleOrigin origin, bool verify_functions = false);
26 26
27 // Instantiates a module without any imports and exports. 27 // Instantiates a module without any imports and exports.
28 const Handle<WasmInstanceObject> InstantiateModuleForTesting( 28 const Handle<WasmInstanceObject> InstantiateModuleForTesting(
29 Isolate* isolate, ErrorThrower* thrower, const WasmModule* module); 29 Isolate* isolate, ErrorThrower* thrower, const WasmModule* module,
30 const ModuleWireBytes& wire_bytes);
30 31
31 int32_t CallWasmFunctionForTesting(Isolate* isolate, Handle<JSObject> instance, 32 int32_t CallWasmFunctionForTesting(Isolate* isolate, Handle<JSObject> instance,
32 ErrorThrower* thrower, const char* name, 33 ErrorThrower* thrower, const char* name,
33 int argc, Handle<Object> argv[], 34 int argc, Handle<Object> argv[],
34 ModuleOrigin origin); 35 ModuleOrigin origin);
35 36
36 // Decode, verify, and run the function labeled "main" in the 37 // Decode, verify, and run the function labeled "main" in the
37 // given encoded module. The module should have no imports. 38 // given encoded module. The module should have no imports.
38 int32_t CompileAndRunWasmModule(Isolate* isolate, const byte* module_start, 39 int32_t CompileAndRunWasmModule(Isolate* isolate, const byte* module_start,
39 const byte* module_end, ModuleOrigin origin); 40 const byte* module_end, ModuleOrigin origin);
40 41
41 // Interprets the given module, starting at the function specified by 42 // Interprets the given module, starting at the function specified by
42 // {function_index}. The return type of the function has to be int32. The module 43 // {function_index}. The return type of the function has to be int32. The module
43 // should not have any imports or exports 44 // should not have any imports or exports
44 int32_t InterpretWasmModule(Isolate* isolate, ErrorThrower* thrower, 45 int32_t InterpretWasmModule(Isolate* isolate, ErrorThrower* thrower,
45 const WasmModule* module, int function_index, 46 const WasmModule* module,
46 WasmVal* args, bool* may_produced_nan); 47 const ModuleWireBytes& wire_bytes,
48 int function_index, WasmVal* args,
49 bool* may_produced_nan);
47 50
48 // Compiles WasmModule bytes and return an instance of the compiled module. 51 // Compiles WasmModule bytes and return an instance of the compiled module.
49 const Handle<WasmInstanceObject> CompileInstantiateWasmModuleForTesting( 52 const Handle<WasmInstanceObject> CompileInstantiateWasmModuleForTesting(
50 Isolate* isolate, ErrorThrower* thrower, const byte* module_start, 53 Isolate* isolate, ErrorThrower* thrower, const byte* module_start,
51 const byte* module_end, ModuleOrigin origin); 54 const byte* module_end, ModuleOrigin origin);
52 55
53 // Runs the module instance with arguments. 56 // Runs the module instance with arguments.
54 int32_t RunWasmModuleForTesting(Isolate* isolate, Handle<JSObject> instance, 57 int32_t RunWasmModuleForTesting(Isolate* isolate, Handle<JSObject> instance,
55 int argc, Handle<Object> argv[], 58 int argc, Handle<Object> argv[],
56 ModuleOrigin origin); 59 ModuleOrigin origin);
57 // Install function map, module symbol for testing 60 // Install function map, module symbol for testing
58 void SetupIsolateForWasmModule(Isolate* isolate); 61 void SetupIsolateForWasmModule(Isolate* isolate);
59 } // namespace testing 62 } // namespace testing
60 } // namespace wasm 63 } // namespace wasm
61 } // namespace internal 64 } // namespace internal
62 } // namespace v8 65 } // namespace v8
63 66
64 #endif // V8_WASM_MODULE_RUNNER_H_ 67 #endif // V8_WASM_MODULE_RUNNER_H_
OLDNEW
« no previous file with comments | « test/cctest/wasm/wasm-run-utils.h ('k') | test/common/wasm/wasm-module-runner.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698