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

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

Issue 2440953002: [wasm] Binary 0xD: update encoding of opcodes, types, and add immediates. (Closed)
Patch Set: Created 4 years, 2 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
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/base/platform/elapsed-timer.h" 9 #include "src/base/platform/elapsed-timer.h"
10 #include "src/utils.h" 10 #include "src/utils.h"
(...skipping 2902 matching lines...) Expand 10 before | Expand all | Expand 10 after
2913 module.AddSignature(sig); 2913 module.AddSignature(sig);
2914 module.AddIndirectFunctionTable(nullptr, 0); 2914 module.AddIndirectFunctionTable(nullptr, 0);
2915 2915
2916 WasmFunctionCompiler t(sig, &module); 2916 WasmFunctionCompiler t(sig, &module);
2917 2917
2918 std::vector<byte> code; 2918 std::vector<byte> code;
2919 for (byte p = 0; p < num_params; ++p) { 2919 for (byte p = 0; p < num_params; ++p) {
2920 ADD_CODE(code, kExprGetLocal, p); 2920 ADD_CODE(code, kExprGetLocal, p);
2921 } 2921 }
2922 ADD_CODE(code, kExprI8Const, 0); 2922 ADD_CODE(code, kExprI8Const, 0);
2923 ADD_CODE(code, kExprCallIndirect, 1); 2923 ADD_CODE(code, kExprCallIndirect, 0, 1);
2924 2924
2925 t.Build(&code[0], &code[0] + code.size()); 2925 t.Build(&code[0], &code[0] + code.size());
2926 t.Compile(); 2926 t.Compile();
2927 } 2927 }
2928 } 2928 }
2929 2929
2930 TEST(Compile_Wasm_CallIndirect_Many_i32) { CompileCallIndirectMany(kAstI32); } 2930 TEST(Compile_Wasm_CallIndirect_Many_i32) { CompileCallIndirectMany(kAstI32); }
2931 2931
2932 TEST(Compile_Wasm_CallIndirect_Many_f32) { CompileCallIndirectMany(kAstF32); } 2932 TEST(Compile_Wasm_CallIndirect_Many_f32) { CompileCallIndirectMany(kAstF32); }
2933 2933
2934 TEST(Compile_Wasm_CallIndirect_Many_f64) { CompileCallIndirectMany(kAstF64); } 2934 TEST(Compile_Wasm_CallIndirect_Many_f64) { CompileCallIndirectMany(kAstF64); }
2935 2935
2936 WASM_EXEC_TEST(Int32RemS_dead) { 2936 WASM_EXEC_TEST(Int32RemS_dead) {
2937 WasmRunner<int32_t> r(execution_mode, MachineType::Int32(), 2937 WasmRunner<int32_t> r(execution_mode, MachineType::Int32(),
2938 MachineType::Int32()); 2938 MachineType::Int32());
2939 BUILD(r, WASM_I32_REMS(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)), WASM_DROP, 2939 BUILD(r, WASM_I32_REMS(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)), WASM_DROP,
2940 WASM_ZERO); 2940 WASM_ZERO);
2941 const int32_t kMin = std::numeric_limits<int32_t>::min(); 2941 const int32_t kMin = std::numeric_limits<int32_t>::min();
2942 CHECK_EQ(0, r.Call(133, 100)); 2942 CHECK_EQ(0, r.Call(133, 100));
2943 CHECK_EQ(0, r.Call(kMin, -1)); 2943 CHECK_EQ(0, r.Call(kMin, -1));
2944 CHECK_EQ(0, r.Call(0, 1)); 2944 CHECK_EQ(0, r.Call(0, 1));
2945 CHECK_TRAP(r.Call(100, 0)); 2945 CHECK_TRAP(r.Call(100, 0));
2946 CHECK_TRAP(r.Call(-1001, 0)); 2946 CHECK_TRAP(r.Call(-1001, 0));
2947 CHECK_TRAP(r.Call(kMin, 0)); 2947 CHECK_TRAP(r.Call(kMin, 0));
2948 } 2948 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698