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/decoder.h" | 9 #include "src/wasm/decoder.h" |
10 #include "src/wasm/wasm-opcodes.h" | 10 #include "src/wasm/wasm-opcodes.h" |
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
217 typedef Result<Tree*> TreeResult; | 217 typedef Result<Tree*> TreeResult; |
218 | 218 |
219 std::ostream& operator<<(std::ostream& os, const Tree& tree); | 219 std::ostream& operator<<(std::ostream& os, const Tree& tree); |
220 | 220 |
221 TreeResult VerifyWasmCode(base::AccountingAllocator* allocator, | 221 TreeResult VerifyWasmCode(base::AccountingAllocator* allocator, |
222 FunctionBody& body); | 222 FunctionBody& body); |
223 TreeResult BuildTFGraph(base::AccountingAllocator* allocator, | 223 TreeResult BuildTFGraph(base::AccountingAllocator* allocator, |
224 TFBuilder* builder, FunctionBody& body); | 224 TFBuilder* builder, FunctionBody& body); |
225 void PrintAst(base::AccountingAllocator* allocator, FunctionBody& body); | 225 void PrintAst(base::AccountingAllocator* allocator, FunctionBody& body); |
226 | 226 |
| 227 // A simplified form of AST printing, e.g. from a debugger. |
| 228 void PrintAstForDebugging(const byte* start, const byte* end); |
| 229 |
227 inline TreeResult VerifyWasmCode(base::AccountingAllocator* allocator, | 230 inline TreeResult VerifyWasmCode(base::AccountingAllocator* allocator, |
228 ModuleEnv* module, FunctionSig* sig, | 231 ModuleEnv* module, FunctionSig* sig, |
229 const byte* start, const byte* end) { | 232 const byte* start, const byte* end) { |
230 FunctionBody body = {module, sig, nullptr, start, end}; | 233 FunctionBody body = {module, sig, nullptr, start, end}; |
231 return VerifyWasmCode(allocator, body); | 234 return VerifyWasmCode(allocator, body); |
232 } | 235 } |
233 | 236 |
234 inline TreeResult BuildTFGraph(base::AccountingAllocator* allocator, | 237 inline TreeResult BuildTFGraph(base::AccountingAllocator* allocator, |
235 TFBuilder* builder, ModuleEnv* module, | 238 TFBuilder* builder, ModuleEnv* module, |
236 FunctionSig* sig, const byte* start, | 239 FunctionSig* sig, const byte* start, |
(...skipping 25 matching lines...) Expand all Loading... |
262 int OpcodeLength(const byte* pc, const byte* end); | 265 int OpcodeLength(const byte* pc, const byte* end); |
263 | 266 |
264 // Computes the arity (number of sub-nodes) of the opcode at the given address. | 267 // Computes the arity (number of sub-nodes) of the opcode at the given address. |
265 int OpcodeArity(const byte* pc, const byte* end); | 268 int OpcodeArity(const byte* pc, const byte* end); |
266 | 269 |
267 } // namespace wasm | 270 } // namespace wasm |
268 } // namespace internal | 271 } // namespace internal |
269 } // namespace v8 | 272 } // namespace v8 |
270 | 273 |
271 #endif // V8_WASM_AST_DECODER_H_ | 274 #endif // V8_WASM_AST_DECODER_H_ |
OLD | NEW |