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

Side by Side Diff: test/unittests/wasm/ast-decoder-unittest.cc

Issue 2271803004: [wasm] Bound the allowed number of locals. (Closed)
Patch Set: Set the limit of local decls to 8000000 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 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 "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 220 matching lines...) Expand 10 before | Expand all | Expand 10 after
231 231
232 TEST_F(AstDecoderTest, GetLocal0_param) { 232 TEST_F(AstDecoderTest, GetLocal0_param) {
233 EXPECT_VERIFIES(sigs.i_i(), kCodeGetLocal0); 233 EXPECT_VERIFIES(sigs.i_i(), kCodeGetLocal0);
234 } 234 }
235 235
236 TEST_F(AstDecoderTest, GetLocal0_local) { 236 TEST_F(AstDecoderTest, GetLocal0_local) {
237 AddLocals(kAstI32, 1); 237 AddLocals(kAstI32, 1);
238 EXPECT_VERIFIES(sigs.i_v(), kCodeGetLocal0); 238 EXPECT_VERIFIES(sigs.i_v(), kCodeGetLocal0);
239 } 239 }
240 240
241 TEST_F(AstDecoderTest, TooManyLocals) {
242 AddLocals(kAstI32, 4034986500);
243 EXPECT_FAILURE(sigs.i_v(), kCodeGetLocal0);
244 }
245
241 TEST_F(AstDecoderTest, GetLocal0_param_n) { 246 TEST_F(AstDecoderTest, GetLocal0_param_n) {
242 FunctionSig* array[] = {sigs.i_i(), sigs.i_ii(), sigs.i_iii()}; 247 FunctionSig* array[] = {sigs.i_i(), sigs.i_ii(), sigs.i_iii()};
243 248
244 for (size_t i = 0; i < arraysize(array); i++) { 249 for (size_t i = 0; i < arraysize(array); i++) {
245 EXPECT_VERIFIES(array[i], kCodeGetLocal0); 250 EXPECT_VERIFIES(array[i], kCodeGetLocal0);
246 } 251 }
247 } 252 }
248 253
249 TEST_F(AstDecoderTest, GetLocalN_local) { 254 TEST_F(AstDecoderTest, GetLocalN_local) {
250 for (byte i = 1; i < 8; i++) { 255 for (byte i = 1; i < 8; i++) {
(...skipping 2310 matching lines...) Expand 10 before | Expand all | Expand 10 after
2561 iter.next(); 2566 iter.next();
2562 EXPECT_TRUE(iter.has_next()); 2567 EXPECT_TRUE(iter.has_next());
2563 EXPECT_EQ(kExprI8Const, iter.current()); 2568 EXPECT_EQ(kExprI8Const, iter.current());
2564 iter.next(); 2569 iter.next();
2565 EXPECT_FALSE(iter.has_next()); 2570 EXPECT_FALSE(iter.has_next());
2566 } 2571 }
2567 2572
2568 } // namespace wasm 2573 } // namespace wasm
2569 } // namespace internal 2574 } // namespace internal
2570 } // namespace v8 2575 } // 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