Index: src/ast/prettyprinter.h |
diff --git a/src/ast/prettyprinter.h b/src/ast/prettyprinter.h |
index 61a118d13644c1a3b2f19e3a8ceb01d2ebd7c4c3..9b0e22abc2470634f264d22cfee7da77560c3426 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,14 @@ class CallPrinter final : public AstVisitor<CallPrinter> { |
#undef DECLARE_VISIT |
private: |
- void Init(); |
+ 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_; |
@@ -44,7 +43,7 @@ class CallPrinter final : public AstVisitor<CallPrinter> { |
DEFINE_AST_VISITOR_SUBCLASS_MEMBERS(); |
protected: |
- void PrintLiteral(Object* value, bool quote); |
+ void PrintLiteral(Handle<Object> value, bool quote); |
void PrintLiteral(const AstRawString* value, bool quote); |
void FindStatements(ZoneList<Statement*>* statements); |
void FindArguments(ZoneList<Expression*>* arguments); |