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/wasm/wasm-macro-gen.h" | 9 #include "src/wasm/wasm-macro-gen.h" |
10 | 10 |
(...skipping 2920 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2931 CHECK_EQ(19, r.Call(0, 1, 9)); | 2931 CHECK_EQ(19, r.Call(0, 1, 9)); |
2932 CHECK_EQ(1, r.Call(1, 0, 2)); | 2932 CHECK_EQ(1, r.Call(1, 0, 2)); |
2933 CHECK_EQ(1, r.Call(1, 0, 9)); | 2933 CHECK_EQ(1, r.Call(1, 0, 9)); |
2934 | 2934 |
2935 CHECK_TRAP(r.Call(0, 2, 1)); | 2935 CHECK_TRAP(r.Call(0, 2, 1)); |
2936 CHECK_TRAP(r.Call(1, 2, 0)); | 2936 CHECK_TRAP(r.Call(1, 2, 0)); |
2937 CHECK_TRAP(r.Call(2, 0, 1)); | 2937 CHECK_TRAP(r.Call(2, 0, 1)); |
2938 CHECK_TRAP(r.Call(2, 1, 0)); | 2938 CHECK_TRAP(r.Call(2, 1, 0)); |
2939 } | 2939 } |
2940 | 2940 |
| 2941 TEST(Run_Wasm_CallIndirect_NoTable) { |
| 2942 WasmRunner<int32_t> r(MachineType::Int32()); |
| 2943 TestSignatures sigs; |
| 2944 TestingModule module; |
| 2945 r.env()->module = &module; |
| 2946 // One function. |
| 2947 WasmFunctionCompiler t1(sigs.i_ii()); |
| 2948 BUILD(t1, WASM_I32_ADD(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); |
| 2949 t1.CompileAndAdd(&module, /*sig_index*/ 1); |
| 2950 |
| 2951 // Signature table. |
| 2952 module.AddSignature(sigs.f_ff()); |
| 2953 module.AddSignature(sigs.i_ii()); |
| 2954 |
| 2955 // Builder the caller function. |
| 2956 BUILD(r, WASM_CALL_INDIRECT(1, WASM_GET_LOCAL(0), WASM_I8(66), WASM_I8(22))); |
| 2957 |
| 2958 CHECK_TRAP(r.Call(0)); |
| 2959 CHECK_TRAP(r.Call(1)); |
| 2960 CHECK_TRAP(r.Call(2)); |
| 2961 } |
2941 | 2962 |
2942 TEST(Run_Wasm_F32Trunc) { | 2963 TEST(Run_Wasm_F32Trunc) { |
2943 WasmRunner<float> r(MachineType::Float32()); | 2964 WasmRunner<float> r(MachineType::Float32()); |
2944 BUILD(r, WASM_F32_TRUNC(WASM_GET_LOCAL(0))); | 2965 BUILD(r, WASM_F32_TRUNC(WASM_GET_LOCAL(0))); |
2945 | 2966 |
2946 FOR_FLOAT32_INPUTS(i) { CheckFloatEq(trunc(*i), r.Call(*i)); } | 2967 FOR_FLOAT32_INPUTS(i) { CheckFloatEq(trunc(*i), r.Call(*i)); } |
2947 } | 2968 } |
2948 | 2969 |
2949 | 2970 |
2950 // TODO(titzer): Fix for nosee4 and re-enable. | 2971 // TODO(titzer): Fix for nosee4 and re-enable. |
(...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3320 | 3341 |
3321 #if WASM_64 | 3342 #if WASM_64 |
3322 TEST(Compile_Wasm_CallIndirect_Many_i64) { CompileCallIndirectMany(kAstI64); } | 3343 TEST(Compile_Wasm_CallIndirect_Many_i64) { CompileCallIndirectMany(kAstI64); } |
3323 #endif | 3344 #endif |
3324 | 3345 |
3325 | 3346 |
3326 TEST(Compile_Wasm_CallIndirect_Many_f32) { CompileCallIndirectMany(kAstF32); } | 3347 TEST(Compile_Wasm_CallIndirect_Many_f32) { CompileCallIndirectMany(kAstF32); } |
3327 | 3348 |
3328 | 3349 |
3329 TEST(Compile_Wasm_CallIndirect_Many_f64) { CompileCallIndirectMany(kAstF64); } | 3350 TEST(Compile_Wasm_CallIndirect_Many_f64) { CompileCallIndirectMany(kAstF64); } |
OLD | NEW |