| 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" |  | 
|   27 #include "src/wasm/function-body-decoder.h" |   26 #include "src/wasm/function-body-decoder.h" | 
|   28 #include "src/wasm/wasm-external-refs.h" |   27 #include "src/wasm/wasm-external-refs.h" | 
|   29 #include "src/wasm/wasm-interpreter.h" |   28 #include "src/wasm/wasm-interpreter.h" | 
|   30 #include "src/wasm/wasm-js.h" |   29 #include "src/wasm/wasm-js.h" | 
|   31 #include "src/wasm/wasm-macro-gen.h" |   30 #include "src/wasm/wasm-macro-gen.h" | 
|   32 #include "src/wasm/wasm-module.h" |   31 #include "src/wasm/wasm-module.h" | 
|   33 #include "src/wasm/wasm-objects.h" |   32 #include "src/wasm/wasm-objects.h" | 
|   34 #include "src/wasm/wasm-opcodes.h" |   33 #include "src/wasm/wasm-opcodes.h" | 
|   35  |   34  | 
|   36 #include "src/zone/zone.h" |   35 #include "src/zone/zone.h" | 
| (...skipping 781 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  818 // Declare static variable. |  817 // Declare static variable. | 
|  819 bool WasmRunnerBase::trap_happened; |  818 bool WasmRunnerBase::trap_happened; | 
|  820  |  819  | 
|  821 // A macro to define tests that run in different engine configurations. |  820 // A macro to define tests that run in different engine configurations. | 
|  822 #define WASM_EXEC_TEST(name)                                               \ |  821 #define WASM_EXEC_TEST(name)                                               \ | 
|  823   void RunWasm_##name(WasmExecutionMode execution_mode);                   \ |  822   void RunWasm_##name(WasmExecutionMode execution_mode);                   \ | 
|  824   TEST(RunWasmCompiled_##name) { RunWasm_##name(kExecuteCompiled); }       \ |  823   TEST(RunWasmCompiled_##name) { RunWasm_##name(kExecuteCompiled); }       \ | 
|  825   TEST(RunWasmInterpreted_##name) { RunWasm_##name(kExecuteInterpreted); } \ |  824   TEST(RunWasmInterpreted_##name) { RunWasm_##name(kExecuteInterpreted); } \ | 
|  826   void RunWasm_##name(WasmExecutionMode execution_mode) |  825   void RunWasm_##name(WasmExecutionMode execution_mode) | 
|  827  |  826  | 
|  828 #define WASM_EXEC_TEST_WITH_TRAP(name)                   \ |  827 #define WASM_EXEC_TEST_WITH_TRAP(name)                                     \ | 
|  829   void RunWasm_##name(WasmExecutionMode execution_mode); \ |  828   void RunWasm_##name(WasmExecutionMode execution_mode);                   \ | 
|  830   TEST(RunWasmCompiled_##name) {                         \ |  829   TEST(RunWasmCompiled_##name) { RunWasm_##name(kExecuteCompiled); }       \ | 
|  831     if (trap_handler::UseTrapHandler()) {                \ |  830   void RunWasm_##name(WasmExecutionMode execution_mode);                   \ | 
|  832       return;                                            \ |  831   TEST(RunWasmCompiledWithoutTrapIf_##name) {                              \ | 
|  833     }                                                    \ |  832     bool trap_if = FLAG_wasm_trap_if;                                      \ | 
|  834     RunWasm_##name(kExecuteCompiled);                    \ |  833     FLAG_wasm_trap_if = false;                                             \ | 
|  835   }                                                      \ |  834     RunWasm_##name(kExecuteCompiled);                                      \ | 
|  836   TEST(RunWasmCompiledWithoutTrapIf_##name) {            \ |  835     FLAG_wasm_trap_if = trap_if;                                           \ | 
|  837     if (trap_handler::UseTrapHandler()) {                \ |  836   }                                                                        \ | 
|  838       return;                                            \ |  837   TEST(RunWasmInterpreted_##name) { RunWasm_##name(kExecuteInterpreted); } \ | 
|  839     }                                                    \ |  | 
|  840     bool trap_if = FLAG_wasm_trap_if;                    \ |  | 
|  841     FLAG_wasm_trap_if = true;                            \ |  | 
|  842     RunWasm_##name(kExecuteCompiled);                    \ |  | 
|  843     FLAG_wasm_trap_if = trap_if;                         \ |  | 
|  844   }                                                      \ |  | 
|  845   TEST(RunWasmInterpreted_##name) {                      \ |  | 
|  846     if (trap_handler::UseTrapHandler()) {                \ |  | 
|  847       return;                                            \ |  | 
|  848     }                                                    \ |  | 
|  849     RunWasm_##name(kExecuteInterpreted);                 \ |  | 
|  850   }                                                      \ |  | 
|  851   void RunWasm_##name(WasmExecutionMode execution_mode) |  838   void RunWasm_##name(WasmExecutionMode execution_mode) | 
|  852  |  839  | 
|  853 #define WASM_EXEC_COMPILED_TEST(name)                                \ |  840 #define WASM_EXEC_COMPILED_TEST(name)                                \ | 
|  854   void RunWasm_##name(WasmExecutionMode execution_mode);             \ |  841   void RunWasm_##name(WasmExecutionMode execution_mode);             \ | 
|  855   TEST(RunWasmCompiled_##name) { RunWasm_##name(kExecuteCompiled); } \ |  842   TEST(RunWasmCompiled_##name) { RunWasm_##name(kExecuteCompiled); } \ | 
|  856   void RunWasm_##name(WasmExecutionMode execution_mode) |  843   void RunWasm_##name(WasmExecutionMode execution_mode) | 
|  857  |  844  | 
|  858 }  // namespace |  845 }  // namespace | 
|  859  |  846  | 
|  860 #endif |  847 #endif | 
| OLD | NEW |