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

Side by Side Diff: src/ast/prettyprinter.cc

Issue 1806883003: Make prettyprinting of variable proxies clearer. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 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
« no previous file with comments | « no previous file | 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 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 "src/ast/prettyprinter.h" 5 #include "src/ast/prettyprinter.h"
6 6
7 #include <stdarg.h> 7 #include <stdarg.h>
8 8
9 #include "src/ast/ast-value-factory.h" 9 #include "src/ast/ast-value-factory.h"
10 #include "src/ast/scopes.h" 10 #include "src/ast/scopes.h"
(...skipping 453 matching lines...) Expand 10 before | Expand all | Expand 10 after
464 //----------------------------------------------------------------------------- 464 //-----------------------------------------------------------------------------
465 465
466 466
467 #ifdef DEBUG 467 #ifdef DEBUG
468 468
469 // A helper for ast nodes that use FeedbackVectorSlots. 469 // A helper for ast nodes that use FeedbackVectorSlots.
470 static int FormatSlotNode(Vector<char>* buf, Expression* node, 470 static int FormatSlotNode(Vector<char>* buf, Expression* node,
471 const char* node_name, FeedbackVectorSlot slot) { 471 const char* node_name, FeedbackVectorSlot slot) {
472 int pos = SNPrintF(*buf, "%s", node_name); 472 int pos = SNPrintF(*buf, "%s", node_name);
473 if (!slot.IsInvalid()) { 473 if (!slot.IsInvalid()) {
474 pos = SNPrintF(*buf + pos, " Slot(%d)", slot.ToInt()); 474 pos += SNPrintF(*buf + pos, " Slot(%d)", slot.ToInt());
475 } 475 }
476 return pos; 476 return pos;
477 } 477 }
478 478
479 479
480 PrettyPrinter::PrettyPrinter(Isolate* isolate) { 480 PrettyPrinter::PrettyPrinter(Isolate* isolate) {
481 output_ = NULL; 481 output_ = NULL;
482 size_ = 0; 482 size_ = 0;
483 pos_ = 0; 483 pos_ = 0;
484 InitializeAstVisitor(isolate); 484 InitializeAstVisitor(isolate);
(...skipping 1071 matching lines...) Expand 10 before | Expand all | Expand 10 after
1556 int pos = 1556 int pos =
1557 FormatSlotNode(&buf, node, "VAR PROXY", node->VariableFeedbackSlot()); 1557 FormatSlotNode(&buf, node, "VAR PROXY", node->VariableFeedbackSlot());
1558 1558
1559 if (!node->is_resolved()) { 1559 if (!node->is_resolved()) {
1560 SNPrintF(buf + pos, " unresolved"); 1560 SNPrintF(buf + pos, " unresolved");
1561 PrintLiteralWithModeIndented(buf.start(), nullptr, node->name()); 1561 PrintLiteralWithModeIndented(buf.start(), nullptr, node->name());
1562 } else { 1562 } else {
1563 Variable* var = node->var(); 1563 Variable* var = node->var();
1564 switch (var->location()) { 1564 switch (var->location()) {
1565 case VariableLocation::UNALLOCATED: 1565 case VariableLocation::UNALLOCATED:
1566 SNPrintF(buf + pos, " unallocated");
1566 break; 1567 break;
1567 case VariableLocation::PARAMETER: 1568 case VariableLocation::PARAMETER:
1568 SNPrintF(buf + pos, " parameter[%d]", var->index()); 1569 SNPrintF(buf + pos, " parameter[%d]", var->index());
1569 break; 1570 break;
1570 case VariableLocation::LOCAL: 1571 case VariableLocation::LOCAL:
1571 SNPrintF(buf + pos, " local[%d]", var->index()); 1572 SNPrintF(buf + pos, " local[%d]", var->index());
1572 break; 1573 break;
1573 case VariableLocation::CONTEXT: 1574 case VariableLocation::CONTEXT:
1574 SNPrintF(buf + pos, " context[%d]", var->index()); 1575 SNPrintF(buf + pos, " context[%d]", var->index());
1575 break; 1576 break;
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
1703 1704
1704 void AstPrinter::VisitRewritableExpression(RewritableExpression* node) { 1705 void AstPrinter::VisitRewritableExpression(RewritableExpression* node) {
1705 Visit(node->expression()); 1706 Visit(node->expression());
1706 } 1707 }
1707 1708
1708 1709
1709 #endif // DEBUG 1710 #endif // DEBUG
1710 1711
1711 } // namespace internal 1712 } // namespace internal
1712 } // namespace v8 1713 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698