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/assembler-inl.h" | 9 #include "src/assembler-inl.h" |
10 #include "src/base/platform/elapsed-timer.h" | 10 #include "src/base/platform/elapsed-timer.h" |
(...skipping 1000 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1011 CHECK_EQ(8, r.Call(3, 0)); | 1011 CHECK_EQ(8, r.Call(3, 0)); |
1012 CHECK_EQ(8, r.Call(4, 0)); | 1012 CHECK_EQ(8, r.Call(4, 0)); |
1013 | 1013 |
1014 CHECK_EQ(115, r.Call(0, 100)); | 1014 CHECK_EQ(115, r.Call(0, 100)); |
1015 CHECK_EQ(114, r.Call(1, 100)); | 1015 CHECK_EQ(114, r.Call(1, 100)); |
1016 CHECK_EQ(112, r.Call(2, 100)); | 1016 CHECK_EQ(112, r.Call(2, 100)); |
1017 CHECK_EQ(108, r.Call(3, 100)); | 1017 CHECK_EQ(108, r.Call(3, 100)); |
1018 CHECK_EQ(108, r.Call(4, 100)); | 1018 CHECK_EQ(108, r.Call(4, 100)); |
1019 } | 1019 } |
1020 | 1020 |
| 1021 WASM_EXEC_TEST(BrTable_loop_target) { |
| 1022 byte code[] = { |
| 1023 WASM_LOOP_I( |
| 1024 WASM_BLOCK( |
| 1025 WASM_BR_TABLE(WASM_GET_LOCAL(0), 2, |
| 1026 BR_TARGET(0), BR_TARGET(1), BR_TARGET(1))), |
| 1027 WASM_ONE)}; |
| 1028 |
| 1029 WasmRunner<int32_t, int32_t> r(execution_mode); |
| 1030 r.Build(code, code + arraysize(code)); |
| 1031 |
| 1032 CHECK_EQ(1, r.Call(0)); |
| 1033 } |
| 1034 |
1021 WASM_EXEC_TEST(F32ReinterpretI32) { | 1035 WASM_EXEC_TEST(F32ReinterpretI32) { |
1022 WasmRunner<int32_t> r(execution_mode); | 1036 WasmRunner<int32_t> r(execution_mode); |
1023 int32_t* memory = r.module().AddMemoryElems<int32_t>(8); | 1037 int32_t* memory = r.module().AddMemoryElems<int32_t>(8); |
1024 | 1038 |
1025 BUILD(r, WASM_I32_REINTERPRET_F32( | 1039 BUILD(r, WASM_I32_REINTERPRET_F32( |
1026 WASM_LOAD_MEM(MachineType::Float32(), WASM_ZERO))); | 1040 WASM_LOAD_MEM(MachineType::Float32(), WASM_ZERO))); |
1027 | 1041 |
1028 FOR_INT32_INPUTS(i) { | 1042 FOR_INT32_INPUTS(i) { |
1029 int32_t expected = *i; | 1043 int32_t expected = *i; |
1030 r.module().WriteMemory(&memory[0], expected); | 1044 r.module().WriteMemory(&memory[0], expected); |
(...skipping 1920 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2951 BUILD(r, WASM_I32_REMS(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)), WASM_DROP, | 2965 BUILD(r, WASM_I32_REMS(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)), WASM_DROP, |
2952 WASM_ZERO); | 2966 WASM_ZERO); |
2953 const int32_t kMin = std::numeric_limits<int32_t>::min(); | 2967 const int32_t kMin = std::numeric_limits<int32_t>::min(); |
2954 CHECK_EQ(0, r.Call(133, 100)); | 2968 CHECK_EQ(0, r.Call(133, 100)); |
2955 CHECK_EQ(0, r.Call(kMin, -1)); | 2969 CHECK_EQ(0, r.Call(kMin, -1)); |
2956 CHECK_EQ(0, r.Call(0, 1)); | 2970 CHECK_EQ(0, r.Call(0, 1)); |
2957 CHECK_TRAP(r.Call(100, 0)); | 2971 CHECK_TRAP(r.Call(100, 0)); |
2958 CHECK_TRAP(r.Call(-1001, 0)); | 2972 CHECK_TRAP(r.Call(-1001, 0)); |
2959 CHECK_TRAP(r.Call(kMin, 0)); | 2973 CHECK_TRAP(r.Call(kMin, 0)); |
2960 } | 2974 } |
OLD | NEW |