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 #include <stdint.h> | 5 #include <stdint.h> |
6 #include <stdlib.h> | 6 #include <stdlib.h> |
7 #include <string.h> | 7 #include <string.h> |
8 | 8 |
9 #include "src/base/platform/elapsed-timer.h" | 9 #include "src/base/platform/elapsed-timer.h" |
10 | 10 |
(...skipping 2454 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2465 module.PopulateIndirectFunctionTable(); | 2465 module.PopulateIndirectFunctionTable(); |
2466 | 2466 |
2467 // Builder the caller function. | 2467 // Builder the caller function. |
2468 WasmRunner<int32_t> r(&module, MachineType::Int32(), MachineType::Int32(), | 2468 WasmRunner<int32_t> r(&module, MachineType::Int32(), MachineType::Int32(), |
2469 MachineType::Int32()); | 2469 MachineType::Int32()); |
2470 BUILD(r, WASM_I32_ADD( | 2470 BUILD(r, WASM_I32_ADD( |
2471 WASM_CALL_INDIRECT2(1, WASM_GET_LOCAL(0), WASM_GET_LOCAL(1), | 2471 WASM_CALL_INDIRECT2(1, WASM_GET_LOCAL(0), WASM_GET_LOCAL(1), |
2472 WASM_GET_LOCAL(2)), | 2472 WASM_GET_LOCAL(2)), |
2473 WASM_CALL_INDIRECT2(1, WASM_GET_LOCAL(1), WASM_GET_LOCAL(2), | 2473 WASM_CALL_INDIRECT2(1, WASM_GET_LOCAL(1), WASM_GET_LOCAL(2), |
2474 WASM_GET_LOCAL(0)))); | 2474 WASM_GET_LOCAL(0)))); |
2475 | |
2476 CHECK_EQ(5, r.Call(0, 1, 2)); | 2475 CHECK_EQ(5, r.Call(0, 1, 2)); |
2477 CHECK_EQ(19, r.Call(0, 1, 9)); | 2476 CHECK_EQ(19, r.Call(0, 1, 9)); |
2478 CHECK_EQ(1, r.Call(1, 0, 2)); | 2477 CHECK_EQ(1, r.Call(1, 0, 2)); |
2479 CHECK_EQ(1, r.Call(1, 0, 9)); | 2478 CHECK_EQ(1, r.Call(1, 0, 9)); |
2480 | 2479 |
2481 CHECK_TRAP(r.Call(0, 2, 1)); | 2480 CHECK_TRAP(r.Call(0, 2, 1)); |
2482 CHECK_TRAP(r.Call(1, 2, 0)); | 2481 CHECK_TRAP(r.Call(1, 2, 0)); |
2483 CHECK_TRAP(r.Call(2, 0, 1)); | 2482 CHECK_TRAP(r.Call(2, 0, 1)); |
2484 CHECK_TRAP(r.Call(2, 1, 0)); | 2483 CHECK_TRAP(r.Call(2, 1, 0)); |
2485 } | 2484 } |
(...skipping 374 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2860 MachineType::Int32()); | 2859 MachineType::Int32()); |
2861 BUILD(r, WASM_I32_REMS(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)), WASM_ZERO); | 2860 BUILD(r, WASM_I32_REMS(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)), WASM_ZERO); |
2862 const int32_t kMin = std::numeric_limits<int32_t>::min(); | 2861 const int32_t kMin = std::numeric_limits<int32_t>::min(); |
2863 CHECK_EQ(0, r.Call(133, 100)); | 2862 CHECK_EQ(0, r.Call(133, 100)); |
2864 CHECK_EQ(0, r.Call(kMin, -1)); | 2863 CHECK_EQ(0, r.Call(kMin, -1)); |
2865 CHECK_EQ(0, r.Call(0, 1)); | 2864 CHECK_EQ(0, r.Call(0, 1)); |
2866 CHECK_TRAP(r.Call(100, 0)); | 2865 CHECK_TRAP(r.Call(100, 0)); |
2867 CHECK_TRAP(r.Call(-1001, 0)); | 2866 CHECK_TRAP(r.Call(-1001, 0)); |
2868 CHECK_TRAP(r.Call(kMin, 0)); | 2867 CHECK_TRAP(r.Call(kMin, 0)); |
2869 } | 2868 } |
OLD | NEW |