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

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

Issue 1760243002: NFC: use array init instead of memset (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: 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 | no next file » | 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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 ModuleResult DecodeModule(WasmModule* module, bool verify_functions = true) { 44 ModuleResult DecodeModule(WasmModule* module, bool verify_functions = true) {
45 pc_ = start_; 45 pc_ = start_;
46 module->module_start = start_; 46 module->module_start = start_;
47 module->module_end = limit_; 47 module->module_end = limit_;
48 module->min_mem_pages = 0; 48 module->min_mem_pages = 0;
49 module->max_mem_pages = 0; 49 module->max_mem_pages = 0;
50 module->mem_export = false; 50 module->mem_export = false;
51 module->mem_external = false; 51 module->mem_external = false;
52 module->origin = origin_; 52 module->origin = origin_;
53 53
54 bool sections[kMaxModuleSectionCode]; 54 bool sections[kMaxModuleSectionCode] = {false};
55 memset(sections, 0, sizeof(sections));
56 55
57 const byte* pos = pc_; 56 const byte* pos = pc_;
58 uint32_t magic_word = consume_u32("wasm magic"); 57 uint32_t magic_word = consume_u32("wasm magic");
59 #define BYTES(x) (x & 0xff), (x >> 8) & 0xff, (x >> 16) & 0xff, (x >> 24) & 0xff 58 #define BYTES(x) (x & 0xff), (x >> 8) & 0xff, (x >> 16) & 0xff, (x >> 24) & 0xff
60 if (magic_word != kWasmMagic) { 59 if (magic_word != kWasmMagic) {
61 error(pos, pos, 60 error(pos, pos,
62 "expected magic word %02x %02x %02x %02x, " 61 "expected magic word %02x %02x %02x %02x, "
63 "found %02x %02x %02x %02x", 62 "found %02x %02x %02x %02x",
64 BYTES(kWasmMagic), BYTES(magic_word)); 63 BYTES(kWasmMagic), BYTES(magic_word));
65 return toResult(module); 64 return toResult(module);
(...skipping 578 matching lines...) Expand 10 before | Expand all | Expand 10 after
644 if (function_start > function_end) return FunctionError("start > end"); 643 if (function_start > function_end) return FunctionError("start > end");
645 if (size > kMaxFunctionSize) 644 if (size > kMaxFunctionSize)
646 return FunctionError("size > maximum function size"); 645 return FunctionError("size > maximum function size");
647 WasmFunction* function = new WasmFunction(); 646 WasmFunction* function = new WasmFunction();
648 ModuleDecoder decoder(zone, function_start, function_end, kWasmOrigin); 647 ModuleDecoder decoder(zone, function_start, function_end, kWasmOrigin);
649 return decoder.DecodeSingleFunction(module_env, function); 648 return decoder.DecodeSingleFunction(module_env, function);
650 } 649 }
651 } // namespace wasm 650 } // namespace wasm
652 } // namespace internal 651 } // namespace internal
653 } // namespace v8 652 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698