| 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 15 matching lines...) Expand all Loading... |
| 26 #include "src/wasm/wasm-macro-gen.h" | 26 #include "src/wasm/wasm-macro-gen.h" |
| 27 #include "src/wasm/wasm-module.h" | 27 #include "src/wasm/wasm-module.h" |
| 28 #include "src/wasm/wasm-opcodes.h" | 28 #include "src/wasm/wasm-opcodes.h" |
| 29 | 29 |
| 30 #include "src/zone.h" | 30 #include "src/zone.h" |
| 31 | 31 |
| 32 #include "test/cctest/cctest.h" | 32 #include "test/cctest/cctest.h" |
| 33 #include "test/cctest/compiler/call-tester.h" | 33 #include "test/cctest/compiler/call-tester.h" |
| 34 #include "test/cctest/compiler/graph-builder-tester.h" | 34 #include "test/cctest/compiler/graph-builder-tester.h" |
| 35 | 35 |
| 36 // TODO(titzer): pull WASM_64 up to a common header. | |
| 37 #if !V8_TARGET_ARCH_32_BIT || V8_TARGET_ARCH_X64 | |
| 38 #define WASM_64 1 | |
| 39 #else | |
| 40 #define WASM_64 0 | |
| 41 #endif | |
| 42 | |
| 43 static const uint32_t kMaxFunctions = 10; | 36 static const uint32_t kMaxFunctions = 10; |
| 44 | 37 |
| 45 enum WasmExecutionMode { kExecuteInterpreted, kExecuteCompiled }; | 38 enum WasmExecutionMode { kExecuteInterpreted, kExecuteCompiled }; |
| 46 | 39 |
| 47 // TODO(titzer): check traps more robustly in tests. | 40 // TODO(titzer): check traps more robustly in tests. |
| 48 // Currently, in tests, we just return 0xdeadbeef from the function in which | 41 // Currently, in tests, we just return 0xdeadbeef from the function in which |
| 49 // the trap occurs if the runtime context is not available to throw a JavaScript | 42 // the trap occurs if the runtime context is not available to throw a JavaScript |
| 50 // exception. | 43 // exception. |
| 51 #define CHECK_TRAP32(x) \ | 44 #define CHECK_TRAP32(x) \ |
| 52 CHECK_EQ(0xdeadbeef, (bit_cast<uint32_t>(x)) & 0xFFFFFFFF) | 45 CHECK_EQ(0xdeadbeef, (bit_cast<uint32_t>(x)) & 0xFFFFFFFF) |
| (...skipping 709 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 762 // interpreter. | 755 // interpreter. |
| 763 #define WASM_EXEC_TEST(name) \ | 756 #define WASM_EXEC_TEST(name) \ |
| 764 void RunWasm_##name(WasmExecutionMode execution_mode); \ | 757 void RunWasm_##name(WasmExecutionMode execution_mode); \ |
| 765 TEST(RunWasmCompiled_##name) { RunWasm_##name(kExecuteCompiled); } \ | 758 TEST(RunWasmCompiled_##name) { RunWasm_##name(kExecuteCompiled); } \ |
| 766 TEST(RunWasmInterpreted_##name) { RunWasm_##name(kExecuteInterpreted); } \ | 759 TEST(RunWasmInterpreted_##name) { RunWasm_##name(kExecuteInterpreted); } \ |
| 767 void RunWasm_##name(WasmExecutionMode execution_mode) | 760 void RunWasm_##name(WasmExecutionMode execution_mode) |
| 768 | 761 |
| 769 } // namespace | 762 } // namespace |
| 770 | 763 |
| 771 #endif | 764 #endif |
| OLD | NEW |