 Chromium Code Reviews
 Chromium Code Reviews Issue 2321443002:
  [wasm] Call the wasm interpreter from the wasm-code-fuzzer.  (Closed)
    
  
    Issue 2321443002:
  [wasm] Call the wasm interpreter from the wasm-code-fuzzer.  (Closed) 
  | Index: src/wasm/wasm-module.h | 
| diff --git a/src/wasm/wasm-module.h b/src/wasm/wasm-module.h | 
| index f3b9b8c15c68784dfabd493e0ee7826a6ce0234e..70b743be2a428ba18cd44b8a97f9fc728afcc0a6 100644 | 
| --- a/src/wasm/wasm-module.h | 
| +++ b/src/wasm/wasm-module.h | 
| @@ -11,6 +11,7 @@ | 
| #include "src/handles.h" | 
| #include "src/parsing/preparse-data.h" | 
| +#include "src/wasm/wasm-interpreter.h" | 
| 
titzer
2016/09/09 08:58:59
If you move the one function, then I think you can
 
ahaas
2016/09/09 11:57:36
Removed.
 | 
| #include "src/wasm/wasm-opcodes.h" | 
| #include "src/wasm/wasm-result.h" | 
| @@ -417,14 +418,34 @@ Object* GetOwningWasmInstance(Object* undefined, Code* code); | 
| namespace testing { | 
| +// Decodes the given encoded module. | 
| +const WasmModule* DecodeWasmModuleForTesting(Isolate* isolate, Zone* zone, | 
| + ErrorThrower& thrower, | 
| + const byte* module_start, | 
| + const byte* module_end, | 
| + ModuleOrigin origin); | 
| + | 
| +// Instantiates a module without any imports and exports. | 
| +const Handle<JSObject> InstantiateModuleForTesting(Isolate* isolate, | 
| + ErrorThrower& thrower, | 
| + const WasmModule* module); | 
| + | 
| +int32_t CallWasmFunctionForTesting(Isolate* isolate, Handle<JSObject> instance, | 
| + ErrorThrower& thrower, const char* name, | 
| + int argc, Handle<Object> argv[], | 
| + bool asm_js = false); | 
| + | 
| // Decode, verify, and run the function labeled "main" in the | 
| // given encoded module. The module should have no imports. | 
| int32_t CompileAndRunWasmModule(Isolate* isolate, const byte* module_start, | 
| const byte* module_end, bool asm_js = false); | 
| -int32_t CallFunction(Isolate* isolate, Handle<JSObject> instance, | 
| - ErrorThrower* thrower, const char* name, int argc, | 
| - Handle<Object> argv[], bool asm_js = false); | 
| +// Interprets the given module, starting at the function specified by | 
| +// {function_index}. The return type of the function has to be int32. The module | 
| +// should not have any imports or exports | 
| +int32_t InterpretWasmModule(Isolate* isolate, ErrorThrower& thrower, | 
| 
titzer
2016/09/09 08:58:59
Move this method to wasm-interpreter.h?
 
ahaas
2016/09/09 11:57:36
I moved the code to the new file test/cctest/wasm/
 | 
| + const WasmModule* module, int function_index, | 
| + WasmVal* args); | 
| } // namespace testing | 
| } // namespace wasm | 
| } // namespace internal |