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

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

Issue 1695233002: wasm - replace the WLL section with support to skip all unknown sections. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Rebase Created 4 years, 9 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 | test/unittests/wasm/module-decoder-unittest.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/macro-assembler.h" 5 #include "src/macro-assembler.h"
6 #include "src/objects.h" 6 #include "src/objects.h"
7 #include "src/v8.h" 7 #include "src/v8.h"
8 8
9 #include "src/wasm/decoder.h" 9 #include "src/wasm/decoder.h"
10 #include "src/wasm/module-decoder.h" 10 #include "src/wasm/module-decoder.h"
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after
227 error(sigpos, "invalid signature index"); 227 error(sigpos, "invalid signature index");
228 } else { 228 } else {
229 import->sig = module->signatures->at(import->sig_index); 229 import->sig = module->signatures->at(import->sig_index);
230 } 230 }
231 import->module_name_offset = consume_string("import module name"); 231 import->module_name_offset = consume_string("import module name");
232 import->function_name_offset = 232 import->function_name_offset =
233 consume_string("import function name"); 233 consume_string("import function name");
234 } 234 }
235 break; 235 break;
236 } 236 }
237 case kDeclWLL: { 237 default:
238 // Reserved for experimentation by the Web Low-level Language project 238 // All other sections are ignored and skipped. Known experimental
239 // which is augmenting the binary encoding with source code meta 239 // sections: 0x11 WLL https://github.com/JSStats/wll
240 // information. This section does not affect the semantics of the code 240 uint32_t section_size = consume_u32("section size");
241 // and can be ignored by the runtime. https://github.com/JSStats/wll
242 int length = 0;
243 uint32_t section_size = consume_u32v(&length, "section size");
244 if (pc_ + section_size > limit_ || pc_ + section_size < pc_) { 241 if (pc_ + section_size > limit_ || pc_ + section_size < pc_) {
245 error(pc_ - length, "invalid section size"); 242 error(pc_ - 4, "invalid section size");
246 break; 243 break;
247 } 244 }
248 pc_ += section_size; 245 pc_ += section_size;
249 break; 246 break;
250 }
251 default:
252 error(pc_ - 1, nullptr, "unrecognized section 0x%02x", section);
253 break;
254 } 247 }
255 } 248 }
256 249
257 return toResult(module); 250 return toResult(module);
258 } 251 }
259 252
260 uint32_t SafeReserve(uint32_t count) { 253 uint32_t SafeReserve(uint32_t count) {
261 // Avoid OOM by only reserving up to a certain size. 254 // Avoid OOM by only reserving up to a certain size.
262 const uint32_t kMaxReserve = 20000; 255 const uint32_t kMaxReserve = 20000;
263 return count < kMaxReserve ? count : kMaxReserve; 256 return count < kMaxReserve ? count : kMaxReserve;
(...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after
607 if (function_start > function_end) return FunctionError("start > end"); 600 if (function_start > function_end) return FunctionError("start > end");
608 if (size > kMaxFunctionSize) 601 if (size > kMaxFunctionSize)
609 return FunctionError("size > maximum function size"); 602 return FunctionError("size > maximum function size");
610 WasmFunction* function = new WasmFunction(); 603 WasmFunction* function = new WasmFunction();
611 ModuleDecoder decoder(zone, function_start, function_end, false); 604 ModuleDecoder decoder(zone, function_start, function_end, false);
612 return decoder.DecodeSingleFunction(module_env, function); 605 return decoder.DecodeSingleFunction(module_env, function);
613 } 606 }
614 } // namespace wasm 607 } // namespace wasm
615 } // namespace internal 608 } // namespace internal
616 } // namespace v8 609 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | test/unittests/wasm/module-decoder-unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698