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 "src/wasm/module-decoder.h" | 5 #include "src/wasm/module-decoder.h" |
6 | 6 |
7 #include "src/base/functional.h" | 7 #include "src/base/functional.h" |
8 #include "src/base/platform/platform.h" | 8 #include "src/base/platform/platform.h" |
9 #include "src/flags.h" | 9 #include "src/flags.h" |
10 #include "src/macro-assembler.h" | 10 #include "src/macro-assembler.h" |
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
229 if (magic_word != kWasmMagic) { | 229 if (magic_word != kWasmMagic) { |
230 error(pos, pos, | 230 error(pos, pos, |
231 "expected magic word %02x %02x %02x %02x, " | 231 "expected magic word %02x %02x %02x %02x, " |
232 "found %02x %02x %02x %02x", | 232 "found %02x %02x %02x %02x", |
233 BYTES(kWasmMagic), BYTES(magic_word)); | 233 BYTES(kWasmMagic), BYTES(magic_word)); |
234 } | 234 } |
235 | 235 |
236 pos = pc_; | 236 pos = pc_; |
237 { | 237 { |
238 uint32_t magic_version = consume_u32("wasm version"); | 238 uint32_t magic_version = consume_u32("wasm version"); |
239 if (magic_version != kWasmVersion) { | 239 if (magic_version != kWasmVersion && |
| 240 magic_version != kWasmLegacyVersion) { |
240 error(pos, pos, | 241 error(pos, pos, |
241 "expected version %02x %02x %02x %02x, " | 242 "expected version %02x %02x %02x %02x, " |
242 "found %02x %02x %02x %02x", | 243 "found %02x %02x %02x %02x", |
243 BYTES(kWasmVersion), BYTES(magic_version)); | 244 BYTES(kWasmVersion), BYTES(magic_version)); |
244 } | 245 } |
245 } | 246 } |
246 | 247 |
247 WasmSectionIterator section_iter(*this); | 248 WasmSectionIterator section_iter(*this); |
248 | 249 |
249 // ===== Type section ==================================================== | 250 // ===== Type section ==================================================== |
(...skipping 1042 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1292 result.push_back({section_start, name_offset, name_length, payload_offset, | 1293 result.push_back({section_start, name_offset, name_length, payload_offset, |
1293 payload_length, section_length}); | 1294 payload_length, section_length}); |
1294 } | 1295 } |
1295 | 1296 |
1296 return result; | 1297 return result; |
1297 } | 1298 } |
1298 | 1299 |
1299 } // namespace wasm | 1300 } // namespace wasm |
1300 } // namespace internal | 1301 } // namespace internal |
1301 } // namespace v8 | 1302 } // namespace v8 |
OLD | NEW |