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 608 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
619 uint32_t function_name_length = 0; | 619 uint32_t function_name_length = 0; |
620 uint32_t name_offset = | 620 uint32_t name_offset = |
621 consume_string(inner, &function_name_length, false); | 621 consume_string(inner, &function_name_length, false); |
622 uint32_t func_index = i; | 622 uint32_t func_index = i; |
623 if (func_index < module->functions.size()) { | 623 if (func_index < module->functions.size()) { |
624 module->functions[func_index].name_offset = name_offset; | 624 module->functions[func_index].name_offset = name_offset; |
625 module->functions[func_index].name_length = function_name_length; | 625 module->functions[func_index].name_length = function_name_length; |
626 } | 626 } |
627 | 627 |
628 uint32_t local_names_count = inner.consume_u32v("local names count"); | 628 uint32_t local_names_count = inner.consume_u32v("local names count"); |
629 for (uint32_t j = 0; ok() && j < local_names_count; j++) { | 629 for (uint32_t j = 0; inner.ok() && j < local_names_count; j++) { |
630 uint32_t length = inner.consume_u32v("string length"); | 630 uint32_t length = inner.consume_u32v("string length"); |
631 inner.consume_bytes(length, "string"); | 631 inner.consume_bytes(length, "string"); |
632 } | 632 } |
633 } | 633 } |
634 // Skip the whole names section in the outer decoder. | 634 // Skip the whole names section in the outer decoder. |
635 consume_bytes(section_iter.payload_length(), nullptr); | 635 consume_bytes(section_iter.payload_length(), nullptr); |
636 section_iter.advance(); | 636 section_iter.advance(); |
637 } | 637 } |
638 | 638 |
639 // ===== Remaining sections ============================================== | 639 // ===== Remaining sections ============================================== |
(...skipping 654 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1294 result.push_back({section_start, name_offset, name_length, payload_offset, | 1294 result.push_back({section_start, name_offset, name_length, payload_offset, |
1295 payload_length, section_length}); | 1295 payload_length, section_length}); |
1296 } | 1296 } |
1297 | 1297 |
1298 return result; | 1298 return result; |
1299 } | 1299 } |
1300 | 1300 |
1301 } // namespace wasm | 1301 } // namespace wasm |
1302 } // namespace internal | 1302 } // namespace internal |
1303 } // namespace v8 | 1303 } // namespace v8 |
OLD | NEW |