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

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

Issue 2463063002: [wasm] Fix br_table in the wasm interpreter to use varuint32. (Closed)
Patch Set: Remove unused variable Created 4 years, 1 month 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-interpreter.cc ('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/base/platform/elapsed-timer.h" 9 #include "src/base/platform/elapsed-timer.h"
10 #include "src/utils.h" 10 #include "src/utils.h"
(...skipping 887 matching lines...) Expand 10 before | Expand all | Expand 10 after
898 WASM_BLOCK_I(WASM_BRV_IFD(0, WASM_GET_LOCAL(0), WASM_GET_LOCAL(0)), 898 WASM_BLOCK_I(WASM_BRV_IFD(0, WASM_GET_LOCAL(0), WASM_GET_LOCAL(0)),
899 WASM_RETURN1(WASM_I8(9)), WASM_I8(7), WASM_I8(7)), 899 WASM_RETURN1(WASM_I8(9)), WASM_I8(7), WASM_I8(7)),
900 WASM_BRV(0, WASM_I8(8)))); 900 WASM_BRV(0, WASM_I8(8))));
901 901
902 for (int32_t i = 0; i < 5; i++) { 902 for (int32_t i = 0; i < 5; i++) {
903 int32_t expected = i != 0 ? 8 : 9; 903 int32_t expected = i != 0 ? 8 : 9;
904 CHECK_EQ(expected, r.Call(i)); 904 CHECK_EQ(expected, r.Call(i));
905 } 905 }
906 } 906 }
907 907
908 WASM_EXEC_TEST(Regression_660262) {
909 TestingModule module(execution_mode);
910 module.AddMemoryElems<int32_t>(8);
911 WasmRunner<int32_t> r(&module);
912 BUILD(r, kExprI8Const, 0x00, kExprI8Const, 0x00, kExprI32LoadMem, 0x00, 0x0f,
913 kExprBrTable, 0x00, 0x80, 0x00); // entries=0
914 r.Call();
915 }
916
908 WASM_EXEC_TEST(BrTable0a) { 917 WASM_EXEC_TEST(BrTable0a) {
909 WasmRunner<int32_t> r(execution_mode, MachineType::Int32()); 918 WasmRunner<int32_t> r(execution_mode, MachineType::Int32());
910 BUILD(r, B1(B1(WASM_BR_TABLE(WASM_GET_LOCAL(0), 0, BR_TARGET(0)))), 919 BUILD(r, B1(B1(WASM_BR_TABLE(WASM_GET_LOCAL(0), 0, BR_TARGET(0)))),
911 WASM_I8(91)); 920 WASM_I8(91));
912 FOR_INT32_INPUTS(i) { CHECK_EQ(91, r.Call(*i)); } 921 FOR_INT32_INPUTS(i) { CHECK_EQ(91, r.Call(*i)); }
913 } 922 }
914 923
915 WASM_EXEC_TEST(BrTable0b) { 924 WASM_EXEC_TEST(BrTable0b) {
916 WasmRunner<int32_t> r(execution_mode, MachineType::Int32()); 925 WasmRunner<int32_t> r(execution_mode, MachineType::Int32());
917 BUILD(r, 926 BUILD(r,
(...skipping 2066 matching lines...) Expand 10 before | Expand all | Expand 10 after
2984 BUILD(r, WASM_I32_REMS(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)), WASM_DROP, 2993 BUILD(r, WASM_I32_REMS(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)), WASM_DROP,
2985 WASM_ZERO); 2994 WASM_ZERO);
2986 const int32_t kMin = std::numeric_limits<int32_t>::min(); 2995 const int32_t kMin = std::numeric_limits<int32_t>::min();
2987 CHECK_EQ(0, r.Call(133, 100)); 2996 CHECK_EQ(0, r.Call(133, 100));
2988 CHECK_EQ(0, r.Call(kMin, -1)); 2997 CHECK_EQ(0, r.Call(kMin, -1));
2989 CHECK_EQ(0, r.Call(0, 1)); 2998 CHECK_EQ(0, r.Call(0, 1));
2990 CHECK_TRAP(r.Call(100, 0)); 2999 CHECK_TRAP(r.Call(100, 0));
2991 CHECK_TRAP(r.Call(-1001, 0)); 3000 CHECK_TRAP(r.Call(-1001, 0));
2992 CHECK_TRAP(r.Call(kMin, 0)); 3001 CHECK_TRAP(r.Call(kMin, 0));
2993 } 3002 }
OLDNEW
« no previous file with comments | « src/wasm/wasm-interpreter.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698