Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 #ifndef V8_WASM_MODULE_H_ | 5 #ifndef V8_WASM_MODULE_H_ |
| 6 #define V8_WASM_MODULE_H_ | 6 #define V8_WASM_MODULE_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "src/api.h" | 10 #include "src/api.h" |
| 11 #include "src/handles.h" | 11 #include "src/handles.h" |
| 12 #include "src/parsing/preparse-data.h" | 12 #include "src/parsing/preparse-data.h" |
| 13 | 13 |
| 14 #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.
| |
| 14 #include "src/wasm/wasm-opcodes.h" | 15 #include "src/wasm/wasm-opcodes.h" |
| 15 #include "src/wasm/wasm-result.h" | 16 #include "src/wasm/wasm-result.h" |
| 16 | 17 |
| 17 namespace v8 { | 18 namespace v8 { |
| 18 namespace internal { | 19 namespace internal { |
| 19 | 20 |
| 20 namespace compiler { | 21 namespace compiler { |
| 21 class CallDescriptor; | 22 class CallDescriptor; |
| 22 class WasmCompilationUnit; | 23 class WasmCompilationUnit; |
| 23 } | 24 } |
| (...skipping 386 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 410 | 411 |
| 411 // Assumed to be called with a code object associated to a wasm module instance. | 412 // Assumed to be called with a code object associated to a wasm module instance. |
| 412 // Intended to be called from runtime functions. | 413 // Intended to be called from runtime functions. |
| 413 // Returns undefined if the runtime support was not setup, nullptr if the | 414 // Returns undefined if the runtime support was not setup, nullptr if the |
| 414 // instance | 415 // instance |
| 415 // was collected, or the instance object owning the Code object | 416 // was collected, or the instance object owning the Code object |
| 416 Object* GetOwningWasmInstance(Object* undefined, Code* code); | 417 Object* GetOwningWasmInstance(Object* undefined, Code* code); |
| 417 | 418 |
| 418 namespace testing { | 419 namespace testing { |
| 419 | 420 |
| 421 // Decodes the given encoded module. | |
| 422 const WasmModule* DecodeWasmModuleForTesting(Isolate* isolate, Zone* zone, | |
| 423 ErrorThrower& thrower, | |
| 424 const byte* module_start, | |
| 425 const byte* module_end, | |
| 426 ModuleOrigin origin); | |
| 427 | |
| 428 // Instantiates a module without any imports and exports. | |
| 429 const Handle<JSObject> InstantiateModuleForTesting(Isolate* isolate, | |
| 430 ErrorThrower& thrower, | |
| 431 const WasmModule* module); | |
| 432 | |
| 433 int32_t CallWasmFunctionForTesting(Isolate* isolate, Handle<JSObject> instance, | |
| 434 ErrorThrower& thrower, const char* name, | |
| 435 int argc, Handle<Object> argv[], | |
| 436 bool asm_js = false); | |
| 437 | |
| 420 // Decode, verify, and run the function labeled "main" in the | 438 // Decode, verify, and run the function labeled "main" in the |
| 421 // given encoded module. The module should have no imports. | 439 // given encoded module. The module should have no imports. |
| 422 int32_t CompileAndRunWasmModule(Isolate* isolate, const byte* module_start, | 440 int32_t CompileAndRunWasmModule(Isolate* isolate, const byte* module_start, |
| 423 const byte* module_end, bool asm_js = false); | 441 const byte* module_end, bool asm_js = false); |
| 424 | 442 |
| 425 int32_t CallFunction(Isolate* isolate, Handle<JSObject> instance, | 443 // Interprets the given module, starting at the function specified by |
| 426 ErrorThrower* thrower, const char* name, int argc, | 444 // {function_index}. The return type of the function has to be int32. The module |
| 427 Handle<Object> argv[], bool asm_js = false); | 445 // should not have any imports or exports |
| 446 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/
| |
| 447 const WasmModule* module, int function_index, | |
| 448 WasmVal* args); | |
| 428 } // namespace testing | 449 } // namespace testing |
| 429 } // namespace wasm | 450 } // namespace wasm |
| 430 } // namespace internal | 451 } // namespace internal |
| 431 } // namespace v8 | 452 } // namespace v8 |
| 432 | 453 |
| 433 #endif // V8_WASM_MODULE_H_ | 454 #endif // V8_WASM_MODULE_H_ |
| OLD | NEW |