| 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 576 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 587 | 587 |
| 588 | 588 |
| 589 //----------------------------------------------------------------------------- | 589 //----------------------------------------------------------------------------- |
| 590 | 590 |
| 591 class IndentedScope BASE_EMBEDDED { | 591 class IndentedScope BASE_EMBEDDED { |
| 592 public: | 592 public: |
| 593 IndentedScope() { | 593 IndentedScope() { |
| 594 ast_printer_->inc_indent(); | 594 ast_printer_->inc_indent(); |
| 595 } | 595 } |
| 596 | 596 |
| 597 explicit IndentedScope(const char* txt, SmiAnalysis* type = NULL) { | 597 explicit IndentedScope(const char* txt, StaticType* type = NULL) { |
| 598 ast_printer_->PrintIndented(txt); | 598 ast_printer_->PrintIndented(txt); |
| 599 if ((type != NULL) && (type->IsKnown())) { | 599 if ((type != NULL) && (type->IsKnown())) { |
| 600 ast_printer_->Print(" (type = "); | 600 ast_printer_->Print(" (type = "); |
| 601 ast_printer_->Print(SmiAnalysis::Type2String(type)); | 601 ast_printer_->Print(StaticType::Type2String(type)); |
| 602 ast_printer_->Print(")"); | 602 ast_printer_->Print(")"); |
| 603 } | 603 } |
| 604 ast_printer_->Print("\n"); | 604 ast_printer_->Print("\n"); |
| 605 ast_printer_->inc_indent(); | 605 ast_printer_->inc_indent(); |
| 606 } | 606 } |
| 607 | 607 |
| 608 virtual ~IndentedScope() { | 608 virtual ~IndentedScope() { |
| 609 ast_printer_->dec_indent(); | 609 ast_printer_->dec_indent(); |
| 610 } | 610 } |
| 611 | 611 |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 650 PrintIndented(info); | 650 PrintIndented(info); |
| 651 Print(" "); | 651 Print(" "); |
| 652 PrintLiteral(value, quote); | 652 PrintLiteral(value, quote); |
| 653 Print("\n"); | 653 Print("\n"); |
| 654 } | 654 } |
| 655 | 655 |
| 656 | 656 |
| 657 void AstPrinter::PrintLiteralWithModeIndented(const char* info, | 657 void AstPrinter::PrintLiteralWithModeIndented(const char* info, |
| 658 Variable* var, | 658 Variable* var, |
| 659 Handle<Object> value, | 659 Handle<Object> value, |
| 660 SmiAnalysis* type) { | 660 StaticType* type) { |
| 661 if (var == NULL) { | 661 if (var == NULL) { |
| 662 PrintLiteralIndented(info, value, true); | 662 PrintLiteralIndented(info, value, true); |
| 663 } else { | 663 } else { |
| 664 EmbeddedVector<char, 256> buf; | 664 EmbeddedVector<char, 256> buf; |
| 665 if (type->IsKnown()) { | 665 if (type->IsKnown()) { |
| 666 OS::SNPrintF(buf, "%s (mode = %s, type = %s)", info, | 666 OS::SNPrintF(buf, "%s (mode = %s, type = %s)", info, |
| 667 Variable::Mode2String(var->mode()), | 667 Variable::Mode2String(var->mode()), |
| 668 SmiAnalysis::Type2String(type)); | 668 StaticType::Type2String(type)); |
| 669 } else { | 669 } else { |
| 670 OS::SNPrintF(buf, "%s (mode = %s)", info, | 670 OS::SNPrintF(buf, "%s (mode = %s)", info, |
| 671 Variable::Mode2String(var->mode())); | 671 Variable::Mode2String(var->mode())); |
| 672 } | 672 } |
| 673 PrintLiteralIndented(buf.start(), value, true); | 673 PrintLiteralIndented(buf.start(), value, true); |
| 674 } | 674 } |
| 675 } | 675 } |
| 676 | 676 |
| 677 | 677 |
| 678 void AstPrinter::PrintLabelsIndented(const char* info, ZoneStringList* labels) { | 678 void AstPrinter::PrintLabelsIndented(const char* info, ZoneStringList* labels) { |
| (...skipping 386 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1065 PrintIndentedVisit(Token::Name(node->op()), node->expression()); | 1065 PrintIndentedVisit(Token::Name(node->op()), node->expression()); |
| 1066 } | 1066 } |
| 1067 | 1067 |
| 1068 | 1068 |
| 1069 void AstPrinter::VisitCountOperation(CountOperation* node) { | 1069 void AstPrinter::VisitCountOperation(CountOperation* node) { |
| 1070 EmbeddedVector<char, 128> buf; | 1070 EmbeddedVector<char, 128> buf; |
| 1071 if (node->type()->IsKnown()) { | 1071 if (node->type()->IsKnown()) { |
| 1072 OS::SNPrintF(buf, "%s %s (type = %s)", | 1072 OS::SNPrintF(buf, "%s %s (type = %s)", |
| 1073 (node->is_prefix() ? "PRE" : "POST"), | 1073 (node->is_prefix() ? "PRE" : "POST"), |
| 1074 Token::Name(node->op()), | 1074 Token::Name(node->op()), |
| 1075 SmiAnalysis::Type2String(node->type())); | 1075 StaticType::Type2String(node->type())); |
| 1076 } else { | 1076 } else { |
| 1077 OS::SNPrintF(buf, "%s %s", (node->is_prefix() ? "PRE" : "POST"), | 1077 OS::SNPrintF(buf, "%s %s", (node->is_prefix() ? "PRE" : "POST"), |
| 1078 Token::Name(node->op())); | 1078 Token::Name(node->op())); |
| 1079 } | 1079 } |
| 1080 PrintIndentedVisit(buf.start(), node->expression()); | 1080 PrintIndentedVisit(buf.start(), node->expression()); |
| 1081 } | 1081 } |
| 1082 | 1082 |
| 1083 | 1083 |
| 1084 void AstPrinter::VisitBinaryOperation(BinaryOperation* node) { | 1084 void AstPrinter::VisitBinaryOperation(BinaryOperation* node) { |
| 1085 IndentedScope indent(Token::Name(node->op()), node->type()); | 1085 IndentedScope indent(Token::Name(node->op()), node->type()); |
| (...skipping 416 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1502 AddAttribute("mode", Variable::Mode2String(decl->mode())); | 1502 AddAttribute("mode", Variable::Mode2String(decl->mode())); |
| 1503 } | 1503 } |
| 1504 Visit(decl->proxy()); | 1504 Visit(decl->proxy()); |
| 1505 if (decl->fun() != NULL) Visit(decl->fun()); | 1505 if (decl->fun() != NULL) Visit(decl->fun()); |
| 1506 } | 1506 } |
| 1507 | 1507 |
| 1508 | 1508 |
| 1509 #endif // DEBUG | 1509 #endif // DEBUG |
| 1510 | 1510 |
| 1511 } } // namespace v8::internal | 1511 } } // namespace v8::internal |
| OLD | NEW |