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/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 Loading... |
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 Loading... |
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 |
OLD | NEW |