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

Side by Side Diff: test/unittests/wasm/loop-assignment-analysis-unittest.cc

Issue 2290233008: [wasm] Validate the index of set local in AnalyzeLoopAssignment (Closed)
Patch Set: Created 4 years, 3 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
« src/wasm/ast-decoder.cc ('K') | « src/wasm/ast-decoder.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 2016 the V8 project authors. All rights reserved. 1 // Copyright 2016 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 "test/unittests/test-utils.h" 5 #include "test/unittests/test-utils.h"
6 6
7 #include "src/v8.h" 7 #include "src/v8.h"
8 8
9 #include "test/cctest/wasm/test-signatures.h" 9 #include "test/cctest/wasm/test-signatures.h"
10 10
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 byte code[] = {kExprLoop, 0}; 42 byte code[] = {kExprLoop, 0};
43 for (int i = 0; i < 5; i++) { 43 for (int i = 0; i < 5; i++) {
44 BitVector* assigned = Analyze(code, code + arraysize(code)); 44 BitVector* assigned = Analyze(code, code + arraysize(code));
45 for (int j = 0; j < assigned->length(); j++) { 45 for (int j = 0; j < assigned->length(); j++) {
46 CHECK_EQ(false, assigned->Contains(j)); 46 CHECK_EQ(false, assigned->Contains(j));
47 } 47 }
48 num_locals++; 48 num_locals++;
49 } 49 }
50 } 50 }
51 51
52 TEST_F(WasmLoopAssignmentAnalyzerTest, regress_642867) {
53 static const byte code[] = {
54 WASM_LOOP(WASM_ZERO, kExprSetLocal, 0xfa, 0xff, 0xff, 0xff,
55 0x0f)}; // local index LEB128 0xfffffffa
56 BitVector* assigned = Analyze(code, code + arraysize(code));
57 CHECK_NULL(assigned);
58 }
59
52 TEST_F(WasmLoopAssignmentAnalyzerTest, One) { 60 TEST_F(WasmLoopAssignmentAnalyzerTest, One) {
53 num_locals = 5; 61 num_locals = 5;
54 for (int i = 0; i < 5; i++) { 62 for (int i = 0; i < 5; i++) {
55 byte code[] = {WASM_LOOP(WASM_SET_ZERO(i))}; 63 byte code[] = {WASM_LOOP(WASM_SET_ZERO(i))};
56 BitVector* assigned = Analyze(code, code + arraysize(code)); 64 BitVector* assigned = Analyze(code, code + arraysize(code));
57 for (int j = 0; j < assigned->length(); j++) { 65 for (int j = 0; j < assigned->length(); j++) {
58 CHECK_EQ(j == i, assigned->Contains(j)); 66 CHECK_EQ(j == i, assigned->Contains(j));
59 } 67 }
60 } 68 }
61 } 69 }
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
183 byte code[] = {kExprLoop, kExprF32Neg, kExprBrTable, 0x0e, 'h', 'e', 191 byte code[] = {kExprLoop, kExprF32Neg, kExprBrTable, 0x0e, 'h', 'e',
184 'l', 'l', 'o', ',', ' ', 'w', 192 'l', 'l', 'o', ',', ' ', 'w',
185 'o', 'r', 'l', 'd', '!'}; 193 'o', 'r', 'l', 'd', '!'};
186 BitVector* assigned = Analyze(code, code + arraysize(code)); 194 BitVector* assigned = Analyze(code, code + arraysize(code));
187 CHECK_NULL(assigned); 195 CHECK_NULL(assigned);
188 } 196 }
189 197
190 } // namespace wasm 198 } // namespace wasm
191 } // namespace internal 199 } // namespace internal
192 } // namespace v8 200 } // namespace v8
OLDNEW
« src/wasm/ast-decoder.cc ('K') | « src/wasm/ast-decoder.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698