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

Side by Side Diff: src/prettyprinter.cc

Issue 6811012: Remove some dead code. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 9 years, 8 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 | Annotate | Revision Log
« no previous file with comments | « src/prettyprinter.h ('k') | src/register-allocator.h » ('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 2006-2008 the V8 project authors. All rights reserved. 1 // Copyright 2006-2008 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 591 matching lines...) Expand 10 before | Expand all | Expand 10 after
602 602
603 class IndentedScope BASE_EMBEDDED { 603 class IndentedScope BASE_EMBEDDED {
604 public: 604 public:
605 explicit IndentedScope(AstPrinter* printer) : ast_printer_(printer) { 605 explicit IndentedScope(AstPrinter* printer) : ast_printer_(printer) {
606 ast_printer_->inc_indent(); 606 ast_printer_->inc_indent();
607 } 607 }
608 608
609 IndentedScope(AstPrinter* printer, const char* txt, AstNode* node = NULL) 609 IndentedScope(AstPrinter* printer, const char* txt, AstNode* node = NULL)
610 : ast_printer_(printer) { 610 : ast_printer_(printer) {
611 ast_printer_->PrintIndented(txt); 611 ast_printer_->PrintIndented(txt);
612 if (node != NULL && node->AsExpression() != NULL) {
613 Expression* expr = node->AsExpression();
614 bool printed_first = false;
615 if ((expr->type() != NULL) && (expr->type()->IsKnown())) {
616 ast_printer_->Print(" (type = ");
617 ast_printer_->Print(StaticType::Type2String(expr->type()));
618 printed_first = true;
619 }
620 if (printed_first) ast_printer_->Print(")");
621 }
622 ast_printer_->Print("\n"); 612 ast_printer_->Print("\n");
623 ast_printer_->inc_indent(); 613 ast_printer_->inc_indent();
624 } 614 }
625 615
626 virtual ~IndentedScope() { 616 virtual ~IndentedScope() {
627 ast_printer_->dec_indent(); 617 ast_printer_->dec_indent();
628 } 618 }
629 619
630 private: 620 private:
631 AstPrinter* ast_printer_; 621 AstPrinter* ast_printer_;
(...skipping 25 matching lines...) Expand all
657 bool quote) { 647 bool quote) {
658 PrintIndented(info); 648 PrintIndented(info);
659 Print(" "); 649 Print(" ");
660 PrintLiteral(value, quote); 650 PrintLiteral(value, quote);
661 Print("\n"); 651 Print("\n");
662 } 652 }
663 653
664 654
665 void AstPrinter::PrintLiteralWithModeIndented(const char* info, 655 void AstPrinter::PrintLiteralWithModeIndented(const char* info,
666 Variable* var, 656 Variable* var,
667 Handle<Object> value, 657 Handle<Object> value) {
668 StaticType* type) {
669 if (var == NULL) { 658 if (var == NULL) {
670 PrintLiteralIndented(info, value, true); 659 PrintLiteralIndented(info, value, true);
671 } else { 660 } else {
672 EmbeddedVector<char, 256> buf; 661 EmbeddedVector<char, 256> buf;
673 int pos = OS::SNPrintF(buf, "%s (mode = %s", info, 662 int pos = OS::SNPrintF(buf, "%s (mode = %s", info,
674 Variable::Mode2String(var->mode())); 663 Variable::Mode2String(var->mode()));
675 if (type->IsKnown()) {
676 pos += OS::SNPrintF(buf + pos, ", type = %s",
677 StaticType::Type2String(type));
678 }
679 OS::SNPrintF(buf + pos, ")"); 664 OS::SNPrintF(buf + pos, ")");
680 PrintLiteralIndented(buf.start(), value, true); 665 PrintLiteralIndented(buf.start(), value, true);
681 } 666 }
682 } 667 }
683 668
684 669
685 void AstPrinter::PrintLabelsIndented(const char* info, ZoneStringList* labels) { 670 void AstPrinter::PrintLabelsIndented(const char* info, ZoneStringList* labels) {
686 if (labels != NULL && labels->length() > 0) { 671 if (labels != NULL && labels->length() > 0) {
687 if (info == NULL) { 672 if (info == NULL) {
688 PrintIndented("LABELS "); 673 PrintIndented("LABELS ");
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
725 } 710 }
726 } 711 }
727 } 712 }
728 713
729 714
730 void AstPrinter::PrintParameters(Scope* scope) { 715 void AstPrinter::PrintParameters(Scope* scope) {
731 if (scope->num_parameters() > 0) { 716 if (scope->num_parameters() > 0) {
732 IndentedScope indent(this, "PARAMS"); 717 IndentedScope indent(this, "PARAMS");
733 for (int i = 0; i < scope->num_parameters(); i++) { 718 for (int i = 0; i < scope->num_parameters(); i++) {
734 PrintLiteralWithModeIndented("VAR", scope->parameter(i), 719 PrintLiteralWithModeIndented("VAR", scope->parameter(i),
735 scope->parameter(i)->name(), 720 scope->parameter(i)->name());
736 scope->parameter(i)->type());
737 } 721 }
738 } 722 }
739 } 723 }
740 724
741 725
742 void AstPrinter::PrintStatements(ZoneList<Statement*>* statements) { 726 void AstPrinter::PrintStatements(ZoneList<Statement*>* statements) {
743 for (int i = 0; i < statements->length(); i++) { 727 for (int i = 0; i < statements->length(); i++) {
744 Visit(statements->at(i)); 728 Visit(statements->at(i));
745 } 729 }
746 } 730 }
(...skipping 23 matching lines...) Expand all
770 IndentedScope indent(this, block_txt); 754 IndentedScope indent(this, block_txt);
771 PrintStatements(node->statements()); 755 PrintStatements(node->statements());
772 } 756 }
773 757
774 758
775 void AstPrinter::VisitDeclaration(Declaration* node) { 759 void AstPrinter::VisitDeclaration(Declaration* node) {
776 if (node->fun() == NULL) { 760 if (node->fun() == NULL) {
777 // var or const declarations 761 // var or const declarations
778 PrintLiteralWithModeIndented(Variable::Mode2String(node->mode()), 762 PrintLiteralWithModeIndented(Variable::Mode2String(node->mode()),
779 node->proxy()->AsVariable(), 763 node->proxy()->AsVariable(),
780 node->proxy()->name(), 764 node->proxy()->name());
781 node->proxy()->AsVariable()->type());
782 } else { 765 } else {
783 // function declarations 766 // function declarations
784 PrintIndented("FUNCTION "); 767 PrintIndented("FUNCTION ");
785 PrintLiteral(node->proxy()->name(), true); 768 PrintLiteral(node->proxy()->name(), true);
786 Print(" = function "); 769 Print(" = function ");
787 PrintLiteral(node->fun()->name(), false); 770 PrintLiteral(node->fun()->name(), false);
788 Print("\n"); 771 Print("\n");
789 } 772 }
790 } 773 }
791 774
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
989 972
990 973
991 void AstPrinter::VisitSlot(Slot* node) { 974 void AstPrinter::VisitSlot(Slot* node) {
992 PrintIndented("SLOT "); 975 PrintIndented("SLOT ");
993 PrettyPrinter::VisitSlot(node); 976 PrettyPrinter::VisitSlot(node);
994 Print("\n"); 977 Print("\n");
995 } 978 }
996 979
997 980
998 void AstPrinter::VisitVariableProxy(VariableProxy* node) { 981 void AstPrinter::VisitVariableProxy(VariableProxy* node) {
999 PrintLiteralWithModeIndented("VAR PROXY", node->AsVariable(), node->name(), 982 PrintLiteralWithModeIndented("VAR PROXY", node->AsVariable(), node->name());
1000 node->type());
1001 Variable* var = node->var(); 983 Variable* var = node->var();
1002 if (var != NULL && var->rewrite() != NULL) { 984 if (var != NULL && var->rewrite() != NULL) {
1003 IndentedScope indent(this); 985 IndentedScope indent(this);
1004 Visit(var->rewrite()); 986 Visit(var->rewrite());
1005 } 987 }
1006 } 988 }
1007 989
1008 990
1009 void AstPrinter::VisitAssignment(Assignment* node) { 991 void AstPrinter::VisitAssignment(Assignment* node) {
1010 IndentedScope indent(this, Token::Name(node->op()), node); 992 IndentedScope indent(this, Token::Name(node->op()), node);
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
1056 } 1038 }
1057 1039
1058 1040
1059 void AstPrinter::VisitIncrementOperation(IncrementOperation* node) { 1041 void AstPrinter::VisitIncrementOperation(IncrementOperation* node) {
1060 UNREACHABLE(); 1042 UNREACHABLE();
1061 } 1043 }
1062 1044
1063 1045
1064 void AstPrinter::VisitCountOperation(CountOperation* node) { 1046 void AstPrinter::VisitCountOperation(CountOperation* node) {
1065 EmbeddedVector<char, 128> buf; 1047 EmbeddedVector<char, 128> buf;
1066 if (node->type()->IsKnown()) { 1048 OS::SNPrintF(buf, "%s %s", (node->is_prefix() ? "PRE" : "POST"),
1067 OS::SNPrintF(buf, "%s %s (type = %s)", 1049 Token::Name(node->op()));
1068 (node->is_prefix() ? "PRE" : "POST"),
1069 Token::Name(node->op()),
1070 StaticType::Type2String(node->type()));
1071 } else {
1072 OS::SNPrintF(buf, "%s %s", (node->is_prefix() ? "PRE" : "POST"),
1073 Token::Name(node->op()));
1074 }
1075 PrintIndentedVisit(buf.start(), node->expression()); 1050 PrintIndentedVisit(buf.start(), node->expression());
1076 } 1051 }
1077 1052
1078 1053
1079 void AstPrinter::VisitBinaryOperation(BinaryOperation* node) { 1054 void AstPrinter::VisitBinaryOperation(BinaryOperation* node) {
1080 IndentedScope indent(this, Token::Name(node->op()), node); 1055 IndentedScope indent(this, Token::Name(node->op()), node);
1081 Visit(node->left()); 1056 Visit(node->left());
1082 Visit(node->right()); 1057 Visit(node->right());
1083 } 1058 }
1084 1059
(...skipping 436 matching lines...) Expand 10 before | Expand all | Expand 10 after
1521 AddAttribute("mode", Variable::Mode2String(decl->mode())); 1496 AddAttribute("mode", Variable::Mode2String(decl->mode()));
1522 } 1497 }
1523 Visit(decl->proxy()); 1498 Visit(decl->proxy());
1524 if (decl->fun() != NULL) Visit(decl->fun()); 1499 if (decl->fun() != NULL) Visit(decl->fun());
1525 } 1500 }
1526 1501
1527 1502
1528 #endif // DEBUG 1503 #endif // DEBUG
1529 1504
1530 } } // namespace v8::internal 1505 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/prettyprinter.h ('k') | src/register-allocator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698