Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(75)

Side by Side Diff: src/wasm/module-decoder.cc

Issue 2396043002: [wasm] Remove three fields from wasm object (Closed)
Patch Set: Address comments; handlify several places; rebase Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | src/wasm/wasm-debug.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/macro-assembler.h" 9 #include "src/macro-assembler.h"
10 #include "src/objects.h" 10 #include "src/objects.h"
(...skipping 1086 matching lines...) Expand 10 before | Expand all | Expand 10 after
1097 1097
1098 // Reserve entries for the imported functions. 1098 // Reserve entries for the imported functions.
1099 table.reserve(num_imported_functions); 1099 table.reserve(num_imported_functions);
1100 for (uint32_t i = 0; i < num_imported_functions; i++) { 1100 for (uint32_t i = 0; i < num_imported_functions; i++) {
1101 table.push_back(std::make_pair(0, 0)); 1101 table.push_back(std::make_pair(0, 0));
1102 } 1102 }
1103 1103
1104 uint32_t functions_count = decoder.consume_u32v("functions count"); 1104 uint32_t functions_count = decoder.consume_u32v("functions count");
1105 // Take care of invalid input here. 1105 // Take care of invalid input here.
1106 if (functions_count < static_cast<unsigned>(code_section.length()) / 2) 1106 if (functions_count < static_cast<unsigned>(code_section.length()) / 2)
1107 table.reserve(functions_count); 1107 table.reserve(num_imported_functions + functions_count);
1108 int section_offset = static_cast<int>(code_section.start() - module_start); 1108 int section_offset = static_cast<int>(code_section.start() - module_start);
1109 DCHECK_LE(0, section_offset); 1109 DCHECK_LE(0, section_offset);
1110 for (uint32_t i = 0; i < functions_count && decoder.ok(); ++i) { 1110 for (uint32_t i = 0; i < functions_count && decoder.ok(); ++i) {
1111 uint32_t size = decoder.consume_u32v("body size"); 1111 uint32_t size = decoder.consume_u32v("body size");
1112 int offset = static_cast<int>(section_offset + decoder.pc_offset()); 1112 int offset = static_cast<int>(section_offset + decoder.pc_offset());
1113 table.push_back(std::make_pair(offset, static_cast<int>(size))); 1113 table.push_back(std::make_pair(offset, static_cast<int>(size)));
1114 DCHECK(table.back().first >= 0 && table.back().second >= 0); 1114 DCHECK(table.back().first >= 0 && table.back().second >= 0);
1115 decoder.consume_bytes(size); 1115 decoder.consume_bytes(size);
1116 } 1116 }
1117 if (decoder.more()) decoder.error("unexpected additional bytes"); 1117 if (decoder.more()) decoder.error("unexpected additional bytes");
1118 1118
1119 return decoder.toResult(std::move(table)); 1119 return decoder.toResult(std::move(table));
1120 } 1120 }
1121 1121
1122 } // namespace wasm 1122 } // namespace wasm
1123 } // namespace internal 1123 } // namespace internal
1124 } // namespace v8 1124 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | src/wasm/wasm-debug.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698