Chromium Code Reviews

Unified Diff: src/wasm/ast-decoder.h

Issue 2050213002: [wasm] Implement AST printing into an ostream (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@refactor-function-names-table
Patch Set: see if adding <functional> include fixes this Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Index: src/wasm/ast-decoder.h
diff --git a/src/wasm/ast-decoder.h b/src/wasm/ast-decoder.h
index 9e96053a6ce035773fbe9f992e24d2f0e8430c35..1b322fd05bccd87a21fde4ed0ab14549b0f4b65c 100644
--- a/src/wasm/ast-decoder.h
+++ b/src/wasm/ast-decoder.h
@@ -5,6 +5,8 @@
#ifndef V8_WASM_AST_DECODER_H_
#define V8_WASM_AST_DECODER_H_
+#include <functional>
+
#include "src/signature.h"
#include "src/wasm/decoder.h"
#include "src/wasm/wasm-opcodes.h"
@@ -211,6 +213,9 @@ struct FunctionBody {
const byte* base; // base of the module bytes, for error reporting
const byte* start; // start of the function body
const byte* end; // end of the function body
+ static FunctionBody ForTesting(const byte* start, const byte* end) {
titzer 2016/06/10 10:57:40 Can you please move this out to the top level? (st
Clemens Hammacher 2016/06/13 09:45:17 Done. Not sure though if style guide really advise
+ return {nullptr, nullptr, start, start, end};
+ }
};
struct Tree;
@@ -222,7 +227,9 @@ TreeResult VerifyWasmCode(base::AccountingAllocator* allocator,
FunctionBody& body);
TreeResult BuildTFGraph(base::AccountingAllocator* allocator,
TFBuilder* builder, FunctionBody& body);
-void PrintAst(base::AccountingAllocator* allocator, FunctionBody& body);
+bool PrintAst(base::AccountingAllocator* allocator, const FunctionBody& body,
+ std::ostream& os,
+ std::function<void(uint32_t)> instruction_callback = {});
titzer 2016/06/10 10:57:40 There isn't a usecase for the instruction_callback
Clemens Hammacher 2016/06/13 09:45:17 Done.
// A simplified form of AST printing, e.g. from a debugger.
void PrintAstForDebugging(const byte* start, const byte* end);
« no previous file with comments | « src/ostreams.cc ('k') | src/wasm/ast-decoder.cc » ('j') | src/wasm/ast-decoder.cc » ('J')

Powered by Google App Engine