41 PrettyPrinter::PrettyPrinter() {
 
   48 PrettyPrinter::~PrettyPrinter() {
 
   53 void PrettyPrinter::VisitBlock(
Block* node) {
 
   54   if (!node->is_initializer_block()) 
Print(
"{ ");
 
   55   PrintStatements(node->statements());
 
   56   if (node->statements()->length() > 0) 
Print(
" ");
 
   57   if (!node->is_initializer_block()) 
Print(
"}");
 
   61 void PrettyPrinter::VisitVariableDeclaration(VariableDeclaration* node) {
 
   63   PrintLiteral(node->proxy()->name(), 
false);
 
   68 void PrettyPrinter::VisitFunctionDeclaration(FunctionDeclaration* node) {
 
   70   PrintLiteral(node->proxy()->name(), 
false);
 
   72   PrintFunctionLiteral(node->fun());
 
   77 void PrettyPrinter::VisitModuleDeclaration(ModuleDeclaration* node) {
 
   79   PrintLiteral(node->proxy()->name(), 
false);
 
   81   Visit(node->module());
 
   86 void PrettyPrinter::VisitImportDeclaration(ImportDeclaration* node) {
 
   88   PrintLiteral(node->proxy()->name(), 
false);
 
   90   Visit(node->module());
 
   95 void PrettyPrinter::VisitExportDeclaration(ExportDeclaration* node) {
 
   97   PrintLiteral(node->proxy()->name(), 
false);
 
  102 void PrettyPrinter::VisitModuleLiteral(ModuleLiteral* node) {
 
  103   VisitBlock(node->body());
 
  107 void PrettyPrinter::VisitModuleVariable(ModuleVariable* node) {
 
  108   Visit(node->proxy());
 
  112 void PrettyPrinter::VisitModulePath(ModulePath* node) {
 
  113   Visit(node->module());
 
  115   PrintLiteral(node->name(), 
false);
 
  119 void PrettyPrinter::VisitModuleUrl(ModuleUrl* node) {
 
  121   PrintLiteral(node->url(), 
true);
 
  125 void PrettyPrinter::VisitExpressionStatement(ExpressionStatement* node) {
 
  126   Visit(node->expression());
 
  131 void PrettyPrinter::VisitEmptyStatement(EmptyStatement* node) {
 
  136 void PrettyPrinter::VisitIfStatement(IfStatement* node) {
 
  138   Visit(node->condition());
 
  140   Visit(node->then_statement());
 
  141   if (node->HasElseStatement()) {
 
  143     Visit(node->else_statement());
 
  148 void PrettyPrinter::VisitContinueStatement(ContinueStatement* node) {
 
  151   if (labels != 
NULL) {
 
  153     ASSERT(labels->length() > 0);  
 
  154     PrintLiteral(labels->at(0), 
false);  
 
  160 void PrettyPrinter::VisitBreakStatement(BreakStatement* node) {
 
  163   if (labels != 
NULL) {
 
  165     ASSERT(labels->length() > 0);  
 
  166     PrintLiteral(labels->at(0), 
false);  
 
  172 void PrettyPrinter::VisitReturnStatement(ReturnStatement* node) {
 
  174   Visit(node->expression());
 
  179 void PrettyPrinter::VisitWithStatement(WithStatement* node) {
 
  181   Visit(node->expression());
 
  183   Visit(node->statement());
 
  187 void PrettyPrinter::VisitSwitchStatement(SwitchStatement* node) {
 
  188   PrintLabels(node->labels());
 
  192   ZoneList<CaseClause*>* cases = node->cases();
 
  193   for (
int i = 0; i < cases->length(); i++)
 
  194     PrintCaseClause(cases->at(i));
 
  199 void PrettyPrinter::VisitDoWhileStatement(DoWhileStatement* node) {
 
  200   PrintLabels(node->labels());
 
  209 void PrettyPrinter::VisitWhileStatement(WhileStatement* node) {
 
  210   PrintLabels(node->labels());
 
  218 void PrettyPrinter::VisitForStatement(ForStatement* node) {
 
  219   PrintLabels(node->labels());
 
  221   if (node->init() != 
NULL) {
 
  227   if (node->cond() != 
NULL) Visit(node->cond());
 
  229   if (node->next() != 
NULL) {
 
  238 void PrettyPrinter::VisitForInStatement(ForInStatement* node) {
 
  239   PrintLabels(node->labels());
 
  243   Visit(node->enumerable());
 
  249 void PrettyPrinter::VisitTryCatchStatement(TryCatchStatement* node) {
 
  251   Visit(node->try_block());
 
  253   const bool quote = 
false;
 
  254   PrintLiteral(node->variable()->name(), quote);
 
  256   Visit(node->catch_block());
 
  260 void PrettyPrinter::VisitTryFinallyStatement(TryFinallyStatement* node) {
 
  262   Visit(node->try_block());
 
  264   Visit(node->finally_block());
 
  268 void PrettyPrinter::VisitDebuggerStatement(DebuggerStatement* node) {
 
  273 void PrettyPrinter::VisitFunctionLiteral(FunctionLiteral* node) {
 
  275   PrintFunctionLiteral(node);
 
  280 void PrettyPrinter::VisitSharedFunctionInfoLiteral(
 
  281     SharedFunctionInfoLiteral* node) {
 
  283   PrintLiteral(node->shared_function_info(), 
true);
 
  288 void PrettyPrinter::VisitConditional(Conditional* node) {
 
  289   Visit(node->condition());
 
  291   Visit(node->then_expression());
 
  293   Visit(node->else_expression());
 
  297 void PrettyPrinter::VisitLiteral(Literal* node) {
 
  298   PrintLiteral(node->handle(), 
true);
 
  302 void PrettyPrinter::VisitRegExpLiteral(RegExpLiteral* node) {
 
  304   PrintLiteral(node->pattern(), 
false);
 
  306   PrintLiteral(node->flags(), 
false);
 
  311 void PrettyPrinter::VisitObjectLiteral(ObjectLiteral* node) {
 
  313   for (
int i = 0; i < node->properties()->length(); i++) {
 
  314     if (i != 0) 
Print(
",");
 
  315     ObjectLiteral::Property* 
property = node->properties()->at(i);
 
  317     Visit(property->key());
 
  319     Visit(property->value());
 
  325 void PrettyPrinter::VisitArrayLiteral(ArrayLiteral* node) {
 
  327   for (
int i = 0; i < node->values()->length(); i++) {
 
  328     if (i != 0) 
Print(
",");
 
  329     Visit(node->values()->at(i));
 
  335 void PrettyPrinter::VisitVariableProxy(VariableProxy* node) {
 
  336   PrintLiteral(node->name(), 
false);
 
  340 void PrettyPrinter::VisitAssignment(Assignment* node) {
 
  341   Visit(node->target());
 
  343   Visit(node->value());
 
  347 void PrettyPrinter::VisitThrow(Throw* node) {
 
  349   Visit(node->exception());
 
  353 void PrettyPrinter::VisitProperty(Property* node) {
 
  354   Expression* key = node->key();
 
  355   Literal* literal = key->AsLiteral();
 
  356   if (literal != 
NULL && literal->handle()->IsSymbol()) {
 
  360     PrintLiteral(literal->handle(), 
false);
 
  370 void PrettyPrinter::VisitCall(Call* node) {
 
  371   Visit(node->expression());
 
  372   PrintArguments(node->arguments());
 
  376 void PrettyPrinter::VisitCallNew(CallNew* node) {
 
  378   Visit(node->expression());
 
  380   PrintArguments(node->arguments());
 
  384 void PrettyPrinter::VisitCallRuntime(CallRuntime* node) {
 
  386   PrintLiteral(node->name(), 
false);
 
  387   PrintArguments(node->arguments());
 
  391 void PrettyPrinter::VisitUnaryOperation(UnaryOperation* node) {
 
  394       op == Token::DELETE || op == Token::TYPEOF || op == 
Token::VOID;
 
  396   Visit(node->expression());
 
  401 void PrettyPrinter::VisitCountOperation(CountOperation* node) {
 
  404   Visit(node->expression());
 
  410 void PrettyPrinter::VisitBinaryOperation(BinaryOperation* node) {
 
  414   Visit(node->right());
 
  419 void PrettyPrinter::VisitCompareOperation(CompareOperation* node) {
 
  423   Visit(node->right());
 
  428 void PrettyPrinter::VisitThisFunction(ThisFunction* node) {
 
  429   Print(
"<this-function>");
 
  440 const char* PrettyPrinter::PrintExpression(FunctionLiteral* program) {
 
  442   ExpressionStatement* statement =
 
  443     program->body()->at(0)->AsExpressionStatement();
 
  444   Visit(statement->expression());
 
  449 const char* PrettyPrinter::PrintProgram(FunctionLiteral* program) {
 
  451   PrintStatements(program->body());
 
  457 void PrettyPrinter::PrintOut(AstNode* node) {
 
  458   PrettyPrinter printer;
 
  459   PrintF(
"%s", printer.Print(node));
 
  463 void PrettyPrinter::Init() {
 
  466     const int initial_size = 256;
 
  467     output_ = NewArray<char>(initial_size);
 
  468     size_ = initial_size;
 
  478     va_start(arguments, format);
 
  490       const int slack = 32;
 
  491       int new_size = size_ + (size_ >> 1) + slack;
 
  492       char* new_output = NewArray<char>(new_size);
 
  493       memcpy(new_output, output_, pos_);
 
  495       output_ = new_output;
 
  502 void PrettyPrinter::PrintStatements(ZoneList<Statement*>* statements) {
 
  503   if (statements == 
NULL) 
return;
 
  504   for (
int i = 0; i < statements->length(); i++) {
 
  505     if (i != 0) 
Print(
" ");
 
  506     Visit(statements->at(i));
 
  512   if (labels != 
NULL) {
 
  513     for (
int i = 0; i < labels->length(); i++) {
 
  514       PrintLiteral(labels->at(i), 
false);
 
  521 void PrettyPrinter::PrintArguments(ZoneList<Expression*>* arguments) {
 
  523   for (
int i = 0; i < arguments->length(); i++) {
 
  524     if (i != 0) 
Print(
", ");
 
  525     Visit(arguments->at(i));
 
  531 void PrettyPrinter::PrintLiteral(Handle<Object> value, 
bool quote) {
 
  533   if (object->IsString()) {
 
  535     if (quote) 
Print(
"\"");
 
  536     for (
int i = 0; i < 
string->length(); i++) {
 
  537       Print(
"%c", string->Get(i));
 
  539     if (quote) 
Print(
"\"");
 
  540   } 
else if (object->IsNull()) {
 
  542   } 
else if (object->IsTrue()) {
 
  544   } 
else if (object->IsFalse()) {
 
  546   } 
else if (object->IsUndefined()) {
 
  548   } 
else if (object->IsNumber()) {
 
  549     Print(
"%g", object->Number());
 
  550   } 
else if (object->IsJSObject()) {
 
  552     if (object->IsJSFunction()) {
 
  553       Print(
"JS-Function");
 
  554     } 
else if (object->IsJSArray()) {
 
  556     } 
else if (object->IsJSObject()) {
 
  561   } 
else if (object->IsFixedArray()) {
 
  564     Print(
"<unknown literal %p>", 
object);
 
  569 void PrettyPrinter::PrintParameters(Scope* scope) {
 
  571   for (
int i = 0; i < scope->num_parameters(); i++) {
 
  572     if (i  > 0) 
Print(
", ");
 
  573     PrintLiteral(scope->parameter(i)->name(), 
false);
 
  579 void PrettyPrinter::PrintDeclarations(ZoneList<Declaration*>* declarations) {
 
  580   for (
int i = 0; i < declarations->length(); i++) {
 
  581     if (i > 0) 
Print(
" ");
 
  582     Visit(declarations->at(i));
 
  587 void PrettyPrinter::PrintFunctionLiteral(FunctionLiteral* 
function) {
 
  589   PrintLiteral(function->name(), 
false);
 
  590   PrintParameters(function->scope());
 
  592   PrintDeclarations(function->scope()->declarations());
 
  593   PrintStatements(function->body());
 
  598 void PrettyPrinter::PrintCaseClause(CaseClause* clause) {
 
  599   if (clause->is_default()) {
 
  603     Visit(clause->label());
 
  606   PrintStatements(clause->statements());
 
  607   if (clause->statements()->length() > 0)
 
  616   explicit IndentedScope(AstPrinter* printer) : ast_printer_(printer) {
 
  617     ast_printer_->inc_indent();
 
  620   IndentedScope(AstPrinter* printer, 
const char* txt, AstNode* node = 
NULL)
 
  621       : ast_printer_(printer) {
 
  622     ast_printer_->PrintIndented(txt);
 
  623     ast_printer_->Print(
"\n");
 
  624     ast_printer_->inc_indent();
 
  627   virtual ~IndentedScope() {
 
  628     ast_printer_->dec_indent();
 
  632   AstPrinter* ast_printer_;
 
  639 AstPrinter::AstPrinter() : indent_(0) {
 
  643 AstPrinter::~AstPrinter() {
 
  648 void AstPrinter::PrintIndented(
const char* txt) {
 
  649   for (
int i = 0; i < indent_; i++) {
 
  656 void AstPrinter::PrintLiteralIndented(
const char* info,
 
  657                                       Handle<Object> value,
 
  661   PrintLiteral(value, quote);
 
  666 void AstPrinter::PrintLiteralWithModeIndented(
const char* info,
 
  668                                               Handle<Object> value) {
 
  670     PrintLiteralIndented(info, value, 
true);
 
  672     EmbeddedVector<char, 256> buf;
 
  673     int pos = OS::SNPrintF(buf, 
"%s (mode = %s", info,
 
  674                            Variable::Mode2String(var->mode()));
 
  675     OS::SNPrintF(buf + pos, 
")");
 
  676     PrintLiteralIndented(buf.start(), value, 
true);
 
  681 void AstPrinter::PrintLabelsIndented(
const char* info, 
ZoneStringList* labels) {
 
  682   if (labels != 
NULL && labels->length() > 0) {
 
  683     PrintIndented(info == 
NULL ? 
"LABELS" : info);
 
  687   } 
else if (info != 
NULL) {
 
  694 void AstPrinter::PrintIndentedVisit(
const char* s, AstNode* node) {
 
  695   IndentedScope indent(
this, s, node);
 
  700 const char* AstPrinter::PrintProgram(FunctionLiteral* program) {
 
  702   { IndentedScope indent(
this, 
"FUNC");
 
  703     PrintLiteralIndented(
"NAME", program->name(), 
true);
 
  704     PrintLiteralIndented(
"INFERRED NAME", program->inferred_name(), 
true);
 
  705     PrintParameters(program->scope());
 
  706     PrintDeclarations(program->scope()->declarations());
 
  707     PrintStatements(program->body());
 
  713 void AstPrinter::PrintDeclarations(ZoneList<Declaration*>* declarations) {
 
  714   if (declarations->length() > 0) {
 
  715     IndentedScope indent(
this, 
"DECLS");
 
  716     for (
int i = 0; i < declarations->length(); i++) {
 
  717       Visit(declarations->at(i));
 
  723 void AstPrinter::PrintParameters(Scope* scope) {
 
  724   if (scope->num_parameters() > 0) {
 
  725     IndentedScope indent(
this, 
"PARAMS");
 
  726     for (
int i = 0; i < scope->num_parameters(); i++) {
 
  727       PrintLiteralWithModeIndented(
"VAR", scope->parameter(i),
 
  728                                    scope->parameter(i)->name());
 
  734 void AstPrinter::PrintStatements(ZoneList<Statement*>* statements) {
 
  735   for (
int i = 0; i < statements->length(); i++) {
 
  736     Visit(statements->at(i));
 
  741 void AstPrinter::PrintArguments(ZoneList<Expression*>* arguments) {
 
  742   for (
int i = 0; i < arguments->length(); i++) {
 
  743     Visit(arguments->at(i));
 
  748 void AstPrinter::PrintCaseClause(CaseClause* clause) {
 
  749   if (clause->is_default()) {
 
  750     IndentedScope indent(
this, 
"DEFAULT");
 
  751     PrintStatements(clause->statements());
 
  753     IndentedScope indent(
this, 
"CASE");
 
  754     Visit(clause->label());
 
  755     PrintStatements(clause->statements());
 
  760 void AstPrinter::VisitBlock(
Block* node) {
 
  761   const char* block_txt = node->is_initializer_block() ? 
"BLOCK INIT" : 
"BLOCK";
 
  762   IndentedScope indent(
this, block_txt);
 
  763   PrintStatements(node->statements());
 
  767 void AstPrinter::VisitVariableDeclaration(VariableDeclaration* node) {
 
  768   PrintLiteralWithModeIndented(Variable::Mode2String(node->mode()),
 
  769                                node->proxy()->var(),
 
  770                                node->proxy()->name());
 
  774 void AstPrinter::VisitFunctionDeclaration(FunctionDeclaration* node) {
 
  775   PrintIndented(
"FUNCTION ");
 
  776   PrintLiteral(node->proxy()->name(), 
true);
 
  777   Print(
" = function ");
 
  778   PrintLiteral(node->fun()->name(), 
false);
 
  783 void AstPrinter::VisitModuleDeclaration(ModuleDeclaration* node) {
 
  784   IndentedScope indent(
this, 
"MODULE");
 
  785   PrintLiteralIndented(
"NAME", node->proxy()->name(), 
true);
 
  786   Visit(node->module());
 
  790 void AstPrinter::VisitImportDeclaration(ImportDeclaration* node) {
 
  791   IndentedScope indent(
this, 
"IMPORT");
 
  792   PrintLiteralIndented(
"NAME", node->proxy()->name(), 
true);
 
  793   Visit(node->module());
 
  797 void AstPrinter::VisitExportDeclaration(ExportDeclaration* node) {
 
  798   IndentedScope indent(
this, 
"EXPORT ");
 
  799   PrintLiteral(node->proxy()->name(), 
true);
 
  803 void AstPrinter::VisitModuleLiteral(ModuleLiteral* node) {
 
  804   VisitBlock(node->body());
 
  808 void AstPrinter::VisitModuleVariable(ModuleVariable* node) {
 
  809   Visit(node->proxy());
 
  813 void AstPrinter::VisitModulePath(ModulePath* node) {
 
  814   IndentedScope indent(
this, 
"PATH");
 
  815   PrintIndentedVisit(
"MODULE", node->module());
 
  816   PrintLiteralIndented(
"NAME", node->name(), 
false);
 
  820 void AstPrinter::VisitModuleUrl(ModuleUrl* node) {
 
  821   PrintLiteralIndented(
"URL", node->url(), 
true);
 
  825 void AstPrinter::VisitExpressionStatement(ExpressionStatement* node) {
 
  826   Visit(node->expression());
 
  830 void AstPrinter::VisitEmptyStatement(EmptyStatement* node) {
 
  831   PrintIndented(
"EMPTY\n");
 
  835 void AstPrinter::VisitIfStatement(IfStatement* node) {
 
  836   PrintIndentedVisit(
"IF", node->condition());
 
  837   PrintIndentedVisit(
"THEN", node->then_statement());
 
  838   if (node->HasElseStatement()) {
 
  839     PrintIndentedVisit(
"ELSE", node->else_statement());
 
  844 void AstPrinter::VisitContinueStatement(ContinueStatement* node) {
 
  845   PrintLabelsIndented(
"CONTINUE", node->target()->labels());
 
  849 void AstPrinter::VisitBreakStatement(BreakStatement* node) {
 
  850   PrintLabelsIndented(
"BREAK", node->target()->labels());
 
  854 void AstPrinter::VisitReturnStatement(ReturnStatement* node) {
 
  855   PrintIndentedVisit(
"RETURN", node->expression());
 
  859 void AstPrinter::VisitWithStatement(WithStatement* node) {
 
  860   IndentedScope indent(
this, 
"WITH");
 
  861   PrintIndentedVisit(
"OBJECT", node->expression());
 
  862   PrintIndentedVisit(
"BODY", node->statement());
 
  866 void AstPrinter::VisitSwitchStatement(SwitchStatement* node) {
 
  867   IndentedScope indent(
this, 
"SWITCH");
 
  868   PrintLabelsIndented(
NULL, node->labels());
 
  869   PrintIndentedVisit(
"TAG", node->tag());
 
  870   for (
int i = 0; i < node->cases()->length(); i++) {
 
  871     PrintCaseClause(node->cases()->at(i));
 
  876 void AstPrinter::VisitDoWhileStatement(DoWhileStatement* node) {
 
  877   IndentedScope indent(
this, 
"DO");
 
  878   PrintLabelsIndented(
NULL, node->labels());
 
  879   PrintIndentedVisit(
"BODY", node->body());
 
  880   PrintIndentedVisit(
"COND", node->cond());
 
  884 void AstPrinter::VisitWhileStatement(WhileStatement* node) {
 
  885   IndentedScope indent(
this, 
"WHILE");
 
  886   PrintLabelsIndented(
NULL, node->labels());
 
  887   PrintIndentedVisit(
"COND", node->cond());
 
  888   PrintIndentedVisit(
"BODY", node->body());
 
  892 void AstPrinter::VisitForStatement(ForStatement* node) {
 
  893   IndentedScope indent(
this, 
"FOR");
 
  894   PrintLabelsIndented(
NULL, node->labels());
 
  895   if (node->init()) PrintIndentedVisit(
"INIT", node->init());
 
  896   if (node->cond()) PrintIndentedVisit(
"COND", node->cond());
 
  897   PrintIndentedVisit(
"BODY", node->body());
 
  898   if (node->next()) PrintIndentedVisit(
"NEXT", node->next());
 
  902 void AstPrinter::VisitForInStatement(ForInStatement* node) {
 
  903   IndentedScope indent(
this, 
"FOR IN");
 
  904   PrintIndentedVisit(
"FOR", node->each());
 
  905   PrintIndentedVisit(
"IN", node->enumerable());
 
  906   PrintIndentedVisit(
"BODY", node->body());
 
  910 void AstPrinter::VisitTryCatchStatement(TryCatchStatement* node) {
 
  911   IndentedScope indent(
this, 
"TRY CATCH");
 
  912   PrintIndentedVisit(
"TRY", node->try_block());
 
  913   PrintLiteralWithModeIndented(
"CATCHVAR",
 
  915                                node->variable()->name());
 
  916   PrintIndentedVisit(
"CATCH", node->catch_block());
 
  920 void AstPrinter::VisitTryFinallyStatement(TryFinallyStatement* node) {
 
  921   IndentedScope indent(
this, 
"TRY FINALLY");
 
  922   PrintIndentedVisit(
"TRY", node->try_block());
 
  923   PrintIndentedVisit(
"FINALLY", node->finally_block());
 
  927 void AstPrinter::VisitDebuggerStatement(DebuggerStatement* node) {
 
  928   IndentedScope indent(
this, 
"DEBUGGER");
 
  932 void AstPrinter::VisitFunctionLiteral(FunctionLiteral* node) {
 
  933   IndentedScope indent(
this, 
"FUNC LITERAL");
 
  934   PrintLiteralIndented(
"NAME", node->name(), 
false);
 
  935   PrintLiteralIndented(
"INFERRED NAME", node->inferred_name(), 
false);
 
  936   PrintParameters(node->scope());
 
  944 void AstPrinter::VisitSharedFunctionInfoLiteral(
 
  945     SharedFunctionInfoLiteral* node) {
 
  946   IndentedScope indent(
this, 
"FUNC LITERAL");
 
  947   PrintLiteralIndented(
"SHARED INFO", node->shared_function_info(), 
true);
 
  951 void AstPrinter::VisitConditional(Conditional* node) {
 
  952   IndentedScope indent(
this, 
"CONDITIONAL");
 
  953   PrintIndentedVisit(
"?", node->condition());
 
  954   PrintIndentedVisit(
"THEN", node->then_expression());
 
  955   PrintIndentedVisit(
"ELSE", node->else_expression());
 
  959 void AstPrinter::VisitLiteral(Literal* node) {
 
  960   PrintLiteralIndented(
"LITERAL", node->handle(), 
true);
 
  964 void AstPrinter::VisitRegExpLiteral(RegExpLiteral* node) {
 
  965   IndentedScope indent(
this, 
"REGEXP LITERAL");
 
  966   PrintLiteralIndented(
"PATTERN", node->pattern(), 
false);
 
  967   PrintLiteralIndented(
"FLAGS", node->flags(), 
false);
 
  971 void AstPrinter::VisitObjectLiteral(ObjectLiteral* node) {
 
  972   IndentedScope indent(
this, 
"OBJ LITERAL");
 
  973   for (
int i = 0; i < node->properties()->length(); i++) {
 
  974     const char* prop_kind = 
NULL;
 
  975     switch (node->properties()->at(i)->kind()) {
 
  976       case ObjectLiteral::Property::CONSTANT:
 
  977         prop_kind = 
"PROPERTY - CONSTANT";
 
  979       case ObjectLiteral::Property::COMPUTED:
 
  980         prop_kind = 
"PROPERTY - COMPUTED";
 
  982       case ObjectLiteral::Property::MATERIALIZED_LITERAL:
 
  983         prop_kind = 
"PROPERTY - MATERIALIZED_LITERAL";
 
  985       case ObjectLiteral::Property::PROTOTYPE:
 
  986         prop_kind = 
"PROPERTY - PROTOTYPE";
 
  988       case ObjectLiteral::Property::GETTER:
 
  989         prop_kind = 
"PROPERTY - GETTER";
 
  991       case ObjectLiteral::Property::SETTER:
 
  992         prop_kind = 
"PROPERTY - SETTER";
 
  997     IndentedScope prop(
this, prop_kind);
 
  998     PrintIndentedVisit(
"KEY", node->properties()->at(i)->key());
 
  999     PrintIndentedVisit(
"VALUE", node->properties()->at(i)->value());
 
 1004 void AstPrinter::VisitArrayLiteral(ArrayLiteral* node) {
 
 1005   IndentedScope indent(
this, 
"ARRAY LITERAL");
 
 1006   if (node->values()->length() > 0) {
 
 1007     IndentedScope indent(
this, 
"VALUES");
 
 1008     for (
int i = 0; i < node->values()->length(); i++) {
 
 1009       Visit(node->values()->at(i));
 
 1015 void AstPrinter::VisitVariableProxy(VariableProxy* node) {
 
 1016   Variable* var = node->var();
 
 1017   EmbeddedVector<char, 128> buf;
 
 1018   int pos = OS::SNPrintF(buf, 
"VAR PROXY");
 
 1019   switch (var->location()) {
 
 1020     case Variable::UNALLOCATED:
 
 1022     case Variable::PARAMETER:
 
 1023       OS::SNPrintF(buf + pos, 
" parameter[%d]", var->index());
 
 1025     case Variable::LOCAL:
 
 1026       OS::SNPrintF(buf + pos, 
" local[%d]", var->index());
 
 1028     case Variable::CONTEXT:
 
 1029       OS::SNPrintF(buf + pos, 
" context[%d]", var->index());
 
 1031     case Variable::LOOKUP:
 
 1032       OS::SNPrintF(buf + pos, 
" lookup");
 
 1035   PrintLiteralWithModeIndented(buf.start(), var, node->name());
 
 1039 void AstPrinter::VisitAssignment(Assignment* node) {
 
 1040   IndentedScope indent(
this, Token::Name(node->op()), node);
 
 1041   Visit(node->target());
 
 1042   Visit(node->value());
 
 1046 void AstPrinter::VisitThrow(Throw* node) {
 
 1047   PrintIndentedVisit(
"THROW", node->exception());
 
 1051 void AstPrinter::VisitProperty(Property* node) {
 
 1052   IndentedScope indent(
this, 
"PROPERTY", node);
 
 1054   Literal* literal = node->key()->AsLiteral();
 
 1055   if (literal != 
NULL && literal->handle()->IsSymbol()) {
 
 1056     PrintLiteralIndented(
"NAME", literal->handle(), 
false);
 
 1058     PrintIndentedVisit(
"KEY", node->key());
 
 1063 void AstPrinter::VisitCall(Call* node) {
 
 1064   IndentedScope indent(
this, 
"CALL");
 
 1065   Visit(node->expression());
 
 1066   PrintArguments(node->arguments());
 
 1070 void AstPrinter::VisitCallNew(CallNew* node) {
 
 1071   IndentedScope indent(
this, 
"CALL NEW");
 
 1072   Visit(node->expression());
 
 1073   PrintArguments(node->arguments());
 
 1077 void AstPrinter::VisitCallRuntime(CallRuntime* node) {
 
 1078   PrintLiteralIndented(
"CALL RUNTIME ", node->name(), 
false);
 
 1079   IndentedScope indent(
this);
 
 1080   PrintArguments(node->arguments());
 
 1084 void AstPrinter::VisitUnaryOperation(UnaryOperation* node) {
 
 1085   PrintIndentedVisit(Token::Name(node->op()), node->expression());
 
 1089 void AstPrinter::VisitCountOperation(CountOperation* node) {
 
 1090   EmbeddedVector<char, 128> buf;
 
 1091   OS::SNPrintF(buf, 
"%s %s", (node->is_prefix() ? 
"PRE" : 
"POST"),
 
 1092                Token::Name(node->op()));
 
 1093   PrintIndentedVisit(buf.start(), node->expression());
 
 1097 void AstPrinter::VisitBinaryOperation(BinaryOperation* node) {
 
 1098   IndentedScope indent(
this, Token::Name(node->op()), node);
 
 1099   Visit(node->left());
 
 1100   Visit(node->right());
 
 1104 void AstPrinter::VisitCompareOperation(CompareOperation* node) {
 
 1105   IndentedScope indent(
this, Token::Name(node->op()), node);
 
 1106   Visit(node->left());
 
 1107   Visit(node->right());
 
 1111 void AstPrinter::VisitThisFunction(ThisFunction* node) {
 
 1112   IndentedScope indent(
this, 
"THIS-FUNCTION");
 
void PrintF(const char *format,...)
static int VSNPrintF(Vector< char > str, const char *format, va_list args)
static String * cast(Object *obj)
#define ASSERT(condition)
v8::Handle< v8::Value > Print(const v8::Arguments &args)
activate correct semantics for inheriting readonliness enable harmony semantics for typeof enable harmony enable harmony proxies enable all harmony harmony_scoping harmony_proxies harmony_scoping tracks arrays with only smi values automatically unbox arrays of doubles use crankshaft use hydrogen range analysis use hydrogen global value numbering use function inlining maximum number of AST nodes considered for a single inlining loop invariant code motion print statistics for hydrogen trace generated IR for specified phases trace register allocator trace range analysis trace representation types environment for every instruction put a break point before deoptimizing polymorphic inlining perform array bounds checks elimination trace on stack replacement optimize closures functions with arguments object optimize functions containing for in loops profiler considers IC stability primitive functions trigger their own optimization re try self optimization if it failed insert an interrupt check at function exit execution budget before interrupt is triggered call count before self optimization self_optimization count_based_interrupts weighted_back_edges trace_opt emit comments in code disassembly enable use of SSE3 instructions if available enable use of CMOV instruction if available enable use of SAHF instruction if enable use of VFP3 instructions if available this implies enabling ARMv7 enable use of ARMv7 instructions if enable use of MIPS FPU instructions if NULL
static const char * String(Value tok)
static JSArray * cast(Object *obj)
activate correct semantics for inheriting readonliness enable harmony semantics for typeof enable harmony enable harmony proxies enable all harmony harmony_scoping harmony_proxies harmony_scoping tracks arrays with only smi values automatically unbox arrays of doubles use crankshaft use hydrogen range analysis use hydrogen global value numbering use function inlining maximum number of AST nodes considered for a single inlining loop invariant code motion print statistics for hydrogen trace generated IR for specified phases trace register allocator trace range analysis trace representation types environment for every instruction put a break point before deoptimizing polymorphic inlining perform array bounds checks elimination trace on stack replacement optimize closures functions with arguments object optimize functions containing for in loops profiler considers IC stability primitive functions trigger their own optimization re try self optimization if it failed insert an interrupt check at function exit execution budget before interrupt is triggered call count before self optimization self_optimization count_based_interrupts weighted_back_edges trace_opt emit comments in code disassembly enable use of SSE3 instructions if available enable use of CMOV instruction if available enable use of SAHF instruction if enable use of VFP3 instructions if available this implies enabling ARMv7 enable use of ARMv7 instructions if enable use of MIPS FPU instructions if NULL
ZoneList< Handle< String > > ZoneStringList
void DeleteArray(T *array)