| OLD | NEW |
| 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 584 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 595 | 595 |
| 596 | 596 |
| 597 //----------------------------------------------------------------------------- | 597 //----------------------------------------------------------------------------- |
| 598 | 598 |
| 599 class IndentedScope BASE_EMBEDDED { | 599 class IndentedScope BASE_EMBEDDED { |
| 600 public: | 600 public: |
| 601 IndentedScope() { | 601 IndentedScope() { |
| 602 ast_printer_->inc_indent(); | 602 ast_printer_->inc_indent(); |
| 603 } | 603 } |
| 604 | 604 |
| 605 explicit IndentedScope(const char* txt, StaticType* type = NULL) { | 605 explicit IndentedScope(const char* txt, SmiAnalysis* type = NULL) { |
| 606 ast_printer_->PrintIndented(txt); | 606 ast_printer_->PrintIndented(txt); |
| 607 if ((type != NULL) && (type->IsKnown())) { | 607 if ((type != NULL) && (type->IsKnown())) { |
| 608 ast_printer_->Print(" (type = "); | 608 ast_printer_->Print(" (type = "); |
| 609 ast_printer_->Print(StaticType::Type2String(type)); | 609 ast_printer_->Print(SmiAnalysis::Type2String(type)); |
| 610 ast_printer_->Print(")"); | 610 ast_printer_->Print(")"); |
| 611 } | 611 } |
| 612 ast_printer_->Print("\n"); | 612 ast_printer_->Print("\n"); |
| 613 ast_printer_->inc_indent(); | 613 ast_printer_->inc_indent(); |
| 614 } | 614 } |
| 615 | 615 |
| 616 virtual ~IndentedScope() { | 616 virtual ~IndentedScope() { |
| 617 ast_printer_->dec_indent(); | 617 ast_printer_->dec_indent(); |
| 618 } | 618 } |
| 619 | 619 |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 658 PrintIndented(info); | 658 PrintIndented(info); |
| 659 Print(" "); | 659 Print(" "); |
| 660 PrintLiteral(value, quote); | 660 PrintLiteral(value, quote); |
| 661 Print("\n"); | 661 Print("\n"); |
| 662 } | 662 } |
| 663 | 663 |
| 664 | 664 |
| 665 void AstPrinter::PrintLiteralWithModeIndented(const char* info, | 665 void AstPrinter::PrintLiteralWithModeIndented(const char* info, |
| 666 Variable* var, | 666 Variable* var, |
| 667 Handle<Object> value, | 667 Handle<Object> value, |
| 668 StaticType* type) { | 668 SmiAnalysis* type) { |
| 669 if (var == NULL) { | 669 if (var == NULL) { |
| 670 PrintLiteralIndented(info, value, true); | 670 PrintLiteralIndented(info, value, true); |
| 671 } else { | 671 } else { |
| 672 EmbeddedVector<char, 256> buf; | 672 EmbeddedVector<char, 256> buf; |
| 673 if (type->IsKnown()) { | 673 if (type->IsKnown()) { |
| 674 OS::SNPrintF(buf, "%s (mode = %s, type = %s)", info, | 674 OS::SNPrintF(buf, "%s (mode = %s, type = %s)", info, |
| 675 Variable::Mode2String(var->mode()), | 675 Variable::Mode2String(var->mode()), |
| 676 StaticType::Type2String(type)); | 676 SmiAnalysis::Type2String(type)); |
| 677 } else { | 677 } else { |
| 678 OS::SNPrintF(buf, "%s (mode = %s)", info, | 678 OS::SNPrintF(buf, "%s (mode = %s)", info, |
| 679 Variable::Mode2String(var->mode())); | 679 Variable::Mode2String(var->mode())); |
| 680 } | 680 } |
| 681 PrintLiteralIndented(buf.start(), value, true); | 681 PrintLiteralIndented(buf.start(), value, true); |
| 682 } | 682 } |
| 683 } | 683 } |
| 684 | 684 |
| 685 | 685 |
| 686 void AstPrinter::PrintLabelsIndented(const char* info, ZoneStringList* labels) { | 686 void AstPrinter::PrintLabelsIndented(const char* info, ZoneStringList* labels) { |
| (...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1059 PrintIndentedVisit(Token::Name(node->op()), node->expression()); | 1059 PrintIndentedVisit(Token::Name(node->op()), node->expression()); |
| 1060 } | 1060 } |
| 1061 | 1061 |
| 1062 | 1062 |
| 1063 void AstPrinter::VisitCountOperation(CountOperation* node) { | 1063 void AstPrinter::VisitCountOperation(CountOperation* node) { |
| 1064 EmbeddedVector<char, 128> buf; | 1064 EmbeddedVector<char, 128> buf; |
| 1065 if (node->type()->IsKnown()) { | 1065 if (node->type()->IsKnown()) { |
| 1066 OS::SNPrintF(buf, "%s %s (type = %s)", | 1066 OS::SNPrintF(buf, "%s %s (type = %s)", |
| 1067 (node->is_prefix() ? "PRE" : "POST"), | 1067 (node->is_prefix() ? "PRE" : "POST"), |
| 1068 Token::Name(node->op()), | 1068 Token::Name(node->op()), |
| 1069 StaticType::Type2String(node->type())); | 1069 SmiAnalysis::Type2String(node->type())); |
| 1070 } else { | 1070 } else { |
| 1071 OS::SNPrintF(buf, "%s %s", (node->is_prefix() ? "PRE" : "POST"), | 1071 OS::SNPrintF(buf, "%s %s", (node->is_prefix() ? "PRE" : "POST"), |
| 1072 Token::Name(node->op())); | 1072 Token::Name(node->op())); |
| 1073 } | 1073 } |
| 1074 PrintIndentedVisit(buf.start(), node->expression()); | 1074 PrintIndentedVisit(buf.start(), node->expression()); |
| 1075 } | 1075 } |
| 1076 | 1076 |
| 1077 | 1077 |
| 1078 void AstPrinter::VisitBinaryOperation(BinaryOperation* node) { | 1078 void AstPrinter::VisitBinaryOperation(BinaryOperation* node) { |
| 1079 IndentedScope indent(Token::Name(node->op()), node->type()); | 1079 IndentedScope indent(Token::Name(node->op()), node->type()); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 1091 | 1091 |
| 1092 void AstPrinter::VisitThisFunction(ThisFunction* node) { | 1092 void AstPrinter::VisitThisFunction(ThisFunction* node) { |
| 1093 IndentedScope indent("THIS-FUNCTION"); | 1093 IndentedScope indent("THIS-FUNCTION"); |
| 1094 } | 1094 } |
| 1095 | 1095 |
| 1096 | 1096 |
| 1097 | 1097 |
| 1098 #endif // DEBUG | 1098 #endif // DEBUG |
| 1099 | 1099 |
| 1100 } } // namespace v8::internal | 1100 } } // namespace v8::internal |
| OLD | NEW |