Improved pretty printing of VAR PROXY and some control flow AST nodes.

Review URL: http://codereview.chromium.org/7866041

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@9245 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent db2bac38
...@@ -633,17 +633,14 @@ void AstPrinter::PrintLiteralWithModeIndented(const char* info, ...@@ -633,17 +633,14 @@ void AstPrinter::PrintLiteralWithModeIndented(const char* info,
void AstPrinter::PrintLabelsIndented(const char* info, ZoneStringList* labels) { void AstPrinter::PrintLabelsIndented(const char* info, ZoneStringList* labels) {
if (labels != NULL && labels->length() > 0) { if (labels != NULL && labels->length() > 0) {
if (info == NULL) { PrintIndented(info == NULL ? "LABELS" : info);
PrintIndented("LABELS ");
} else {
PrintIndented(info);
Print(" "); Print(" ");
}
PrintLabels(labels); PrintLabels(labels);
Print("\n");
} else if (info != NULL) { } else if (info != NULL) {
PrintIndented(info); PrintIndented(info);
}
Print("\n"); Print("\n");
}
} }
...@@ -929,25 +926,25 @@ void AstPrinter::VisitArrayLiteral(ArrayLiteral* node) { ...@@ -929,25 +926,25 @@ void AstPrinter::VisitArrayLiteral(ArrayLiteral* node) {
void AstPrinter::VisitVariableProxy(VariableProxy* node) { void AstPrinter::VisitVariableProxy(VariableProxy* node) {
Variable* var = node->var(); Variable* var = node->var();
PrintLiteralWithModeIndented("VAR PROXY", var, node->name()); EmbeddedVector<char, 128> buf;
{ IndentedScope indent(this); int pos = OS::SNPrintF(buf, "VAR PROXY");
switch (var->location()) { switch (var->location()) {
case Variable::UNALLOCATED: case Variable::UNALLOCATED:
break; break;
case Variable::PARAMETER: case Variable::PARAMETER:
Print("parameter[%d]", var->index()); OS::SNPrintF(buf + pos, " parameter[%d]", var->index());
break; break;
case Variable::LOCAL: case Variable::LOCAL:
Print("local[%d]", var->index()); OS::SNPrintF(buf + pos, " local[%d]", var->index());
break; break;
case Variable::CONTEXT: case Variable::CONTEXT:
Print("context[%d]", var->index()); OS::SNPrintF(buf + pos, " context[%d]", var->index());
break; break;
case Variable::LOOKUP: case Variable::LOOKUP:
Print("lookup"); OS::SNPrintF(buf + pos, " lookup");
break; break;
} }
} PrintLiteralWithModeIndented(buf.start(), var, node->name());
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment