Index: src/ast/prettyprinter.h |
diff --git a/src/ast/prettyprinter.h b/src/ast/prettyprinter.h |
index 61a118d13644c1a3b2f19e3a8ceb01d2ebd7c4c3..a011e221b46b4fdef0dfdb8f16034dd3c64ef50f 100644 |
--- a/src/ast/prettyprinter.h |
+++ b/src/ast/prettyprinter.h |
@@ -8,6 +8,7 @@ |
#include "src/allocation.h" |
#include "src/ast/ast.h" |
#include "src/base/compiler-specific.h" |
+#include "src/string-builder.h" |
namespace v8 { |
namespace internal { |
@@ -15,15 +16,10 @@ namespace internal { |
class CallPrinter final : public AstVisitor<CallPrinter> { |
public: |
explicit CallPrinter(Isolate* isolate, bool is_builtin); |
- ~CallPrinter(); |
// The following routine prints the node with position |position| into a |
- // string. The result string is alive as long as the CallPrinter is alive. |
- const char* Print(FunctionLiteral* program, int position); |
- |
- void PRINTF_FORMAT(2, 3) Print(const char* format, ...); |
- |
- void Find(AstNode* node, bool print = false); |
+ // string. |
+ Handle<String> Print(FunctionLiteral* program, int position); |
// Individual nodes |
#define DECLARE_VISIT(type) void Visit##type(type* node); |
@@ -31,11 +27,15 @@ class CallPrinter final : public AstVisitor<CallPrinter> { |
#undef DECLARE_VISIT |
private: |
- void Init(); |
+ // void PRINTF_FORMAT(2, 3) Print(const char* format, ...); |
+ void Print(const char* str); |
+ void Print(Handle<String> str); |
+ |
+ void Find(AstNode* node, bool print = false); |
+ |
Isolate* isolate_; |
- char* output_; // output string buffer |
- int size_; // output_ size |
- int pos_; // current printing position |
+ int num_prints_; |
+ IncrementalStringBuilder builder_; |
int position_; // position of ast node to print |
bool found_; |
bool done_; |