Index: src/ast.cc |
diff --git a/src/ast.cc b/src/ast.cc |
index 4b6ae680a4823166a5a01c1d15dff4dbd4bb9c41..22645a8642743d64b812ce0b6ffdb0fd749769d0 100644 |
--- a/src/ast.cc |
+++ b/src/ast.cc |
@@ -993,138 +993,78 @@ CaseClause::CaseClause(Isolate* isolate, |
} |
-#define INCREASE_NODE_COUNT(NodeType) \ |
+#define REGULAR_NODE(NodeType) \ |
void AstConstructionVisitor::Visit##NodeType(NodeType* node) { \ |
increase_node_count(); \ |
} |
+#define DONT_OPTIMIZE_NODE(NodeType) \ |
+ void AstConstructionVisitor::Visit##NodeType(NodeType* node) { \ |
+ increase_node_count(); \ |
+ add_flag(kDontOptimize); \ |
+ add_flag(kDontInline); \ |
+ add_flag(kDontSelfOptimize); \ |
+ } |
+#define DONT_INLINE_NODE(NodeType) \ |
+ void AstConstructionVisitor::Visit##NodeType(NodeType* node) { \ |
+ increase_node_count(); \ |
+ add_flag(kDontInline); \ |
+ } |
+#define DONT_SELFOPTIMIZE_NODE(NodeType) \ |
+ void AstConstructionVisitor::Visit##NodeType(NodeType* node) { \ |
+ increase_node_count(); \ |
+ add_flag(kDontSelfOptimize); \ |
+ } |
-INCREASE_NODE_COUNT(VariableDeclaration) |
-INCREASE_NODE_COUNT(FunctionDeclaration) |
-INCREASE_NODE_COUNT(ModuleDeclaration) |
-INCREASE_NODE_COUNT(ImportDeclaration) |
-INCREASE_NODE_COUNT(ExportDeclaration) |
-INCREASE_NODE_COUNT(ModuleLiteral) |
-INCREASE_NODE_COUNT(ModuleVariable) |
-INCREASE_NODE_COUNT(ModulePath) |
-INCREASE_NODE_COUNT(ModuleUrl) |
-INCREASE_NODE_COUNT(Block) |
-INCREASE_NODE_COUNT(ExpressionStatement) |
-INCREASE_NODE_COUNT(EmptyStatement) |
-INCREASE_NODE_COUNT(IfStatement) |
-INCREASE_NODE_COUNT(ContinueStatement) |
-INCREASE_NODE_COUNT(BreakStatement) |
-INCREASE_NODE_COUNT(ReturnStatement) |
-INCREASE_NODE_COUNT(Conditional) |
-INCREASE_NODE_COUNT(Literal) |
-INCREASE_NODE_COUNT(ObjectLiteral) |
-INCREASE_NODE_COUNT(Assignment) |
-INCREASE_NODE_COUNT(Throw) |
-INCREASE_NODE_COUNT(Property) |
-INCREASE_NODE_COUNT(UnaryOperation) |
-INCREASE_NODE_COUNT(CountOperation) |
-INCREASE_NODE_COUNT(BinaryOperation) |
-INCREASE_NODE_COUNT(CompareOperation) |
-INCREASE_NODE_COUNT(ThisFunction) |
-INCREASE_NODE_COUNT(Call) |
-INCREASE_NODE_COUNT(CallNew) |
- |
-#undef INCREASE_NODE_COUNT |
- |
- |
-void AstConstructionVisitor::VisitWithStatement(WithStatement* node) { |
- increase_node_count(); |
- add_flag(kDontOptimize); |
- add_flag(kDontInline); |
-} |
- |
- |
-void AstConstructionVisitor::VisitSwitchStatement(SwitchStatement* node) { |
- increase_node_count(); |
- add_flag(kDontInline); |
-} |
- |
- |
-void AstConstructionVisitor::VisitDoWhileStatement(DoWhileStatement* node) { |
- increase_node_count(); |
- add_flag(kDontSelfOptimize); |
-} |
- |
- |
-void AstConstructionVisitor::VisitWhileStatement(WhileStatement* node) { |
- increase_node_count(); |
- add_flag(kDontSelfOptimize); |
-} |
- |
- |
-void AstConstructionVisitor::VisitForStatement(ForStatement* node) { |
- increase_node_count(); |
- add_flag(kDontSelfOptimize); |
-} |
- |
- |
-void AstConstructionVisitor::VisitForInStatement(ForInStatement* node) { |
- increase_node_count(); |
- add_flag(kDontSelfOptimize); |
-} |
- |
- |
-void AstConstructionVisitor::VisitTryCatchStatement(TryCatchStatement* node) { |
- increase_node_count(); |
- add_flag(kDontOptimize); |
- add_flag(kDontInline); |
-} |
- |
- |
-void AstConstructionVisitor::VisitTryFinallyStatement( |
- TryFinallyStatement* node) { |
- increase_node_count(); |
- add_flag(kDontOptimize); |
- add_flag(kDontInline); |
-} |
- |
- |
-void AstConstructionVisitor::VisitDebuggerStatement(DebuggerStatement* node) { |
- increase_node_count(); |
- add_flag(kDontOptimize); |
- add_flag(kDontInline); |
-} |
- |
- |
-void AstConstructionVisitor::VisitFunctionLiteral(FunctionLiteral* node) { |
- increase_node_count(); |
- add_flag(kDontInline); |
-} |
- |
- |
-void AstConstructionVisitor::VisitSharedFunctionInfoLiteral( |
- SharedFunctionInfoLiteral* node) { |
- increase_node_count(); |
- add_flag(kDontOptimize); |
- add_flag(kDontInline); |
-} |
- |
- |
-void AstConstructionVisitor::VisitVariableProxy(VariableProxy* node) { |
- increase_node_count(); |
- // In theory, we'd have to add: |
- // if(node->var()->IsLookupSlot()) { add_flag(kDontInline); } |
- // However, node->var() is usually not bound yet at VariableProxy creation |
- // time, and LOOKUP variables only result from constructs that cannot |
- // be inlined anyway. |
-} |
- |
- |
-void AstConstructionVisitor::VisitRegExpLiteral(RegExpLiteral* node) { |
- increase_node_count(); |
- add_flag(kDontInline); // TODO(1322): Allow materialized literals. |
-} |
- |
- |
-void AstConstructionVisitor::VisitArrayLiteral(ArrayLiteral* node) { |
- increase_node_count(); |
- add_flag(kDontInline); // TODO(1322): Allow materialized literals. |
-} |
- |
+REGULAR_NODE(VariableDeclaration) |
+REGULAR_NODE(FunctionDeclaration) |
+REGULAR_NODE(Block) |
+REGULAR_NODE(ExpressionStatement) |
+REGULAR_NODE(EmptyStatement) |
+REGULAR_NODE(IfStatement) |
+REGULAR_NODE(ContinueStatement) |
+REGULAR_NODE(BreakStatement) |
+REGULAR_NODE(ReturnStatement) |
+REGULAR_NODE(Conditional) |
+REGULAR_NODE(Literal) |
+REGULAR_NODE(ObjectLiteral) |
+REGULAR_NODE(Assignment) |
+REGULAR_NODE(Throw) |
+REGULAR_NODE(Property) |
+REGULAR_NODE(UnaryOperation) |
+REGULAR_NODE(CountOperation) |
+REGULAR_NODE(BinaryOperation) |
+REGULAR_NODE(CompareOperation) |
+REGULAR_NODE(ThisFunction) |
+REGULAR_NODE(Call) |
+REGULAR_NODE(CallNew) |
+// In theory, for VariableProxy we'd have to add: |
+// if (node->var()->IsLookupSlot()) add_flag(kDontInline); |
+// But node->var() is usually not bound yet at VariableProxy creation time, and |
+// LOOKUP variables only result from constructs that cannot be inlined anyway. |
+REGULAR_NODE(VariableProxy) |
+ |
+DONT_OPTIMIZE_NODE(ModuleDeclaration) |
+DONT_OPTIMIZE_NODE(ImportDeclaration) |
+DONT_OPTIMIZE_NODE(ExportDeclaration) |
+DONT_OPTIMIZE_NODE(ModuleLiteral) |
+DONT_OPTIMIZE_NODE(ModuleVariable) |
+DONT_OPTIMIZE_NODE(ModulePath) |
+DONT_OPTIMIZE_NODE(ModuleUrl) |
+DONT_OPTIMIZE_NODE(WithStatement) |
+DONT_OPTIMIZE_NODE(TryCatchStatement) |
+DONT_OPTIMIZE_NODE(TryFinallyStatement) |
+DONT_OPTIMIZE_NODE(DebuggerStatement) |
+DONT_OPTIMIZE_NODE(SharedFunctionInfoLiteral) |
+ |
+DONT_INLINE_NODE(SwitchStatement) |
+DONT_INLINE_NODE(FunctionLiteral) |
+DONT_INLINE_NODE(RegExpLiteral) // TODO(1322): Allow materialized literals. |
+DONT_INLINE_NODE(ArrayLiteral) // TODO(1322): Allow materialized literals. |
+ |
+DONT_SELFOPTIMIZE_NODE(DoWhileStatement) |
+DONT_SELFOPTIMIZE_NODE(WhileStatement) |
+DONT_SELFOPTIMIZE_NODE(ForStatement) |
+DONT_SELFOPTIMIZE_NODE(ForInStatement) |
void AstConstructionVisitor::VisitCallRuntime(CallRuntime* node) { |
increase_node_count(); |
@@ -1142,6 +1082,11 @@ void AstConstructionVisitor::VisitCallRuntime(CallRuntime* node) { |
} |
} |
+#undef REGULAR_NODE |
+#undef DONT_OPTIMIZE_NODE |
+#undef DONT_INLINE_NODE |
+#undef DONT_SELFOPTIMIZE_NODE |
+ |
Handle<String> Literal::ToString() { |
if (handle_->IsString()) return Handle<String>::cast(handle_); |