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 | 11 |
11 namespace v8 { | 12 namespace v8 { |
12 namespace internal { | 13 namespace internal { |
13 namespace wasm { | 14 namespace wasm { |
| 15 |
| 16 typedef Result<const WasmModule*> ModuleResult; |
| 17 typedef Result<WasmFunction*> FunctionResult; |
| 18 typedef std::vector<std::pair<int, int>> FunctionOffsets; |
| 19 typedef Result<FunctionOffsets> FunctionOffsetsResult; |
| 20 |
14 // Decodes the bytes of a WASM module between {module_start} and {module_end}. | 21 // Decodes the bytes of a WASM module between {module_start} and {module_end}. |
15 V8_EXPORT_PRIVATE ModuleResult DecodeWasmModule(Isolate* isolate, Zone* zone, | 22 V8_EXPORT_PRIVATE ModuleResult DecodeWasmModule(Isolate* isolate, Zone* zone, |
16 const byte* module_start, | 23 const byte* module_start, |
17 const byte* module_end, | 24 const byte* module_end, |
18 bool verify_functions, | 25 bool verify_functions, |
19 ModuleOrigin origin); | 26 ModuleOrigin origin); |
20 | 27 |
21 // Exposed for testing. Decodes a single function signature, allocating it | 28 // Exposed for testing. Decodes a single function signature, allocating it |
22 // in the given zone. Returns {nullptr} upon failure. | 29 // in the given zone. Returns {nullptr} upon failure. |
23 FunctionSig* DecodeWasmSignatureForTesting(Zone* zone, const byte* start, | 30 FunctionSig* DecodeWasmSignatureForTesting(Zone* zone, const byte* start, |
(...skipping 12 matching lines...) Expand all Loading... |
36 const byte* module_start, const byte* module_end, | 43 const byte* module_start, const byte* module_end, |
37 uint32_t num_imported_functions); | 44 uint32_t num_imported_functions); |
38 | 45 |
39 WasmInitExpr DecodeWasmInitExprForTesting(const byte* start, const byte* end); | 46 WasmInitExpr DecodeWasmInitExprForTesting(const byte* start, const byte* end); |
40 | 47 |
41 } // namespace wasm | 48 } // namespace wasm |
42 } // namespace internal | 49 } // namespace internal |
43 } // namespace v8 | 50 } // namespace v8 |
44 | 51 |
45 #endif // V8_WASM_MODULE_DECODER_H_ | 52 #endif // V8_WASM_MODULE_DECODER_H_ |
OLD | NEW |