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

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

Issue 2044833002: [wasm] Dont compute global offsets if the module had errors (e.g. invalid memory type for global). (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 6 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/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 366 matching lines...) Expand 10 before | Expand all | Expand 10 after
377 size_t actual_length = static_cast<size_t>(pc_ - section_start); 377 size_t actual_length = static_cast<size_t>(pc_ - section_start);
378 error(pc_, pc_, 378 error(pc_, pc_,
379 "section \"%s\" %s (%zu bytes) than specified (%zu bytes)", 379 "section \"%s\" %s (%zu bytes) than specified (%zu bytes)",
380 WasmSection::getName(section), diff, actual_length, 380 WasmSection::getName(section), diff, actual_length,
381 expected_length); 381 expected_length);
382 break; 382 break;
383 } 383 }
384 } 384 }
385 385
386 done: 386 done:
387 CalculateGlobalsOffsets(module); 387 if (ok()) CalculateGlobalsOffsets(module);
388 const WasmModule* finished_module = module; 388 const WasmModule* finished_module = module;
389 ModuleResult result = toResult(finished_module); 389 ModuleResult result = toResult(finished_module);
390 if (FLAG_dump_wasm_module) { 390 if (FLAG_dump_wasm_module) {
391 DumpModule(module, result); 391 DumpModule(module, result);
392 } 392 }
393 return result; 393 return result;
394 } 394 }
395 395
396 uint32_t SafeReserve(uint32_t count) { 396 uint32_t SafeReserve(uint32_t count) {
397 // Avoid OOM by only reserving up to a certain size. 397 // Avoid OOM by only reserving up to a certain size.
(...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after
758 return FunctionError("size > maximum function size"); 758 return FunctionError("size > maximum function size");
759 isolate->counters()->wasm_function_size_bytes()->AddSample( 759 isolate->counters()->wasm_function_size_bytes()->AddSample(
760 static_cast<int>(size)); 760 static_cast<int>(size));
761 WasmFunction* function = new WasmFunction(); 761 WasmFunction* function = new WasmFunction();
762 ModuleDecoder decoder(zone, function_start, function_end, kWasmOrigin); 762 ModuleDecoder decoder(zone, function_start, function_end, kWasmOrigin);
763 return decoder.DecodeSingleFunction(module_env, function); 763 return decoder.DecodeSingleFunction(module_env, function);
764 } 764 }
765 } // namespace wasm 765 } // namespace wasm
766 } // namespace internal 766 } // namespace internal
767 } // namespace v8 767 } // 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