OLD | NEW |
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/handles.h" | 7 #include "src/handles.h" |
8 #include "src/objects-inl.h" | 8 #include "src/objects-inl.h" |
9 #include "src/wasm/module-decoder.h" | 9 #include "src/wasm/module-decoder.h" |
10 #include "src/wasm/wasm-macro-gen.h" | 10 #include "src/wasm/wasm-macro-gen.h" |
(...skipping 457 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
468 EXPECT_EQ(0x6ddcc, s1->dest_addr.val.i32_const); | 468 EXPECT_EQ(0x6ddcc, s1->dest_addr.val.i32_const); |
469 EXPECT_EQ(kDataSegment1SourceOffset, s1->source_offset); | 469 EXPECT_EQ(kDataSegment1SourceOffset, s1->source_offset); |
470 EXPECT_EQ(10, s1->source_size); | 470 EXPECT_EQ(10, s1->source_size); |
471 | 471 |
472 if (result.val) delete result.val; | 472 if (result.val) delete result.val; |
473 } | 473 } |
474 | 474 |
475 EXPECT_OFF_END_FAILURE(data, 14, sizeof(data)); | 475 EXPECT_OFF_END_FAILURE(data, 14, sizeof(data)); |
476 } | 476 } |
477 | 477 |
| 478 TEST_F(WasmModuleVerifyTest, MaxMaximumMemorySize) { |
| 479 { |
| 480 const byte data[] = { |
| 481 SECTION(Memory, 6), ENTRY_COUNT(1), kResizableMaximumFlag, 0, |
| 482 U32V_3(65536), |
| 483 }; |
| 484 EXPECT_VERIFIES(data); |
| 485 } |
| 486 { |
| 487 const byte data[] = { |
| 488 SECTION(Memory, 6), ENTRY_COUNT(1), kResizableMaximumFlag, 0, |
| 489 U32V_3(65537), |
| 490 }; |
| 491 EXPECT_FAILURE(data); |
| 492 } |
| 493 } |
| 494 |
478 TEST_F(WasmModuleVerifyTest, DataSegment_wrong_init_type) { | 495 TEST_F(WasmModuleVerifyTest, DataSegment_wrong_init_type) { |
479 const byte data[] = { | 496 const byte data[] = { |
480 SECTION(Memory, 4), | 497 SECTION(Memory, 4), |
481 ENTRY_COUNT(1), | 498 ENTRY_COUNT(1), |
482 kResizableMaximumFlag, | 499 kResizableMaximumFlag, |
483 28, | 500 28, |
484 28, | 501 28, |
485 SECTION(Data, 11), | 502 SECTION(Data, 11), |
486 ENTRY_COUNT(1), | 503 ENTRY_COUNT(1), |
487 LINEAR_MEMORY_INDEX_0, | 504 LINEAR_MEMORY_INDEX_0, |
(...skipping 799 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1287 SECTION(Unknown, 4), 1, 'X', 17, 18, // -- | 1304 SECTION(Unknown, 4), 1, 'X', 17, 18, // -- |
1288 SECTION(Unknown, 9), 3, 'f', 'o', 'o', 5, 6, 7, 8, 9, // -- | 1305 SECTION(Unknown, 9), 3, 'f', 'o', 'o', 5, 6, 7, 8, 9, // -- |
1289 SECTION(Unknown, 8), 5, 'o', 't', 'h', 'e', 'r', 7, 8, // -- | 1306 SECTION(Unknown, 8), 5, 'o', 't', 'h', 'e', 'r', 7, 8, // -- |
1290 }; | 1307 }; |
1291 EXPECT_VERIFIES(data); | 1308 EXPECT_VERIFIES(data); |
1292 } | 1309 } |
1293 | 1310 |
1294 } // namespace wasm | 1311 } // namespace wasm |
1295 } // namespace internal | 1312 } // namespace internal |
1296 } // namespace v8 | 1313 } // namespace v8 |
OLD | NEW |