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

Side by Side Diff: src/prettyprinter.cc

Issue 1132005: Add iterative primitive type analysis.... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 10 years, 9 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') | no next file » | 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 650 matching lines...) Expand 10 before | Expand all | Expand 10 after
661 Print(" "); 661 Print(" ");
662 PrintLiteral(value, quote); 662 PrintLiteral(value, quote);
663 Print("\n"); 663 Print("\n");
664 } 664 }
665 665
666 666
667 void AstPrinter::PrintLiteralWithModeIndented(const char* info, 667 void AstPrinter::PrintLiteralWithModeIndented(const char* info,
668 Variable* var, 668 Variable* var,
669 Handle<Object> value, 669 Handle<Object> value,
670 StaticType* type, 670 StaticType* type,
671 int num) { 671 int num,
672 bool is_primitive) {
672 if (var == NULL) { 673 if (var == NULL) {
673 PrintLiteralIndented(info, value, true); 674 PrintLiteralIndented(info, value, true);
674 } else { 675 } else {
675 EmbeddedVector<char, 256> buf; 676 EmbeddedVector<char, 256> buf;
676 int pos = OS::SNPrintF(buf, "%s (mode = %s", info, 677 int pos = OS::SNPrintF(buf, "%s (mode = %s", info,
677 Variable::Mode2String(var->mode())); 678 Variable::Mode2String(var->mode()));
678 if (type->IsKnown()) { 679 if (type->IsKnown()) {
679 pos += OS::SNPrintF(buf + pos, ", type = %s", 680 pos += OS::SNPrintF(buf + pos, ", type = %s",
680 StaticType::Type2String(type)); 681 StaticType::Type2String(type));
681 } 682 }
682 if (num != AstNode::kNoNumber) { 683 if (num != AstNode::kNoNumber) {
683 pos += OS::SNPrintF(buf + pos, ", num = %d", num); 684 pos += OS::SNPrintF(buf + pos, ", num = %d", num);
684 } 685 }
686 pos += OS::SNPrintF(buf + pos,
687 is_primitive ? ", primitive" : ", non-primitive");
685 OS::SNPrintF(buf + pos, ")"); 688 OS::SNPrintF(buf + pos, ")");
686 PrintLiteralIndented(buf.start(), value, true); 689 PrintLiteralIndented(buf.start(), value, true);
687 } 690 }
688 } 691 }
689 692
690 693
691 void AstPrinter::PrintLabelsIndented(const char* info, ZoneStringList* labels) { 694 void AstPrinter::PrintLabelsIndented(const char* info, ZoneStringList* labels) {
692 if (labels != NULL && labels->length() > 0) { 695 if (labels != NULL && labels->length() > 0) {
693 if (info == NULL) { 696 if (info == NULL) {
694 PrintIndented("LABELS "); 697 PrintIndented("LABELS ");
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
733 } 736 }
734 737
735 738
736 void AstPrinter::PrintParameters(Scope* scope) { 739 void AstPrinter::PrintParameters(Scope* scope) {
737 if (scope->num_parameters() > 0) { 740 if (scope->num_parameters() > 0) {
738 IndentedScope indent("PARAMS"); 741 IndentedScope indent("PARAMS");
739 for (int i = 0; i < scope->num_parameters(); i++) { 742 for (int i = 0; i < scope->num_parameters(); i++) {
740 PrintLiteralWithModeIndented("VAR", scope->parameter(i), 743 PrintLiteralWithModeIndented("VAR", scope->parameter(i),
741 scope->parameter(i)->name(), 744 scope->parameter(i)->name(),
742 scope->parameter(i)->type(), 745 scope->parameter(i)->type(),
743 AstNode::kNoNumber); 746 AstNode::kNoNumber,
747 false);
744 } 748 }
745 } 749 }
746 } 750 }
747 751
748 752
749 void AstPrinter::PrintStatements(ZoneList<Statement*>* statements) { 753 void AstPrinter::PrintStatements(ZoneList<Statement*>* statements) {
750 for (int i = 0; i < statements->length(); i++) { 754 for (int i = 0; i < statements->length(); i++) {
751 Visit(statements->at(i)); 755 Visit(statements->at(i));
752 } 756 }
753 } 757 }
(...skipping 25 matching lines...) Expand all
779 } 783 }
780 784
781 785
782 void AstPrinter::VisitDeclaration(Declaration* node) { 786 void AstPrinter::VisitDeclaration(Declaration* node) {
783 if (node->fun() == NULL) { 787 if (node->fun() == NULL) {
784 // var or const declarations 788 // var or const declarations
785 PrintLiteralWithModeIndented(Variable::Mode2String(node->mode()), 789 PrintLiteralWithModeIndented(Variable::Mode2String(node->mode()),
786 node->proxy()->AsVariable(), 790 node->proxy()->AsVariable(),
787 node->proxy()->name(), 791 node->proxy()->name(),
788 node->proxy()->AsVariable()->type(), 792 node->proxy()->AsVariable()->type(),
789 AstNode::kNoNumber); 793 AstNode::kNoNumber,
794 node->proxy()->IsPrimitive());
790 } else { 795 } else {
791 // function declarations 796 // function declarations
792 PrintIndented("FUNCTION "); 797 PrintIndented("FUNCTION ");
793 PrintLiteral(node->proxy()->name(), true); 798 PrintLiteral(node->proxy()->name(), true);
794 Print(" = function "); 799 Print(" = function ");
795 PrintLiteral(node->fun()->name(), false); 800 PrintLiteral(node->fun()->name(), false);
796 Print("\n"); 801 Print("\n");
797 } 802 }
798 } 803 }
799 804
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after
1015 break; 1020 break;
1016 default: 1021 default:
1017 UNREACHABLE(); 1022 UNREACHABLE();
1018 } 1023 }
1019 Print("\n"); 1024 Print("\n");
1020 } 1025 }
1021 1026
1022 1027
1023 void AstPrinter::VisitVariableProxy(VariableProxy* node) { 1028 void AstPrinter::VisitVariableProxy(VariableProxy* node) {
1024 PrintLiteralWithModeIndented("VAR PROXY", node->AsVariable(), node->name(), 1029 PrintLiteralWithModeIndented("VAR PROXY", node->AsVariable(), node->name(),
1025 node->type(), node->num()); 1030 node->type(), node->num(), node->IsPrimitive());
1026 Variable* var = node->var(); 1031 Variable* var = node->var();
1027 if (var != NULL && var->rewrite() != NULL) { 1032 if (var != NULL && var->rewrite() != NULL) {
1028 IndentedScope indent; 1033 IndentedScope indent;
1029 Visit(var->rewrite()); 1034 Visit(var->rewrite());
1030 } 1035 }
1031 } 1036 }
1032 1037
1033 1038
1034 void AstPrinter::VisitAssignment(Assignment* node) { 1039 void AstPrinter::VisitAssignment(Assignment* node) {
1035 IndentedScope indent(Token::Name(node->op()), node); 1040 IndentedScope indent(Token::Name(node->op()), node);
(...skipping 481 matching lines...) Expand 10 before | Expand all | Expand 10 after
1517 AddAttribute("mode", Variable::Mode2String(decl->mode())); 1522 AddAttribute("mode", Variable::Mode2String(decl->mode()));
1518 } 1523 }
1519 Visit(decl->proxy()); 1524 Visit(decl->proxy());
1520 if (decl->fun() != NULL) Visit(decl->fun()); 1525 if (decl->fun() != NULL) Visit(decl->fun());
1521 } 1526 }
1522 1527
1523 1528
1524 #endif // DEBUG 1529 #endif // DEBUG
1525 1530
1526 } } // namespace v8::internal 1531 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/prettyprinter.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698