| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include <stdarg.h> | 5 #include <stdarg.h> |
| 6 | 6 |
| 7 #include "src/v8.h" | 7 #include "src/v8.h" |
| 8 | 8 |
| 9 #include "src/ast-value-factory.h" | 9 #include "src/ast-value-factory.h" |
| 10 #include "src/base/platform/platform.h" | 10 #include "src/base/platform/platform.h" |
| (...skipping 701 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 712 // TODO(arv): Better printing of methods etc. | 712 // TODO(arv): Better printing of methods etc. |
| 713 Print(" "); | 713 Print(" "); |
| 714 Visit(property->key()); | 714 Visit(property->key()); |
| 715 Print(": "); | 715 Print(": "); |
| 716 Visit(property->value()); | 716 Visit(property->value()); |
| 717 } | 717 } |
| 718 | 718 |
| 719 | 719 |
| 720 void PrettyPrinter::VisitArrayLiteral(ArrayLiteral* node) { | 720 void PrettyPrinter::VisitArrayLiteral(ArrayLiteral* node) { |
| 721 Print("[ "); | 721 Print("[ "); |
| 722 Print(" literal_index = %d", node->literal_index()); |
| 722 for (int i = 0; i < node->values()->length(); i++) { | 723 for (int i = 0; i < node->values()->length(); i++) { |
| 723 if (i != 0) Print(","); | 724 if (i != 0) Print(","); |
| 724 Visit(node->values()->at(i)); | 725 Visit(node->values()->at(i)); |
| 725 } | 726 } |
| 726 Print(" ]"); | 727 Print(" ]"); |
| 727 } | 728 } |
| 728 | 729 |
| 729 | 730 |
| 730 void PrettyPrinter::VisitVariableProxy(VariableProxy* node) { | 731 void PrettyPrinter::VisitVariableProxy(VariableProxy* node) { |
| 731 PrintLiteral(node->name(), false); | 732 PrintLiteral(node->name(), false); |
| (...skipping 658 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1390 | 1391 |
| 1391 | 1392 |
| 1392 // TODO(svenpanne) Start with IndentedScope. | 1393 // TODO(svenpanne) Start with IndentedScope. |
| 1393 void AstPrinter::VisitLiteral(Literal* node) { | 1394 void AstPrinter::VisitLiteral(Literal* node) { |
| 1394 PrintLiteralIndented("LITERAL", node->value(), true); | 1395 PrintLiteralIndented("LITERAL", node->value(), true); |
| 1395 } | 1396 } |
| 1396 | 1397 |
| 1397 | 1398 |
| 1398 void AstPrinter::VisitRegExpLiteral(RegExpLiteral* node) { | 1399 void AstPrinter::VisitRegExpLiteral(RegExpLiteral* node) { |
| 1399 IndentedScope indent(this, "REGEXP LITERAL"); | 1400 IndentedScope indent(this, "REGEXP LITERAL"); |
| 1401 EmbeddedVector<char, 128> buf; |
| 1402 SNPrintF(buf, "literal_index = %d\n", node->literal_index()); |
| 1403 PrintIndented(buf.start()); |
| 1400 PrintLiteralIndented("PATTERN", node->pattern(), false); | 1404 PrintLiteralIndented("PATTERN", node->pattern(), false); |
| 1401 PrintLiteralIndented("FLAGS", node->flags(), false); | 1405 PrintLiteralIndented("FLAGS", node->flags(), false); |
| 1402 } | 1406 } |
| 1403 | 1407 |
| 1404 | 1408 |
| 1405 void AstPrinter::VisitObjectLiteral(ObjectLiteral* node) { | 1409 void AstPrinter::VisitObjectLiteral(ObjectLiteral* node) { |
| 1406 IndentedScope indent(this, "OBJ LITERAL"); | 1410 IndentedScope indent(this, "OBJ LITERAL"); |
| 1411 EmbeddedVector<char, 128> buf; |
| 1412 SNPrintF(buf, "literal_index = %d\n", node->literal_index()); |
| 1413 PrintIndented(buf.start()); |
| 1407 PrintProperties(node->properties()); | 1414 PrintProperties(node->properties()); |
| 1408 } | 1415 } |
| 1409 | 1416 |
| 1410 | 1417 |
| 1411 void AstPrinter::VisitArrayLiteral(ArrayLiteral* node) { | 1418 void AstPrinter::VisitArrayLiteral(ArrayLiteral* node) { |
| 1412 IndentedScope indent(this, "ARRAY LITERAL"); | 1419 IndentedScope indent(this, "ARRAY LITERAL"); |
| 1420 |
| 1421 EmbeddedVector<char, 128> buf; |
| 1422 SNPrintF(buf, "literal_index = %d\n", node->literal_index()); |
| 1423 PrintIndented(buf.start()); |
| 1413 if (node->values()->length() > 0) { | 1424 if (node->values()->length() > 0) { |
| 1414 IndentedScope indent(this, "VALUES"); | 1425 IndentedScope indent(this, "VALUES"); |
| 1415 for (int i = 0; i < node->values()->length(); i++) { | 1426 for (int i = 0; i < node->values()->length(); i++) { |
| 1416 Visit(node->values()->at(i)); | 1427 Visit(node->values()->at(i)); |
| 1417 } | 1428 } |
| 1418 } | 1429 } |
| 1419 } | 1430 } |
| 1420 | 1431 |
| 1421 | 1432 |
| 1422 // TODO(svenpanne) Start with IndentedScope. | 1433 // TODO(svenpanne) Start with IndentedScope. |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1543 | 1554 |
| 1544 void AstPrinter::VisitSuperCallReference(SuperCallReference* node) { | 1555 void AstPrinter::VisitSuperCallReference(SuperCallReference* node) { |
| 1545 IndentedScope indent(this, "SUPER-CALL-REFERENCE"); | 1556 IndentedScope indent(this, "SUPER-CALL-REFERENCE"); |
| 1546 } | 1557 } |
| 1547 | 1558 |
| 1548 | 1559 |
| 1549 #endif // DEBUG | 1560 #endif // DEBUG |
| 1550 | 1561 |
| 1551 } // namespace internal | 1562 } // namespace internal |
| 1552 } // namespace v8 | 1563 } // namespace v8 |
| OLD | NEW |