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_AST_DECODER_H_ | 5 #ifndef V8_WASM_AST_DECODER_H_ |
6 #define V8_WASM_AST_DECODER_H_ | 6 #define V8_WASM_AST_DECODER_H_ |
7 | 7 |
8 #include "src/signature.h" | 8 #include "src/signature.h" |
9 #include "src/wasm/wasm-opcodes.h" | 9 #include "src/wasm/wasm-opcodes.h" |
10 #include "src/wasm/wasm-result.h" | 10 #include "src/wasm/wasm-result.h" |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 struct Tree; | 82 struct Tree; |
83 typedef Result<Tree*> TreeResult; | 83 typedef Result<Tree*> TreeResult; |
84 | 84 |
85 std::ostream& operator<<(std::ostream& os, const Tree& tree); | 85 std::ostream& operator<<(std::ostream& os, const Tree& tree); |
86 | 86 |
87 TreeResult VerifyWasmCode(FunctionEnv* env, const byte* base, const byte* start, | 87 TreeResult VerifyWasmCode(FunctionEnv* env, const byte* base, const byte* start, |
88 const byte* end); | 88 const byte* end); |
89 TreeResult BuildTFGraph(TFBuilder* builder, FunctionEnv* env, const byte* base, | 89 TreeResult BuildTFGraph(TFBuilder* builder, FunctionEnv* env, const byte* base, |
90 const byte* start, const byte* end); | 90 const byte* start, const byte* end); |
91 | 91 |
| 92 void PrintAst(FunctionEnv* env, const byte* start, const byte* end); |
| 93 |
92 inline TreeResult VerifyWasmCode(FunctionEnv* env, const byte* start, | 94 inline TreeResult VerifyWasmCode(FunctionEnv* env, const byte* start, |
93 const byte* end) { | 95 const byte* end) { |
94 return VerifyWasmCode(env, nullptr, start, end); | 96 return VerifyWasmCode(env, nullptr, start, end); |
95 } | 97 } |
96 | 98 |
97 inline TreeResult BuildTFGraph(TFBuilder* builder, FunctionEnv* env, | 99 inline TreeResult BuildTFGraph(TFBuilder* builder, FunctionEnv* env, |
98 const byte* start, const byte* end) { | 100 const byte* start, const byte* end) { |
99 return BuildTFGraph(builder, env, nullptr, start, end); | 101 return BuildTFGraph(builder, env, nullptr, start, end); |
100 } | 102 } |
101 | 103 |
102 enum ReadUnsignedLEB128ErrorCode { kNoError, kInvalidLEB128, kMissingLEB128 }; | 104 enum ReadUnsignedLEB128ErrorCode { kNoError, kInvalidLEB128, kMissingLEB128 }; |
103 | 105 |
104 ReadUnsignedLEB128ErrorCode ReadUnsignedLEB128Operand(const byte*, const byte*, | 106 ReadUnsignedLEB128ErrorCode ReadUnsignedLEB128Operand(const byte*, const byte*, |
105 int*, uint32_t*); | 107 int*, uint32_t*); |
106 | 108 |
107 // Computes the length of the opcode at the given address. | 109 // Computes the length of the opcode at the given address. |
108 int OpcodeLength(const byte* pc); | 110 int OpcodeLength(const byte* pc); |
109 | 111 |
110 // Computes the arity (number of sub-nodes) of the opcode at the given address. | 112 // Computes the arity (number of sub-nodes) of the opcode at the given address. |
111 int OpcodeArity(FunctionEnv* env, const byte* pc); | 113 int OpcodeArity(FunctionEnv* env, const byte* pc); |
112 } // namespace wasm | 114 } // namespace wasm |
113 } // namespace internal | 115 } // namespace internal |
114 } // namespace v8 | 116 } // namespace v8 |
115 | 117 |
116 #endif // V8_WASM_AST_DECODER_H_ | 118 #endif // V8_WASM_AST_DECODER_H_ |
OLD | NEW |