| 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 <setjmp.h> | 8 #include <setjmp.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 #include <stdlib.h> | 10 #include <stdlib.h> |
| 11 #include <string.h> | 11 #include <string.h> |
| 12 #include <array> | 12 #include <array> |
| 13 #include <memory> | 13 #include <memory> |
| 14 | 14 |
| 15 #include "src/base/utils/random-number-generator.h" | 15 #include "src/base/utils/random-number-generator.h" |
| 16 #include "src/zone/accounting-allocator.h" | 16 #include "src/zone/accounting-allocator.h" |
| 17 | 17 |
| 18 #include "src/compiler/compiler-source-position-table.h" | 18 #include "src/compiler/compiler-source-position-table.h" |
| 19 #include "src/compiler/graph-visualizer.h" | 19 #include "src/compiler/graph-visualizer.h" |
| 20 #include "src/compiler/int64-lowering.h" | 20 #include "src/compiler/int64-lowering.h" |
| 21 #include "src/compiler/js-graph.h" | 21 #include "src/compiler/js-graph.h" |
| 22 #include "src/compiler/node.h" | 22 #include "src/compiler/node.h" |
| 23 #include "src/compiler/pipeline.h" | 23 #include "src/compiler/pipeline.h" |
| 24 #include "src/compiler/wasm-compiler.h" | 24 #include "src/compiler/wasm-compiler.h" |
| 25 #include "src/compiler/zone-stats.h" | 25 #include "src/compiler/zone-stats.h" |
| 26 #include "src/trap-handler/trap-handler.h" |
| 26 #include "src/wasm/function-body-decoder.h" | 27 #include "src/wasm/function-body-decoder.h" |
| 27 #include "src/wasm/wasm-external-refs.h" | 28 #include "src/wasm/wasm-external-refs.h" |
| 28 #include "src/wasm/wasm-interpreter.h" | 29 #include "src/wasm/wasm-interpreter.h" |
| 29 #include "src/wasm/wasm-js.h" | 30 #include "src/wasm/wasm-js.h" |
| 30 #include "src/wasm/wasm-macro-gen.h" | 31 #include "src/wasm/wasm-macro-gen.h" |
| 31 #include "src/wasm/wasm-module.h" | 32 #include "src/wasm/wasm-module.h" |
| 32 #include "src/wasm/wasm-objects.h" | 33 #include "src/wasm/wasm-objects.h" |
| 33 #include "src/wasm/wasm-opcodes.h" | 34 #include "src/wasm/wasm-opcodes.h" |
| 34 | 35 |
| 35 #include "src/zone/zone.h" | 36 #include "src/zone/zone.h" |
| (...skipping 743 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 779 // Declare static variable. | 780 // Declare static variable. |
| 780 jmp_buf WasmRunnerBase::jump_buffer; | 781 jmp_buf WasmRunnerBase::jump_buffer; |
| 781 | 782 |
| 782 // A macro to define tests that run in different engine configurations. | 783 // A macro to define tests that run in different engine configurations. |
| 783 #define WASM_EXEC_TEST(name) \ | 784 #define WASM_EXEC_TEST(name) \ |
| 784 void RunWasm_##name(WasmExecutionMode execution_mode); \ | 785 void RunWasm_##name(WasmExecutionMode execution_mode); \ |
| 785 TEST(RunWasmCompiled_##name) { RunWasm_##name(kExecuteCompiled); } \ | 786 TEST(RunWasmCompiled_##name) { RunWasm_##name(kExecuteCompiled); } \ |
| 786 TEST(RunWasmInterpreted_##name) { RunWasm_##name(kExecuteInterpreted); } \ | 787 TEST(RunWasmInterpreted_##name) { RunWasm_##name(kExecuteInterpreted); } \ |
| 787 void RunWasm_##name(WasmExecutionMode execution_mode) | 788 void RunWasm_##name(WasmExecutionMode execution_mode) |
| 788 | 789 |
| 789 #define WASM_EXEC_TEST_WITH_TRAP(name) \ | 790 #define WASM_EXEC_TEST_WITH_TRAP(name) \ |
| 790 void RunWasm_##name(WasmExecutionMode execution_mode); \ | 791 void RunWasm_##name(WasmExecutionMode execution_mode); \ |
| 791 TEST(RunWasmCompiled_##name) { RunWasm_##name(kExecuteCompiled); } \ | 792 TEST(RunWasmCompiled_##name) { \ |
| 792 void RunWasm_##name(WasmExecutionMode execution_mode); \ | 793 if (trap_handler::EnableTrapHandler()) { \ |
| 793 TEST(RunWasmCompiledWithTrapIf_##name) { \ | 794 return; \ |
| 794 bool trap_if = FLAG_wasm_trap_if; \ | 795 } \ |
| 795 FLAG_wasm_trap_if = true; \ | 796 RunWasm_##name(kExecuteCompiled); \ |
| 796 RunWasm_##name(kExecuteCompiled); \ | 797 } \ |
| 797 FLAG_wasm_trap_if = trap_if; \ | 798 TEST(RunWasmCompiledWithTrapIf_##name) { \ |
| 798 } \ | 799 if (trap_handler::EnableTrapHandler()) { \ |
| 799 TEST(RunWasmInterpreted_##name) { RunWasm_##name(kExecuteInterpreted); } \ | 800 return; \ |
| 801 } \ |
| 802 bool trap_if = FLAG_wasm_trap_if; \ |
| 803 FLAG_wasm_trap_if = true; \ |
| 804 RunWasm_##name(kExecuteCompiled); \ |
| 805 FLAG_wasm_trap_if = trap_if; \ |
| 806 } \ |
| 807 TEST(RunWasmInterpreted_##name) { \ |
| 808 if (trap_handler::EnableTrapHandler()) { \ |
| 809 return; \ |
| 810 } \ |
| 811 RunWasm_##name(kExecuteInterpreted); \ |
| 812 } \ |
| 800 void RunWasm_##name(WasmExecutionMode execution_mode) | 813 void RunWasm_##name(WasmExecutionMode execution_mode) |
| 801 | 814 |
| 802 #define WASM_EXEC_COMPILED_TEST(name) \ | 815 #define WASM_EXEC_COMPILED_TEST(name) \ |
| 803 void RunWasm_##name(WasmExecutionMode execution_mode); \ | 816 void RunWasm_##name(WasmExecutionMode execution_mode); \ |
| 804 TEST(RunWasmCompiled_##name) { RunWasm_##name(kExecuteCompiled); } \ | 817 TEST(RunWasmCompiled_##name) { RunWasm_##name(kExecuteCompiled); } \ |
| 805 void RunWasm_##name(WasmExecutionMode execution_mode) | 818 void RunWasm_##name(WasmExecutionMode execution_mode) |
| 806 | 819 |
| 807 } // namespace | 820 } // namespace |
| 808 | 821 |
| 809 #endif | 822 #endif |
| OLD | NEW |