Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(120)

Side by Side Diff: src/prettyprinter.cc

Issue 1394303008: Remove unused Zone argument from InitializeAstVisitor (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix cctests Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/prettyprinter.h ('k') | src/rewriter.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 #include "src/prettyprinter.h" 5 #include "src/prettyprinter.h"
6 6
7 #include <stdarg.h> 7 #include <stdarg.h>
8 8
9 #include "src/ast-value-factory.h" 9 #include "src/ast-value-factory.h"
10 #include "src/base/platform/platform.h" 10 #include "src/base/platform/platform.h"
11 #include "src/scopes.h" 11 #include "src/scopes.h"
12 12
13 namespace v8 { 13 namespace v8 {
14 namespace internal { 14 namespace internal {
15 15
16 CallPrinter::CallPrinter(Isolate* isolate, Zone* zone) { 16 CallPrinter::CallPrinter(Isolate* isolate) {
17 output_ = NULL; 17 output_ = NULL;
18 size_ = 0; 18 size_ = 0;
19 pos_ = 0; 19 pos_ = 0;
20 position_ = 0; 20 position_ = 0;
21 found_ = false; 21 found_ = false;
22 done_ = false; 22 done_ = false;
23 InitializeAstVisitor(isolate, zone); 23 InitializeAstVisitor(isolate);
24 } 24 }
25 25
26 26
27 CallPrinter::~CallPrinter() { DeleteArray(output_); } 27 CallPrinter::~CallPrinter() { DeleteArray(output_); }
28 28
29 29
30 const char* CallPrinter::Print(FunctionLiteral* program, int position) { 30 const char* CallPrinter::Print(FunctionLiteral* program, int position) {
31 Init(); 31 Init();
32 position_ = position; 32 position_ = position;
33 Find(program); 33 Find(program);
(...skipping 399 matching lines...) Expand 10 before | Expand all | Expand 10 after
433 static int FormatSlotNode(Vector<char>* buf, Expression* node, 433 static int FormatSlotNode(Vector<char>* buf, Expression* node,
434 const char* node_name, FeedbackVectorSlot slot) { 434 const char* node_name, FeedbackVectorSlot slot) {
435 int pos = SNPrintF(*buf, "%s", node_name); 435 int pos = SNPrintF(*buf, "%s", node_name);
436 if (!slot.IsInvalid()) { 436 if (!slot.IsInvalid()) {
437 pos = SNPrintF(*buf + pos, " Slot(%d)", slot.ToInt()); 437 pos = SNPrintF(*buf + pos, " Slot(%d)", slot.ToInt());
438 } 438 }
439 return pos; 439 return pos;
440 } 440 }
441 441
442 442
443 PrettyPrinter::PrettyPrinter(Isolate* isolate, Zone* zone) { 443 PrettyPrinter::PrettyPrinter(Isolate* isolate) {
444 output_ = NULL; 444 output_ = NULL;
445 size_ = 0; 445 size_ = 0;
446 pos_ = 0; 446 pos_ = 0;
447 InitializeAstVisitor(isolate, zone); 447 InitializeAstVisitor(isolate);
448 } 448 }
449 449
450 450
451 PrettyPrinter::~PrettyPrinter() { 451 PrettyPrinter::~PrettyPrinter() {
452 DeleteArray(output_); 452 DeleteArray(output_);
453 } 453 }
454 454
455 455
456 void PrettyPrinter::VisitBlock(Block* node) { 456 void PrettyPrinter::VisitBlock(Block* node) {
457 if (!node->ignore_completion_value()) Print("{ "); 457 if (!node->ignore_completion_value()) Print("{ ");
(...skipping 439 matching lines...) Expand 10 before | Expand all | Expand 10 after
897 897
898 898
899 const char* PrettyPrinter::PrintProgram(FunctionLiteral* program) { 899 const char* PrettyPrinter::PrintProgram(FunctionLiteral* program) {
900 Init(); 900 Init();
901 PrintStatements(program->body()); 901 PrintStatements(program->body());
902 Print("\n"); 902 Print("\n");
903 return output_; 903 return output_;
904 } 904 }
905 905
906 906
907 void PrettyPrinter::PrintOut(Isolate* isolate, Zone* zone, AstNode* node) { 907 void PrettyPrinter::PrintOut(Isolate* isolate, AstNode* node) {
908 PrettyPrinter printer(isolate, zone); 908 PrettyPrinter printer(isolate);
909 PrintF("%s\n", printer.Print(node)); 909 PrintF("%s\n", printer.Print(node));
910 } 910 }
911 911
912 912
913 void PrettyPrinter::Init() { 913 void PrettyPrinter::Init() {
914 if (size_ == 0) { 914 if (size_ == 0) {
915 DCHECK(output_ == NULL); 915 DCHECK(output_ == NULL);
916 const int initial_size = 256; 916 const int initial_size = 256;
917 output_ = NewArray<char>(initial_size); 917 output_ = NewArray<char>(initial_size);
918 size_ = initial_size; 918 size_ = initial_size;
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
1073 } 1073 }
1074 1074
1075 private: 1075 private:
1076 AstPrinter* ast_printer_; 1076 AstPrinter* ast_printer_;
1077 }; 1077 };
1078 1078
1079 1079
1080 //----------------------------------------------------------------------------- 1080 //-----------------------------------------------------------------------------
1081 1081
1082 1082
1083 AstPrinter::AstPrinter(Isolate* isolate, Zone* zone) 1083 AstPrinter::AstPrinter(Isolate* isolate) : PrettyPrinter(isolate), indent_(0) {}
1084 : PrettyPrinter(isolate, zone), indent_(0) {}
1085 1084
1086 1085
1087 AstPrinter::~AstPrinter() { 1086 AstPrinter::~AstPrinter() {
1088 DCHECK(indent_ == 0); 1087 DCHECK(indent_ == 0);
1089 } 1088 }
1090 1089
1091 1090
1092 void AstPrinter::PrintIndented(const char* txt) { 1091 void AstPrinter::PrintIndented(const char* txt) {
1093 for (int i = 0; i < indent_; i++) { 1092 for (int i = 0; i < indent_; i++) {
1094 Print(". "); 1093 Print(". ");
(...skipping 519 matching lines...) Expand 10 before | Expand all | Expand 10 after
1614 1613
1615 void AstPrinter::VisitSuperCallReference(SuperCallReference* node) { 1614 void AstPrinter::VisitSuperCallReference(SuperCallReference* node) {
1616 IndentedScope indent(this, "SUPER-CALL-REFERENCE", node->position()); 1615 IndentedScope indent(this, "SUPER-CALL-REFERENCE", node->position());
1617 } 1616 }
1618 1617
1619 1618
1620 #endif // DEBUG 1619 #endif // DEBUG
1621 1620
1622 } // namespace internal 1621 } // namespace internal
1623 } // namespace v8 1622 } // namespace v8
OLDNEW
« no previous file with comments | « src/prettyprinter.h ('k') | src/rewriter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698