| OLD | NEW |
| 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 WASM_RUN_UTILS_H | 5 #ifndef WASM_RUN_UTILS_H |
| 6 #define WASM_RUN_UTILS_H | 6 #define WASM_RUN_UTILS_H |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 #include <stdlib.h> | 9 #include <stdlib.h> |
| 10 #include <string.h> | 10 #include <string.h> |
| (...skipping 596 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 607 // A helper class to build graphs from Wasm bytecode, generate machine | 607 // A helper class to build graphs from Wasm bytecode, generate machine |
| 608 // code, and run that code. | 608 // code, and run that code. |
| 609 template <typename ReturnType> | 609 template <typename ReturnType> |
| 610 class WasmRunner { | 610 class WasmRunner { |
| 611 public: | 611 public: |
| 612 WasmRunner(WasmExecutionMode execution_mode, | 612 WasmRunner(WasmExecutionMode execution_mode, |
| 613 MachineType p0 = MachineType::None(), | 613 MachineType p0 = MachineType::None(), |
| 614 MachineType p1 = MachineType::None(), | 614 MachineType p1 = MachineType::None(), |
| 615 MachineType p2 = MachineType::None(), | 615 MachineType p2 = MachineType::None(), |
| 616 MachineType p3 = MachineType::None()) | 616 MachineType p3 = MachineType::None()) |
| 617 : zone(&allocator_), | 617 : zone(&allocator_, ZONE_NAME), |
| 618 compiled_(false), | 618 compiled_(false), |
| 619 signature_(MachineTypeForC<ReturnType>() == MachineType::None() ? 0 : 1, | 619 signature_(MachineTypeForC<ReturnType>() == MachineType::None() ? 0 : 1, |
| 620 GetParameterCount(p0, p1, p2, p3), storage_), | 620 GetParameterCount(p0, p1, p2, p3), storage_), |
| 621 compiler_(&signature_, execution_mode) { | 621 compiler_(&signature_, execution_mode) { |
| 622 InitSigStorage(p0, p1, p2, p3); | 622 InitSigStorage(p0, p1, p2, p3); |
| 623 } | 623 } |
| 624 | 624 |
| 625 WasmRunner(TestingModule* module, MachineType p0 = MachineType::None(), | 625 WasmRunner(TestingModule* module, MachineType p0 = MachineType::None(), |
| 626 MachineType p1 = MachineType::None(), | 626 MachineType p1 = MachineType::None(), |
| 627 MachineType p2 = MachineType::None(), | 627 MachineType p2 = MachineType::None(), |
| 628 MachineType p3 = MachineType::None()) | 628 MachineType p3 = MachineType::None()) |
| 629 : zone(&allocator_), | 629 : zone(&allocator_, ZONE_NAME), |
| 630 compiled_(false), | 630 compiled_(false), |
| 631 signature_(MachineTypeForC<ReturnType>() == MachineType::None() ? 0 : 1, | 631 signature_(MachineTypeForC<ReturnType>() == MachineType::None() ? 0 : 1, |
| 632 GetParameterCount(p0, p1, p2, p3), storage_), | 632 GetParameterCount(p0, p1, p2, p3), storage_), |
| 633 compiler_(&signature_, module) { | 633 compiler_(&signature_, module) { |
| 634 DCHECK(module); | 634 DCHECK(module); |
| 635 InitSigStorage(p0, p1, p2, p3); | 635 InitSigStorage(p0, p1, p2, p3); |
| 636 } | 636 } |
| 637 | 637 |
| 638 void InitSigStorage(MachineType p0, MachineType p1, MachineType p2, | 638 void InitSigStorage(MachineType p0, MachineType p1, MachineType p2, |
| 639 MachineType p3) { | 639 MachineType p3) { |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 784 // interpreter. | 784 // interpreter. |
| 785 #define WASM_EXEC_TEST(name) \ | 785 #define WASM_EXEC_TEST(name) \ |
| 786 void RunWasm_##name(WasmExecutionMode execution_mode); \ | 786 void RunWasm_##name(WasmExecutionMode execution_mode); \ |
| 787 TEST(RunWasmCompiled_##name) { RunWasm_##name(kExecuteCompiled); } \ | 787 TEST(RunWasmCompiled_##name) { RunWasm_##name(kExecuteCompiled); } \ |
| 788 TEST(RunWasmInterpreted_##name) { RunWasm_##name(kExecuteInterpreted); } \ | 788 TEST(RunWasmInterpreted_##name) { RunWasm_##name(kExecuteInterpreted); } \ |
| 789 void RunWasm_##name(WasmExecutionMode execution_mode) | 789 void RunWasm_##name(WasmExecutionMode execution_mode) |
| 790 | 790 |
| 791 } // namespace | 791 } // namespace |
| 792 | 792 |
| 793 #endif | 793 #endif |
| OLD | NEW |