| 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 494 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 505 } | 505 } |
| 506 } | 506 } |
| 507 section_iter.advance(); | 507 section_iter.advance(); |
| 508 } | 508 } |
| 509 | 509 |
| 510 // ===== Start section =================================================== | 510 // ===== Start section =================================================== |
| 511 if (section_iter.section_code() == kStartSectionCode) { | 511 if (section_iter.section_code() == kStartSectionCode) { |
| 512 WasmFunction* func; | 512 WasmFunction* func; |
| 513 const byte* pos = pc_; | 513 const byte* pos = pc_; |
| 514 module->start_function_index = consume_func_index(module, &func); | 514 module->start_function_index = consume_func_index(module, &func); |
| 515 if (func && func->sig->parameter_count() > 0) { | 515 if (func && |
| 516 error(pos, "invalid start function: non-zero parameter count"); | 516 (func->sig->parameter_count() > 0 || func->sig->return_count() > 0)) { |
| 517 error(pos, |
| 518 "invalid start function: non-zero parameter or return count"); |
| 517 } | 519 } |
| 518 section_iter.advance(); | 520 section_iter.advance(); |
| 519 } | 521 } |
| 520 | 522 |
| 521 // ===== Elements section ================================================ | 523 // ===== Elements section ================================================ |
| 522 if (section_iter.section_code() == kElementSectionCode) { | 524 if (section_iter.section_code() == kElementSectionCode) { |
| 523 uint32_t element_count = consume_u32v("element count"); | 525 uint32_t element_count = consume_u32v("element count"); |
| 524 for (uint32_t i = 0; ok() && i < element_count; ++i) { | 526 for (uint32_t i = 0; ok() && i < element_count; ++i) { |
| 525 const byte* pos = pc(); | 527 const byte* pos = pc(); |
| 526 uint32_t table_index = consume_u32v("table index"); | 528 uint32_t table_index = consume_u32v("table index"); |
| (...skipping 685 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1212 table.push_back(std::move(func_asm_offsets)); | 1214 table.push_back(std::move(func_asm_offsets)); |
| 1213 } | 1215 } |
| 1214 if (decoder.more()) decoder.error("unexpected additional bytes"); | 1216 if (decoder.more()) decoder.error("unexpected additional bytes"); |
| 1215 | 1217 |
| 1216 return decoder.toResult(std::move(table)); | 1218 return decoder.toResult(std::move(table)); |
| 1217 } | 1219 } |
| 1218 | 1220 |
| 1219 } // namespace wasm | 1221 } // namespace wasm |
| 1220 } // namespace internal | 1222 } // namespace internal |
| 1221 } // namespace v8 | 1223 } // namespace v8 |
| OLD | NEW |