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/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 1122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1133 mod.globals.push_back({0, 0, mem_type, 0, false}); | 1133 mod.globals.push_back({0, 0, mem_type, 0, false}); |
1134 CHECK(mod.globals.size() <= 127); | 1134 CHECK(mod.globals.size() <= 127); |
1135 return static_cast<byte>(mod.globals.size() - 1); | 1135 return static_cast<byte>(mod.globals.size() - 1); |
1136 } | 1136 } |
1137 byte AddSignature(FunctionSig* sig) { | 1137 byte AddSignature(FunctionSig* sig) { |
1138 mod.signatures.push_back(sig); | 1138 mod.signatures.push_back(sig); |
1139 CHECK(mod.signatures.size() <= 127); | 1139 CHECK(mod.signatures.size() <= 127); |
1140 return static_cast<byte>(mod.signatures.size() - 1); | 1140 return static_cast<byte>(mod.signatures.size() - 1); |
1141 } | 1141 } |
1142 byte AddFunction(FunctionSig* sig) { | 1142 byte AddFunction(FunctionSig* sig) { |
1143 mod.functions.push_back({sig, 0, 0, 0, 0, 0, 0, 0, false, false}); | 1143 mod.functions.push_back({sig, // sig |
| 1144 0, // func_index |
| 1145 0, // sig_index |
| 1146 0, // name_offset |
| 1147 0, // name_length |
| 1148 0, // code_start_offset |
| 1149 0, // code_end_offset |
| 1150 0, // local_i32_count |
| 1151 0, // local_i64_count |
| 1152 0, // local_f32_count |
| 1153 0, // local_f64_count |
| 1154 false, // exported |
| 1155 false}); // external |
1144 CHECK(mod.functions.size() <= 127); | 1156 CHECK(mod.functions.size() <= 127); |
1145 return static_cast<byte>(mod.functions.size() - 1); | 1157 return static_cast<byte>(mod.functions.size() - 1); |
1146 } | 1158 } |
1147 byte AddImport(FunctionSig* sig) { | 1159 byte AddImport(FunctionSig* sig) { |
1148 mod.import_table.push_back({sig, 0, 0}); | 1160 mod.import_table.push_back({sig, // sig |
| 1161 0, // sig_index |
| 1162 0, // module_name_offset |
| 1163 0, // module_name_length |
| 1164 0, // function_name_offset |
| 1165 0}); // function_name_length |
1149 CHECK(mod.import_table.size() <= 127); | 1166 CHECK(mod.import_table.size() <= 127); |
1150 return static_cast<byte>(mod.import_table.size() - 1); | 1167 return static_cast<byte>(mod.import_table.size() - 1); |
1151 } | 1168 } |
1152 | 1169 |
1153 private: | 1170 private: |
1154 WasmModule mod; | 1171 WasmModule mod; |
1155 }; | 1172 }; |
1156 } // namespace | 1173 } // namespace |
1157 | 1174 |
1158 TEST_F(AstDecoderTest, SimpleCalls) { | 1175 TEST_F(AstDecoderTest, SimpleCalls) { |
(...skipping 1246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2405 size_t pos = 0; | 2422 size_t pos = 0; |
2406 pos = ExpectRun(map, pos, kAstF32, 5); | 2423 pos = ExpectRun(map, pos, kAstF32, 5); |
2407 pos = ExpectRun(map, pos, kAstI32, 1337); | 2424 pos = ExpectRun(map, pos, kAstI32, 1337); |
2408 pos = ExpectRun(map, pos, kAstI64, 212); | 2425 pos = ExpectRun(map, pos, kAstI64, 212); |
2409 delete[] data; | 2426 delete[] data; |
2410 } | 2427 } |
2411 | 2428 |
2412 } // namespace wasm | 2429 } // namespace wasm |
2413 } // namespace internal | 2430 } // namespace internal |
2414 } // namespace v8 | 2431 } // namespace v8 |
OLD | NEW |