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

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

Issue 2484803002: [wasm] Mutable globals cannot be imported (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 | « src/wasm/module-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/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 876 matching lines...) Expand 10 before | Expand all | Expand 10 after
887 TEST_F(WasmModuleVerifyTest, ImportTable_empty) { 887 TEST_F(WasmModuleVerifyTest, ImportTable_empty) {
888 static const byte data[] = {SECTION(Type, 1), 0, SECTION(Import, 1), 0}; 888 static const byte data[] = {SECTION(Type, 1), 0, SECTION(Import, 1), 0};
889 EXPECT_VERIFIES(data); 889 EXPECT_VERIFIES(data);
890 } 890 }
891 891
892 TEST_F(WasmModuleVerifyTest, ImportTable_nosigs1) { 892 TEST_F(WasmModuleVerifyTest, ImportTable_nosigs1) {
893 static const byte data[] = {SECTION(Import, 1), 0}; 893 static const byte data[] = {SECTION(Import, 1), 0};
894 EXPECT_VERIFIES(data); 894 EXPECT_VERIFIES(data);
895 } 895 }
896 896
897 TEST_F(WasmModuleVerifyTest, ImportTable_mutable_global) {
898 {
899 static const byte data[] = {
900 SECTION(Import, 8), // section header
901 1, // number of imports
902 NAME_LENGTH(1), // --
903 'm', // module name
904 NAME_LENGTH(1), // --
905 'f', // global name
906 kExternalGlobal, // import kind
907 kLocalI32, // type
908 0, // mutability
909 };
910 EXPECT_VERIFIES(data);
911 }
912 {
913 static const byte data[] = {
914 SECTION(Import, 8), // section header
915 1, // sig table
916 NAME_LENGTH(1), // --
917 'm', // module name
918 NAME_LENGTH(1), // --
919 'f', // global name
920 kExternalGlobal, // import kind
921 kLocalI32, // type
922 1, // mutability
923 };
924 EXPECT_FAILURE(data);
925 }
926 }
927
897 TEST_F(WasmModuleVerifyTest, ImportTable_nosigs2) { 928 TEST_F(WasmModuleVerifyTest, ImportTable_nosigs2) {
898 static const byte data[] = { 929 static const byte data[] = {
899 SECTION(Import, 6), 1, // sig table 930 SECTION(Import, 6), 1, // sig table
900 NAME_LENGTH(1), 'm', // module name 931 NAME_LENGTH(1), 'm', // module name
901 NAME_LENGTH(1), 'f', // function name 932 NAME_LENGTH(1), 'f', // function name
902 kExternalFunction, // import kind 933 kExternalFunction, // import kind
903 IMPORT_SIG_INDEX(0), // sig index 934 IMPORT_SIG_INDEX(0), // sig index
904 }; 935 };
905 EXPECT_FAILURE(data); 936 EXPECT_FAILURE(data);
906 } 937 }
(...skipping 397 matching lines...) Expand 10 before | Expand all | Expand 10 after
1304 SECTION(Unknown, 4), 1, 'X', 17, 18, // -- 1335 SECTION(Unknown, 4), 1, 'X', 17, 18, // --
1305 SECTION(Unknown, 9), 3, 'f', 'o', 'o', 5, 6, 7, 8, 9, // -- 1336 SECTION(Unknown, 9), 3, 'f', 'o', 'o', 5, 6, 7, 8, 9, // --
1306 SECTION(Unknown, 8), 5, 'o', 't', 'h', 'e', 'r', 7, 8, // -- 1337 SECTION(Unknown, 8), 5, 'o', 't', 'h', 'e', 'r', 7, 8, // --
1307 }; 1338 };
1308 EXPECT_VERIFIES(data); 1339 EXPECT_VERIFIES(data);
1309 } 1340 }
1310 1341
1311 } // namespace wasm 1342 } // namespace wasm
1312 } // namespace internal 1343 } // namespace internal
1313 } // namespace v8 1344 } // namespace v8
OLDNEW
« no previous file with comments | « src/wasm/module-decoder.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698