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

Side by Side Diff: src/prettyprinter.cc

Issue 6810015: Remove unnecessary AST node for ++ and -- operations. (Closed) Base URL: http://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/parser.cc ('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 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 358 matching lines...) Expand 10 before | Expand all | Expand 10 after
369 } 369 }
370 370
371 371
372 void PrettyPrinter::VisitUnaryOperation(UnaryOperation* node) { 372 void PrettyPrinter::VisitUnaryOperation(UnaryOperation* node) {
373 Print("(%s", Token::String(node->op())); 373 Print("(%s", Token::String(node->op()));
374 Visit(node->expression()); 374 Visit(node->expression());
375 Print(")"); 375 Print(")");
376 } 376 }
377 377
378 378
379 void PrettyPrinter::VisitIncrementOperation(IncrementOperation* node) {
380 UNREACHABLE();
381 }
382
383
384 void PrettyPrinter::VisitCountOperation(CountOperation* node) { 379 void PrettyPrinter::VisitCountOperation(CountOperation* node) {
385 Print("("); 380 Print("(");
386 if (node->is_prefix()) Print("%s", Token::String(node->op())); 381 if (node->is_prefix()) Print("%s", Token::String(node->op()));
387 Visit(node->expression()); 382 Visit(node->expression());
388 if (node->is_postfix()) Print("%s", Token::String(node->op())); 383 if (node->is_postfix()) Print("%s", Token::String(node->op()));
389 Print(")"); 384 Print(")");
390 } 385 }
391 386
392 387
393 void PrettyPrinter::VisitBinaryOperation(BinaryOperation* node) { 388 void PrettyPrinter::VisitBinaryOperation(BinaryOperation* node) {
(...skipping 655 matching lines...) Expand 10 before | Expand all | Expand 10 after
1049 IndentedScope indent(this); 1044 IndentedScope indent(this);
1050 PrintArguments(node->arguments()); 1045 PrintArguments(node->arguments());
1051 } 1046 }
1052 1047
1053 1048
1054 void AstPrinter::VisitUnaryOperation(UnaryOperation* node) { 1049 void AstPrinter::VisitUnaryOperation(UnaryOperation* node) {
1055 PrintIndentedVisit(Token::Name(node->op()), node->expression()); 1050 PrintIndentedVisit(Token::Name(node->op()), node->expression());
1056 } 1051 }
1057 1052
1058 1053
1059 void AstPrinter::VisitIncrementOperation(IncrementOperation* node) {
1060 UNREACHABLE();
1061 }
1062
1063
1064 void AstPrinter::VisitCountOperation(CountOperation* node) { 1054 void AstPrinter::VisitCountOperation(CountOperation* node) {
1065 EmbeddedVector<char, 128> buf; 1055 EmbeddedVector<char, 128> buf;
1066 if (node->type()->IsKnown()) { 1056 if (node->type()->IsKnown()) {
1067 OS::SNPrintF(buf, "%s %s (type = %s)", 1057 OS::SNPrintF(buf, "%s %s (type = %s)",
1068 (node->is_prefix() ? "PRE" : "POST"), 1058 (node->is_prefix() ? "PRE" : "POST"),
1069 Token::Name(node->op()), 1059 Token::Name(node->op()),
1070 StaticType::Type2String(node->type())); 1060 StaticType::Type2String(node->type()));
1071 } else { 1061 } else {
1072 OS::SNPrintF(buf, "%s %s", (node->is_prefix() ? "PRE" : "POST"), 1062 OS::SNPrintF(buf, "%s %s", (node->is_prefix() ? "PRE" : "POST"),
1073 Token::Name(node->op())); 1063 Token::Name(node->op()));
(...skipping 380 matching lines...) Expand 10 before | Expand all | Expand 10 after
1454 void JsonAstBuilder::VisitUnaryOperation(UnaryOperation* expr) { 1444 void JsonAstBuilder::VisitUnaryOperation(UnaryOperation* expr) {
1455 TagScope tag(this, "UnaryOperation"); 1445 TagScope tag(this, "UnaryOperation");
1456 { 1446 {
1457 AttributesScope attributes(this); 1447 AttributesScope attributes(this);
1458 AddAttribute("op", Token::Name(expr->op())); 1448 AddAttribute("op", Token::Name(expr->op()));
1459 } 1449 }
1460 Visit(expr->expression()); 1450 Visit(expr->expression());
1461 } 1451 }
1462 1452
1463 1453
1464 void JsonAstBuilder::VisitIncrementOperation(IncrementOperation* expr) {
1465 UNREACHABLE();
1466 }
1467
1468
1469 void JsonAstBuilder::VisitCountOperation(CountOperation* expr) { 1454 void JsonAstBuilder::VisitCountOperation(CountOperation* expr) {
1470 TagScope tag(this, "CountOperation"); 1455 TagScope tag(this, "CountOperation");
1471 { 1456 {
1472 AttributesScope attributes(this); 1457 AttributesScope attributes(this);
1473 AddAttribute("is_prefix", expr->is_prefix()); 1458 AddAttribute("is_prefix", expr->is_prefix());
1474 AddAttribute("op", Token::Name(expr->op())); 1459 AddAttribute("op", Token::Name(expr->op()));
1475 } 1460 }
1476 Visit(expr->expression()); 1461 Visit(expr->expression());
1477 } 1462 }
1478 1463
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
1521 AddAttribute("mode", Variable::Mode2String(decl->mode())); 1506 AddAttribute("mode", Variable::Mode2String(decl->mode()));
1522 } 1507 }
1523 Visit(decl->proxy()); 1508 Visit(decl->proxy());
1524 if (decl->fun() != NULL) Visit(decl->fun()); 1509 if (decl->fun() != NULL) Visit(decl->fun());
1525 } 1510 }
1526 1511
1527 1512
1528 #endif // DEBUG 1513 #endif // DEBUG
1529 1514
1530 } } // namespace v8::internal 1515 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/parser.cc ('k') | src/rewriter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698