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 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
231 if (magic_word != kWasmMagic) { | 231 if (magic_word != kWasmMagic) { |
232 error(pos, pos, | 232 error(pos, pos, |
233 "expected magic word %02x %02x %02x %02x, " | 233 "expected magic word %02x %02x %02x %02x, " |
234 "found %02x %02x %02x %02x", | 234 "found %02x %02x %02x %02x", |
235 BYTES(kWasmMagic), BYTES(magic_word)); | 235 BYTES(kWasmMagic), BYTES(magic_word)); |
236 } | 236 } |
237 | 237 |
238 pos = pc_; | 238 pos = pc_; |
239 { | 239 { |
240 uint32_t magic_version = consume_u32("wasm version"); | 240 uint32_t magic_version = consume_u32("wasm version"); |
241 if (magic_version != kWasmVersion) { | 241 if (magic_version != kWasmVersion && |
| 242 magic_version != kWasmLegacyVersion) { |
242 error(pos, pos, | 243 error(pos, pos, |
243 "expected version %02x %02x %02x %02x, " | 244 "expected version %02x %02x %02x %02x, " |
244 "found %02x %02x %02x %02x", | 245 "found %02x %02x %02x %02x", |
245 BYTES(kWasmVersion), BYTES(magic_version)); | 246 BYTES(kWasmVersion), BYTES(magic_version)); |
246 } | 247 } |
247 } | 248 } |
248 | 249 |
249 WasmSectionIterator section_iter(*this); | 250 WasmSectionIterator section_iter(*this); |
250 | 251 |
251 // ===== Type section ==================================================== | 252 // ===== Type section ==================================================== |
(...skipping 1044 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1296 result.push_back({section_start, name_offset, name_length, payload_offset, | 1297 result.push_back({section_start, name_offset, name_length, payload_offset, |
1297 payload_length, section_length}); | 1298 payload_length, section_length}); |
1298 } | 1299 } |
1299 | 1300 |
1300 return result; | 1301 return result; |
1301 } | 1302 } |
1302 | 1303 |
1303 } // namespace wasm | 1304 } // namespace wasm |
1304 } // namespace internal | 1305 } // namespace internal |
1305 } // namespace v8 | 1306 } // namespace v8 |
OLD | NEW |