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 #ifndef V8_WASM_MODULE_DECODER_H_ | 5 #ifndef V8_WASM_MODULE_DECODER_H_ |
6 #define V8_WASM_MODULE_DECODER_H_ | 6 #define V8_WASM_MODULE_DECODER_H_ |
7 | 7 |
8 #include "src/wasm/ast-decoder.h" | 8 #include "src/wasm/ast-decoder.h" |
9 #include "src/wasm/wasm-module.h" | 9 #include "src/wasm/wasm-module.h" |
10 #include "src/wasm/wasm-result.h" | 10 #include "src/wasm/wasm-result.h" |
11 | 11 |
12 namespace v8 { | 12 namespace v8 { |
13 namespace internal { | 13 namespace internal { |
14 namespace wasm { | 14 namespace wasm { |
15 | 15 |
16 typedef Result<const WasmModule*> ModuleResult; | 16 typedef Result<const WasmModule*> ModuleResult; |
17 typedef Result<WasmFunction*> FunctionResult; | 17 typedef Result<WasmFunction*> FunctionResult; |
18 typedef std::vector<std::pair<int, int>> FunctionOffsets; | 18 typedef std::vector<std::pair<int, int>> FunctionOffsets; |
19 typedef Result<FunctionOffsets> FunctionOffsetsResult; | 19 typedef Result<FunctionOffsets> FunctionOffsetsResult; |
20 typedef std::vector<std::vector<std::pair<int, int>>> AsmJsOffsets; | 20 typedef std::vector<std::vector<std::pair<int, int>>> AsmJsOffsets; |
21 typedef Result<AsmJsOffsets> AsmJsOffsetsResult; | 21 typedef Result<AsmJsOffsets> AsmJsOffsetsResult; |
22 | 22 |
23 // Decodes the bytes of a WASM module between {module_start} and {module_end}. | 23 // Decodes the bytes of a WASM module between {module_start} and {module_end}. |
24 V8_EXPORT_PRIVATE ModuleResult DecodeWasmModule(Isolate* isolate, Zone* zone, | 24 V8_EXPORT_PRIVATE ModuleResult DecodeWasmModule(Isolate* isolate, |
25 const byte* module_start, | 25 const byte* module_start, |
26 const byte* module_end, | 26 const byte* module_end, |
27 bool verify_functions, | 27 bool verify_functions, |
28 ModuleOrigin origin); | 28 ModuleOrigin origin); |
29 | 29 |
30 // Exposed for testing. Decodes a single function signature, allocating it | 30 // Exposed for testing. Decodes a single function signature, allocating it |
31 // in the given zone. Returns {nullptr} upon failure. | 31 // in the given zone. Returns {nullptr} upon failure. |
32 FunctionSig* DecodeWasmSignatureForTesting(Zone* zone, const byte* start, | 32 FunctionSig* DecodeWasmSignatureForTesting(Zone* zone, const byte* start, |
33 const byte* end); | 33 const byte* end); |
34 | 34 |
(...skipping 19 matching lines...) Expand all Loading... |
54 // is not complete. | 54 // is not complete. |
55 AsmJsOffsetsResult DecodeAsmJsOffsets(const byte* module_start, | 55 AsmJsOffsetsResult DecodeAsmJsOffsets(const byte* module_start, |
56 const byte* module_end, | 56 const byte* module_end, |
57 uint32_t num_imported_functions); | 57 uint32_t num_imported_functions); |
58 | 58 |
59 } // namespace wasm | 59 } // namespace wasm |
60 } // namespace internal | 60 } // namespace internal |
61 } // namespace v8 | 61 } // namespace v8 |
62 | 62 |
63 #endif // V8_WASM_MODULE_DECODER_H_ | 63 #endif // V8_WASM_MODULE_DECODER_H_ |
OLD | NEW |