Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(42)

Side by Side Diff: test/cctest/wasm/test-run-wasm.cc

Issue 1648503003: [wasm] Fix CallIndirect with the case of no indirect function table. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/wasm/wasm-module.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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); }
OLDNEW
« no previous file with comments | « src/wasm/wasm-module.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698