#ifdef DEBUG
+// A helper for ast nodes that use FeedbackVectorICSlots.
+static int FormatICSlotNode(Vector<char>* buf, Expression* node,
+ const char* node_name, FeedbackVectorICSlot slot) {
+ int pos = SNPrintF(*buf, "%s", node_name);
+ if (!slot.IsInvalid()) {
+ const char* str = Code::Kind2String(node->FeedbackICSlotKind(0));
+ pos = SNPrintF(*buf + pos, " ICSlot(%d, %s)", slot.ToInt(), str);
+ }
+ return pos;
+}
+
+
PrettyPrinter::PrettyPrinter(Isolate* isolate, Zone* zone) {
output_ = NULL;
size_ = 0;
}
-// TODO(svenpanne) Start with IndentedScope.
void AstPrinter::VisitVariableProxy(VariableProxy* node) {
Variable* var = node->var();
EmbeddedVector<char, 128> buf;
- int pos = SNPrintF(buf, "VAR PROXY");
+ int pos =
+ FormatICSlotNode(&buf, node, "VAR PROXY", node->VariableFeedbackSlot());
+
switch (var->location()) {
case VariableLocation::UNALLOCATED:
break;
void AstPrinter::VisitProperty(Property* node) {
- IndentedScope indent(this, "PROPERTY");
+ EmbeddedVector<char, 128> buf;
+ FormatICSlotNode(&buf, node, "PROPERTY", node->PropertyFeedbackSlot());
+ IndentedScope indent(this, buf.start());
+
Visit(node->obj());
Literal* literal = node->key()->AsLiteral();
if (literal != NULL && literal->value()->IsInternalizedString()) {
void AstPrinter::VisitCall(Call* node) {
- IndentedScope indent(this, "CALL");
+ EmbeddedVector<char, 128> buf;
+ FormatICSlotNode(&buf, node, "CALL", node->CallFeedbackICSlot());
+ IndentedScope indent(this, buf.start());
+
Visit(node->expression());
PrintArguments(node->arguments());
}
void AstPrinter::VisitCallRuntime(CallRuntime* node) {
- IndentedScope indent(this, "CALL RUNTIME");
+ EmbeddedVector<char, 128> buf;
+ FormatICSlotNode(&buf, node, "CALL RUNTIME", node->CallRuntimeFeedbackSlot());
+ IndentedScope indent(this, buf.start());
PrintLiteralIndented("NAME", node->name(), false);
PrintArguments(node->arguments());
}