| 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 473 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 484               } | 484               } | 
| 485               global->exported = true; | 485               global->exported = true; | 
| 486             } | 486             } | 
| 487             break; | 487             break; | 
| 488           } | 488           } | 
| 489           default: | 489           default: | 
| 490             error(pos, pos, "invalid export kind 0x%02x", exp->kind); | 490             error(pos, pos, "invalid export kind 0x%02x", exp->kind); | 
| 491             break; | 491             break; | 
| 492         } | 492         } | 
| 493       } | 493       } | 
| 494       // Check for duplicate exports. | 494       // Check for duplicate exports (except for asm.js). | 
| 495       if (ok() && module->export_table.size() > 1) { | 495       if (ok() && origin_ != kAsmJsOrigin && module->export_table.size() > 1) { | 
| 496         std::vector<WasmExport> sorted_exports(module->export_table); | 496         std::vector<WasmExport> sorted_exports(module->export_table); | 
| 497         const byte* base = start_; | 497         const byte* base = start_; | 
| 498         auto cmp_less = [base](const WasmExport& a, const WasmExport& b) { | 498         auto cmp_less = [base](const WasmExport& a, const WasmExport& b) { | 
| 499           // Return true if a < b. | 499           // Return true if a < b. | 
| 500           if (a.name_length != b.name_length) { | 500           if (a.name_length != b.name_length) { | 
| 501             return a.name_length < b.name_length; | 501             return a.name_length < b.name_length; | 
| 502           } | 502           } | 
| 503           return memcmp(base + a.name_offset, base + b.name_offset, | 503           return memcmp(base + a.name_offset, base + b.name_offset, | 
| 504                         a.name_length) < 0; | 504                         a.name_length) < 0; | 
| 505         }; | 505         }; | 
| (...skipping 726 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 1232     table.push_back(std::move(func_asm_offsets)); | 1232     table.push_back(std::move(func_asm_offsets)); | 
| 1233   } | 1233   } | 
| 1234   if (decoder.more()) decoder.error("unexpected additional bytes"); | 1234   if (decoder.more()) decoder.error("unexpected additional bytes"); | 
| 1235 | 1235 | 
| 1236   return decoder.toResult(std::move(table)); | 1236   return decoder.toResult(std::move(table)); | 
| 1237 } | 1237 } | 
| 1238 | 1238 | 
| 1239 }  // namespace wasm | 1239 }  // namespace wasm | 
| 1240 }  // namespace internal | 1240 }  // namespace internal | 
| 1241 }  // namespace v8 | 1241 }  // namespace v8 | 
| OLD | NEW | 
|---|