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

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

Issue 2492793005: [wasm] Fix more -Wsign-compare warnings. (Closed)
Patch Set: 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 | « test/cctest/test-run-wasm-relocation-x64.cc ('k') | test/cctest/wasm/test-run-wasm-64.cc » ('j') | 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 1751 matching lines...) Expand 10 before | Expand all | Expand 10 after
1762 /* */ kExprGetLocal, 0, // -- 1762 /* */ kExprGetLocal, 0, // --
1763 /* */ kExprI8Const, 4, // -- 1763 /* */ kExprI8Const, 4, // --
1764 /* */ kExprI32Sub, // -- 1764 /* */ kExprI32Sub, // --
1765 /* */ kExprTeeLocal, 0, // -- 1765 /* */ kExprTeeLocal, 0, // --
1766 /* */ kExprBr, DEPTH_0, // -- 1766 /* */ kExprBr, DEPTH_0, // --
1767 /* */ kExprEnd, // -- 1767 /* */ kExprEnd, // --
1768 /**/ kExprEnd, // -- 1768 /**/ kExprEnd, // --
1769 /**/ kExprI8Const, 0); // -- 1769 /**/ kExprI8Const, 0); // --
1770 1770
1771 module.BlankMemory(); 1771 module.BlankMemory();
1772 CHECK_EQ(0, r.Call((kNumElems - 1) * 4)); 1772 CHECK_EQ(0u, r.Call((kNumElems - 1) * 4));
1773 } 1773 }
1774 1774
1775 WASM_EXEC_TEST(MemF32_Sum) { 1775 WASM_EXEC_TEST(MemF32_Sum) {
1776 const int kSize = 5; 1776 const int kSize = 5;
1777 TestingModule module(execution_mode); 1777 TestingModule module(execution_mode);
1778 module.AddMemoryElems<float>(kSize); 1778 module.AddMemoryElems<float>(kSize);
1779 float* buffer = module.raw_mem_start<float>(); 1779 float* buffer = module.raw_mem_start<float>();
1780 module.WriteMemory(&buffer[0], -99.25f); 1780 module.WriteMemory(&buffer[0], -99.25f);
1781 module.WriteMemory(&buffer[1], -888.25f); 1781 module.WriteMemory(&buffer[1], -888.25f);
1782 module.WriteMemory(&buffer[2], -77.25f); 1782 module.WriteMemory(&buffer[2], -77.25f);
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
1937 MachineOperatorBuilder::kAllOptionalOps); 1937 MachineOperatorBuilder::kAllOptionalOps);
1938 Graph graph(&zone); 1938 Graph graph(&zone);
1939 JSGraph jsgraph(isolate, &graph, &common, nullptr, nullptr, &machine); 1939 JSGraph jsgraph(isolate, &graph, &common, nullptr, nullptr, &machine);
1940 FunctionSig* sig = WasmOpcodes::Signature(opcode); 1940 FunctionSig* sig = WasmOpcodes::Signature(opcode);
1941 1941
1942 if (sig->parameter_count() == 1) { 1942 if (sig->parameter_count() == 1) {
1943 byte code[] = {WASM_NO_LOCALS, kExprGetLocal, 0, static_cast<byte>(opcode)}; 1943 byte code[] = {WASM_NO_LOCALS, kExprGetLocal, 0, static_cast<byte>(opcode)};
1944 TestBuildingGraph(&zone, &jsgraph, nullptr, sig, nullptr, code, 1944 TestBuildingGraph(&zone, &jsgraph, nullptr, sig, nullptr, code,
1945 code + arraysize(code)); 1945 code + arraysize(code));
1946 } else { 1946 } else {
1947 CHECK_EQ(2, sig->parameter_count()); 1947 CHECK_EQ(2u, sig->parameter_count());
1948 byte code[] = {WASM_NO_LOCALS, kExprGetLocal, 0, kExprGetLocal, 1, 1948 byte code[] = {WASM_NO_LOCALS, kExprGetLocal, 0, kExprGetLocal, 1,
1949 static_cast<byte>(opcode)}; 1949 static_cast<byte>(opcode)};
1950 TestBuildingGraph(&zone, &jsgraph, nullptr, sig, nullptr, code, 1950 TestBuildingGraph(&zone, &jsgraph, nullptr, sig, nullptr, code,
1951 code + arraysize(code)); 1951 code + arraysize(code));
1952 } 1952 }
1953 } 1953 }
1954 1954
1955 TEST(Build_Wasm_SimpleExprs) { 1955 TEST(Build_Wasm_SimpleExprs) {
1956 // Test that the decoder can build a graph for all supported simple expressions. 1956 // Test that the decoder can build a graph for all supported simple expressions.
1957 #define GRAPH_BUILD_TEST(name, opcode, sig) \ 1957 #define GRAPH_BUILD_TEST(name, opcode, sig) \
(...skipping 1027 matching lines...) Expand 10 before | Expand all | Expand 10 after
2985 BUILD(r, WASM_I32_REMS(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)), WASM_DROP, 2985 BUILD(r, WASM_I32_REMS(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)), WASM_DROP,
2986 WASM_ZERO); 2986 WASM_ZERO);
2987 const int32_t kMin = std::numeric_limits<int32_t>::min(); 2987 const int32_t kMin = std::numeric_limits<int32_t>::min();
2988 CHECK_EQ(0, r.Call(133, 100)); 2988 CHECK_EQ(0, r.Call(133, 100));
2989 CHECK_EQ(0, r.Call(kMin, -1)); 2989 CHECK_EQ(0, r.Call(kMin, -1));
2990 CHECK_EQ(0, r.Call(0, 1)); 2990 CHECK_EQ(0, r.Call(0, 1));
2991 CHECK_TRAP(r.Call(100, 0)); 2991 CHECK_TRAP(r.Call(100, 0));
2992 CHECK_TRAP(r.Call(-1001, 0)); 2992 CHECK_TRAP(r.Call(-1001, 0));
2993 CHECK_TRAP(r.Call(kMin, 0)); 2993 CHECK_TRAP(r.Call(kMin, 0));
2994 } 2994 }
OLDNEW
« no previous file with comments | « test/cctest/test-run-wasm-relocation-x64.cc ('k') | test/cctest/wasm/test-run-wasm-64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698