| 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 #include "src/wasm/function-body-decoder-impl.h" | 6 #include "src/wasm/function-body-decoder-impl.h" |
| 7 | 7 |
| 8 #include "src/base/functional.h" | 8 #include "src/base/functional.h" |
| 9 #include "src/base/platform/platform.h" | 9 #include "src/base/platform/platform.h" |
| 10 #include "src/counters.h" | 10 #include "src/counters.h" |
| (...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 252 } | 252 } |
| 253 } | 253 } |
| 254 | 254 |
| 255 // Decodes an entire module. | 255 // Decodes an entire module. |
| 256 ModuleResult DecodeModule(bool verify_functions = true) { | 256 ModuleResult DecodeModule(bool verify_functions = true) { |
| 257 pc_ = start_; | 257 pc_ = start_; |
| 258 WasmModule* module = new WasmModule(module_zone); | 258 WasmModule* module = new WasmModule(module_zone); |
| 259 module->min_mem_pages = 0; | 259 module->min_mem_pages = 0; |
| 260 module->max_mem_pages = 0; | 260 module->max_mem_pages = 0; |
| 261 module->mem_export = false; | 261 module->mem_export = false; |
| 262 module->origin = origin_; | 262 module->set_origin(origin_); |
| 263 | 263 |
| 264 const byte* pos = pc_; | 264 const byte* pos = pc_; |
| 265 uint32_t magic_word = consume_u32("wasm magic"); | 265 uint32_t magic_word = consume_u32("wasm magic"); |
| 266 #define BYTES(x) (x & 0xff), (x >> 8) & 0xff, (x >> 16) & 0xff, (x >> 24) & 0xff | 266 #define BYTES(x) (x & 0xff), (x >> 8) & 0xff, (x >> 16) & 0xff, (x >> 24) & 0xff |
| 267 if (magic_word != kWasmMagic) { | 267 if (magic_word != kWasmMagic) { |
| 268 error(pos, pos, | 268 error(pos, pos, |
| 269 "expected magic word %02x %02x %02x %02x, " | 269 "expected magic word %02x %02x %02x %02x, " |
| 270 "found %02x %02x %02x %02x", | 270 "found %02x %02x %02x %02x", |
| 271 BYTES(kWasmMagic), BYTES(magic_word)); | 271 BYTES(kWasmMagic), BYTES(magic_word)); |
| 272 } | 272 } |
| (...skipping 1010 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1283 result.push_back({section_start, name_offset, name_length, payload_offset, | 1283 result.push_back({section_start, name_offset, name_length, payload_offset, |
| 1284 payload_length, section_length}); | 1284 payload_length, section_length}); |
| 1285 } | 1285 } |
| 1286 | 1286 |
| 1287 return result; | 1287 return result; |
| 1288 } | 1288 } |
| 1289 | 1289 |
| 1290 } // namespace wasm | 1290 } // namespace wasm |
| 1291 } // namespace internal | 1291 } // namespace internal |
| 1292 } // namespace v8 | 1292 } // namespace v8 |
| OLD | NEW |