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