Move AST node counting to post-pass
R=mstarzinger@chromium.org, svenpanne@chromium.org BUG= Review URL: https://codereview.chromium.org/683023002 Cr-Commit-Position: refs/heads/master@{#24937} git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@24937 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
parent
c1862ecdd6
commit
d518d3bce7
@ -39,7 +39,10 @@ class AstNumberingVisitor FINAL : public AstVisitor {
|
|||||||
return tmp;
|
return tmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void IncrementNodeCount() { properties_.add_node_count(1); }
|
||||||
|
|
||||||
int next_id_;
|
int next_id_;
|
||||||
|
AstProperties properties_;
|
||||||
|
|
||||||
DEFINE_AST_VISITOR_SUBCLASS_MEMBERS();
|
DEFINE_AST_VISITOR_SUBCLASS_MEMBERS();
|
||||||
DISALLOW_COPY_AND_ASSIGN(AstNumberingVisitor);
|
DISALLOW_COPY_AND_ASSIGN(AstNumberingVisitor);
|
||||||
@ -47,102 +50,127 @@ class AstNumberingVisitor FINAL : public AstVisitor {
|
|||||||
|
|
||||||
|
|
||||||
void AstNumberingVisitor::VisitVariableDeclaration(VariableDeclaration* node) {
|
void AstNumberingVisitor::VisitVariableDeclaration(VariableDeclaration* node) {
|
||||||
|
IncrementNodeCount();
|
||||||
VisitVariableProxy(node->proxy());
|
VisitVariableProxy(node->proxy());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void AstNumberingVisitor::VisitExportDeclaration(ExportDeclaration* node) {
|
void AstNumberingVisitor::VisitExportDeclaration(ExportDeclaration* node) {
|
||||||
|
IncrementNodeCount();
|
||||||
VisitVariableProxy(node->proxy());
|
VisitVariableProxy(node->proxy());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void AstNumberingVisitor::VisitModuleUrl(ModuleUrl* node) {}
|
void AstNumberingVisitor::VisitModuleUrl(ModuleUrl* node) {
|
||||||
|
IncrementNodeCount();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void AstNumberingVisitor::VisitEmptyStatement(EmptyStatement* node) {}
|
void AstNumberingVisitor::VisitEmptyStatement(EmptyStatement* node) {
|
||||||
|
IncrementNodeCount();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void AstNumberingVisitor::VisitContinueStatement(ContinueStatement* node) {}
|
void AstNumberingVisitor::VisitContinueStatement(ContinueStatement* node) {
|
||||||
|
IncrementNodeCount();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void AstNumberingVisitor::VisitBreakStatement(BreakStatement* node) {}
|
void AstNumberingVisitor::VisitBreakStatement(BreakStatement* node) {
|
||||||
|
IncrementNodeCount();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void AstNumberingVisitor::VisitDebuggerStatement(DebuggerStatement* node) {
|
void AstNumberingVisitor::VisitDebuggerStatement(DebuggerStatement* node) {
|
||||||
|
IncrementNodeCount();
|
||||||
node->set_base_id(ReserveIdRange(DebuggerStatement::num_ids()));
|
node->set_base_id(ReserveIdRange(DebuggerStatement::num_ids()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void AstNumberingVisitor::VisitNativeFunctionLiteral(
|
void AstNumberingVisitor::VisitNativeFunctionLiteral(
|
||||||
NativeFunctionLiteral* node) {
|
NativeFunctionLiteral* node) {
|
||||||
|
IncrementNodeCount();
|
||||||
node->set_base_id(ReserveIdRange(NativeFunctionLiteral::num_ids()));
|
node->set_base_id(ReserveIdRange(NativeFunctionLiteral::num_ids()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void AstNumberingVisitor::VisitLiteral(Literal* node) {
|
void AstNumberingVisitor::VisitLiteral(Literal* node) {
|
||||||
|
IncrementNodeCount();
|
||||||
node->set_base_id(ReserveIdRange(Literal::num_ids()));
|
node->set_base_id(ReserveIdRange(Literal::num_ids()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void AstNumberingVisitor::VisitRegExpLiteral(RegExpLiteral* node) {
|
void AstNumberingVisitor::VisitRegExpLiteral(RegExpLiteral* node) {
|
||||||
|
IncrementNodeCount();
|
||||||
node->set_base_id(ReserveIdRange(RegExpLiteral::num_ids()));
|
node->set_base_id(ReserveIdRange(RegExpLiteral::num_ids()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void AstNumberingVisitor::VisitVariableProxy(VariableProxy* node) {
|
void AstNumberingVisitor::VisitVariableProxy(VariableProxy* node) {
|
||||||
|
IncrementNodeCount();
|
||||||
node->set_base_id(ReserveIdRange(VariableProxy::num_ids()));
|
node->set_base_id(ReserveIdRange(VariableProxy::num_ids()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void AstNumberingVisitor::VisitThisFunction(ThisFunction* node) {
|
void AstNumberingVisitor::VisitThisFunction(ThisFunction* node) {
|
||||||
|
IncrementNodeCount();
|
||||||
node->set_base_id(ReserveIdRange(ThisFunction::num_ids()));
|
node->set_base_id(ReserveIdRange(ThisFunction::num_ids()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void AstNumberingVisitor::VisitSuperReference(SuperReference* node) {
|
void AstNumberingVisitor::VisitSuperReference(SuperReference* node) {
|
||||||
|
IncrementNodeCount();
|
||||||
node->set_base_id(ReserveIdRange(SuperReference::num_ids()));
|
node->set_base_id(ReserveIdRange(SuperReference::num_ids()));
|
||||||
Visit(node->this_var());
|
Visit(node->this_var());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void AstNumberingVisitor::VisitModuleDeclaration(ModuleDeclaration* node) {
|
void AstNumberingVisitor::VisitModuleDeclaration(ModuleDeclaration* node) {
|
||||||
|
IncrementNodeCount();
|
||||||
VisitVariableProxy(node->proxy());
|
VisitVariableProxy(node->proxy());
|
||||||
Visit(node->module());
|
Visit(node->module());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void AstNumberingVisitor::VisitImportDeclaration(ImportDeclaration* node) {
|
void AstNumberingVisitor::VisitImportDeclaration(ImportDeclaration* node) {
|
||||||
|
IncrementNodeCount();
|
||||||
VisitVariableProxy(node->proxy());
|
VisitVariableProxy(node->proxy());
|
||||||
Visit(node->module());
|
Visit(node->module());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void AstNumberingVisitor::VisitModuleVariable(ModuleVariable* node) {
|
void AstNumberingVisitor::VisitModuleVariable(ModuleVariable* node) {
|
||||||
|
IncrementNodeCount();
|
||||||
Visit(node->proxy());
|
Visit(node->proxy());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void AstNumberingVisitor::VisitModulePath(ModulePath* node) {
|
void AstNumberingVisitor::VisitModulePath(ModulePath* node) {
|
||||||
|
IncrementNodeCount();
|
||||||
Visit(node->module());
|
Visit(node->module());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void AstNumberingVisitor::VisitModuleStatement(ModuleStatement* node) {
|
void AstNumberingVisitor::VisitModuleStatement(ModuleStatement* node) {
|
||||||
|
IncrementNodeCount();
|
||||||
Visit(node->body());
|
Visit(node->body());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void AstNumberingVisitor::VisitExpressionStatement(ExpressionStatement* node) {
|
void AstNumberingVisitor::VisitExpressionStatement(ExpressionStatement* node) {
|
||||||
|
IncrementNodeCount();
|
||||||
Visit(node->expression());
|
Visit(node->expression());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void AstNumberingVisitor::VisitReturnStatement(ReturnStatement* node) {
|
void AstNumberingVisitor::VisitReturnStatement(ReturnStatement* node) {
|
||||||
|
IncrementNodeCount();
|
||||||
Visit(node->expression());
|
Visit(node->expression());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void AstNumberingVisitor::VisitYield(Yield* node) {
|
void AstNumberingVisitor::VisitYield(Yield* node) {
|
||||||
|
IncrementNodeCount();
|
||||||
node->set_base_id(ReserveIdRange(Yield::num_ids()));
|
node->set_base_id(ReserveIdRange(Yield::num_ids()));
|
||||||
Visit(node->generator_object());
|
Visit(node->generator_object());
|
||||||
Visit(node->expression());
|
Visit(node->expression());
|
||||||
@ -150,24 +178,28 @@ void AstNumberingVisitor::VisitYield(Yield* node) {
|
|||||||
|
|
||||||
|
|
||||||
void AstNumberingVisitor::VisitThrow(Throw* node) {
|
void AstNumberingVisitor::VisitThrow(Throw* node) {
|
||||||
|
IncrementNodeCount();
|
||||||
node->set_base_id(ReserveIdRange(Throw::num_ids()));
|
node->set_base_id(ReserveIdRange(Throw::num_ids()));
|
||||||
Visit(node->exception());
|
Visit(node->exception());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void AstNumberingVisitor::VisitUnaryOperation(UnaryOperation* node) {
|
void AstNumberingVisitor::VisitUnaryOperation(UnaryOperation* node) {
|
||||||
|
IncrementNodeCount();
|
||||||
node->set_base_id(ReserveIdRange(UnaryOperation::num_ids()));
|
node->set_base_id(ReserveIdRange(UnaryOperation::num_ids()));
|
||||||
Visit(node->expression());
|
Visit(node->expression());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void AstNumberingVisitor::VisitCountOperation(CountOperation* node) {
|
void AstNumberingVisitor::VisitCountOperation(CountOperation* node) {
|
||||||
|
IncrementNodeCount();
|
||||||
node->set_base_id(ReserveIdRange(CountOperation::num_ids()));
|
node->set_base_id(ReserveIdRange(CountOperation::num_ids()));
|
||||||
Visit(node->expression());
|
Visit(node->expression());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void AstNumberingVisitor::VisitBlock(Block* node) {
|
void AstNumberingVisitor::VisitBlock(Block* node) {
|
||||||
|
IncrementNodeCount();
|
||||||
node->set_base_id(ReserveIdRange(Block::num_ids()));
|
node->set_base_id(ReserveIdRange(Block::num_ids()));
|
||||||
if (node->scope() != NULL) VisitDeclarations(node->scope()->declarations());
|
if (node->scope() != NULL) VisitDeclarations(node->scope()->declarations());
|
||||||
VisitStatements(node->statements());
|
VisitStatements(node->statements());
|
||||||
@ -175,29 +207,34 @@ void AstNumberingVisitor::VisitBlock(Block* node) {
|
|||||||
|
|
||||||
|
|
||||||
void AstNumberingVisitor::VisitFunctionDeclaration(FunctionDeclaration* node) {
|
void AstNumberingVisitor::VisitFunctionDeclaration(FunctionDeclaration* node) {
|
||||||
|
IncrementNodeCount();
|
||||||
VisitVariableProxy(node->proxy());
|
VisitVariableProxy(node->proxy());
|
||||||
VisitFunctionLiteral(node->fun());
|
VisitFunctionLiteral(node->fun());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void AstNumberingVisitor::VisitModuleLiteral(ModuleLiteral* node) {
|
void AstNumberingVisitor::VisitModuleLiteral(ModuleLiteral* node) {
|
||||||
|
IncrementNodeCount();
|
||||||
VisitBlock(node->body());
|
VisitBlock(node->body());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void AstNumberingVisitor::VisitCallRuntime(CallRuntime* node) {
|
void AstNumberingVisitor::VisitCallRuntime(CallRuntime* node) {
|
||||||
|
IncrementNodeCount();
|
||||||
node->set_base_id(ReserveIdRange(CallRuntime::num_ids()));
|
node->set_base_id(ReserveIdRange(CallRuntime::num_ids()));
|
||||||
VisitArguments(node->arguments());
|
VisitArguments(node->arguments());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void AstNumberingVisitor::VisitWithStatement(WithStatement* node) {
|
void AstNumberingVisitor::VisitWithStatement(WithStatement* node) {
|
||||||
|
IncrementNodeCount();
|
||||||
Visit(node->expression());
|
Visit(node->expression());
|
||||||
Visit(node->statement());
|
Visit(node->statement());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void AstNumberingVisitor::VisitDoWhileStatement(DoWhileStatement* node) {
|
void AstNumberingVisitor::VisitDoWhileStatement(DoWhileStatement* node) {
|
||||||
|
IncrementNodeCount();
|
||||||
node->set_base_id(ReserveIdRange(DoWhileStatement::num_ids()));
|
node->set_base_id(ReserveIdRange(DoWhileStatement::num_ids()));
|
||||||
Visit(node->body());
|
Visit(node->body());
|
||||||
Visit(node->cond());
|
Visit(node->cond());
|
||||||
@ -205,6 +242,7 @@ void AstNumberingVisitor::VisitDoWhileStatement(DoWhileStatement* node) {
|
|||||||
|
|
||||||
|
|
||||||
void AstNumberingVisitor::VisitWhileStatement(WhileStatement* node) {
|
void AstNumberingVisitor::VisitWhileStatement(WhileStatement* node) {
|
||||||
|
IncrementNodeCount();
|
||||||
node->set_base_id(ReserveIdRange(WhileStatement::num_ids()));
|
node->set_base_id(ReserveIdRange(WhileStatement::num_ids()));
|
||||||
Visit(node->cond());
|
Visit(node->cond());
|
||||||
Visit(node->body());
|
Visit(node->body());
|
||||||
@ -212,18 +250,21 @@ void AstNumberingVisitor::VisitWhileStatement(WhileStatement* node) {
|
|||||||
|
|
||||||
|
|
||||||
void AstNumberingVisitor::VisitTryCatchStatement(TryCatchStatement* node) {
|
void AstNumberingVisitor::VisitTryCatchStatement(TryCatchStatement* node) {
|
||||||
|
IncrementNodeCount();
|
||||||
Visit(node->try_block());
|
Visit(node->try_block());
|
||||||
Visit(node->catch_block());
|
Visit(node->catch_block());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void AstNumberingVisitor::VisitTryFinallyStatement(TryFinallyStatement* node) {
|
void AstNumberingVisitor::VisitTryFinallyStatement(TryFinallyStatement* node) {
|
||||||
|
IncrementNodeCount();
|
||||||
Visit(node->try_block());
|
Visit(node->try_block());
|
||||||
Visit(node->finally_block());
|
Visit(node->finally_block());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void AstNumberingVisitor::VisitProperty(Property* node) {
|
void AstNumberingVisitor::VisitProperty(Property* node) {
|
||||||
|
IncrementNodeCount();
|
||||||
node->set_base_id(ReserveIdRange(Property::num_ids()));
|
node->set_base_id(ReserveIdRange(Property::num_ids()));
|
||||||
Visit(node->key());
|
Visit(node->key());
|
||||||
Visit(node->obj());
|
Visit(node->obj());
|
||||||
@ -231,6 +272,7 @@ void AstNumberingVisitor::VisitProperty(Property* node) {
|
|||||||
|
|
||||||
|
|
||||||
void AstNumberingVisitor::VisitAssignment(Assignment* node) {
|
void AstNumberingVisitor::VisitAssignment(Assignment* node) {
|
||||||
|
IncrementNodeCount();
|
||||||
node->set_base_id(ReserveIdRange(Assignment::num_ids()));
|
node->set_base_id(ReserveIdRange(Assignment::num_ids()));
|
||||||
if (node->is_compound()) VisitBinaryOperation(node->binary_operation());
|
if (node->is_compound()) VisitBinaryOperation(node->binary_operation());
|
||||||
Visit(node->target());
|
Visit(node->target());
|
||||||
@ -239,6 +281,7 @@ void AstNumberingVisitor::VisitAssignment(Assignment* node) {
|
|||||||
|
|
||||||
|
|
||||||
void AstNumberingVisitor::VisitBinaryOperation(BinaryOperation* node) {
|
void AstNumberingVisitor::VisitBinaryOperation(BinaryOperation* node) {
|
||||||
|
IncrementNodeCount();
|
||||||
node->set_base_id(ReserveIdRange(BinaryOperation::num_ids()));
|
node->set_base_id(ReserveIdRange(BinaryOperation::num_ids()));
|
||||||
Visit(node->left());
|
Visit(node->left());
|
||||||
Visit(node->right());
|
Visit(node->right());
|
||||||
@ -246,6 +289,7 @@ void AstNumberingVisitor::VisitBinaryOperation(BinaryOperation* node) {
|
|||||||
|
|
||||||
|
|
||||||
void AstNumberingVisitor::VisitCompareOperation(CompareOperation* node) {
|
void AstNumberingVisitor::VisitCompareOperation(CompareOperation* node) {
|
||||||
|
IncrementNodeCount();
|
||||||
node->set_base_id(ReserveIdRange(CompareOperation::num_ids()));
|
node->set_base_id(ReserveIdRange(CompareOperation::num_ids()));
|
||||||
Visit(node->left());
|
Visit(node->left());
|
||||||
Visit(node->right());
|
Visit(node->right());
|
||||||
@ -253,6 +297,7 @@ void AstNumberingVisitor::VisitCompareOperation(CompareOperation* node) {
|
|||||||
|
|
||||||
|
|
||||||
void AstNumberingVisitor::VisitForInStatement(ForInStatement* node) {
|
void AstNumberingVisitor::VisitForInStatement(ForInStatement* node) {
|
||||||
|
IncrementNodeCount();
|
||||||
node->set_base_id(ReserveIdRange(ForInStatement::num_ids()));
|
node->set_base_id(ReserveIdRange(ForInStatement::num_ids()));
|
||||||
Visit(node->each());
|
Visit(node->each());
|
||||||
Visit(node->enumerable());
|
Visit(node->enumerable());
|
||||||
@ -261,6 +306,7 @@ void AstNumberingVisitor::VisitForInStatement(ForInStatement* node) {
|
|||||||
|
|
||||||
|
|
||||||
void AstNumberingVisitor::VisitForOfStatement(ForOfStatement* node) {
|
void AstNumberingVisitor::VisitForOfStatement(ForOfStatement* node) {
|
||||||
|
IncrementNodeCount();
|
||||||
node->set_base_id(ReserveIdRange(ForOfStatement::num_ids()));
|
node->set_base_id(ReserveIdRange(ForOfStatement::num_ids()));
|
||||||
Visit(node->assign_iterator());
|
Visit(node->assign_iterator());
|
||||||
Visit(node->next_result());
|
Visit(node->next_result());
|
||||||
@ -271,6 +317,7 @@ void AstNumberingVisitor::VisitForOfStatement(ForOfStatement* node) {
|
|||||||
|
|
||||||
|
|
||||||
void AstNumberingVisitor::VisitConditional(Conditional* node) {
|
void AstNumberingVisitor::VisitConditional(Conditional* node) {
|
||||||
|
IncrementNodeCount();
|
||||||
node->set_base_id(ReserveIdRange(Conditional::num_ids()));
|
node->set_base_id(ReserveIdRange(Conditional::num_ids()));
|
||||||
Visit(node->condition());
|
Visit(node->condition());
|
||||||
Visit(node->then_expression());
|
Visit(node->then_expression());
|
||||||
@ -279,6 +326,7 @@ void AstNumberingVisitor::VisitConditional(Conditional* node) {
|
|||||||
|
|
||||||
|
|
||||||
void AstNumberingVisitor::VisitIfStatement(IfStatement* node) {
|
void AstNumberingVisitor::VisitIfStatement(IfStatement* node) {
|
||||||
|
IncrementNodeCount();
|
||||||
node->set_base_id(ReserveIdRange(IfStatement::num_ids()));
|
node->set_base_id(ReserveIdRange(IfStatement::num_ids()));
|
||||||
Visit(node->condition());
|
Visit(node->condition());
|
||||||
Visit(node->then_statement());
|
Visit(node->then_statement());
|
||||||
@ -289,6 +337,7 @@ void AstNumberingVisitor::VisitIfStatement(IfStatement* node) {
|
|||||||
|
|
||||||
|
|
||||||
void AstNumberingVisitor::VisitSwitchStatement(SwitchStatement* node) {
|
void AstNumberingVisitor::VisitSwitchStatement(SwitchStatement* node) {
|
||||||
|
IncrementNodeCount();
|
||||||
node->set_base_id(ReserveIdRange(SwitchStatement::num_ids()));
|
node->set_base_id(ReserveIdRange(SwitchStatement::num_ids()));
|
||||||
Visit(node->tag());
|
Visit(node->tag());
|
||||||
ZoneList<CaseClause*>* cases = node->cases();
|
ZoneList<CaseClause*>* cases = node->cases();
|
||||||
@ -299,6 +348,7 @@ void AstNumberingVisitor::VisitSwitchStatement(SwitchStatement* node) {
|
|||||||
|
|
||||||
|
|
||||||
void AstNumberingVisitor::VisitCaseClause(CaseClause* node) {
|
void AstNumberingVisitor::VisitCaseClause(CaseClause* node) {
|
||||||
|
IncrementNodeCount();
|
||||||
node->set_base_id(ReserveIdRange(CaseClause::num_ids()));
|
node->set_base_id(ReserveIdRange(CaseClause::num_ids()));
|
||||||
if (!node->is_default()) Visit(node->label());
|
if (!node->is_default()) Visit(node->label());
|
||||||
VisitStatements(node->statements());
|
VisitStatements(node->statements());
|
||||||
@ -306,6 +356,7 @@ void AstNumberingVisitor::VisitCaseClause(CaseClause* node) {
|
|||||||
|
|
||||||
|
|
||||||
void AstNumberingVisitor::VisitForStatement(ForStatement* node) {
|
void AstNumberingVisitor::VisitForStatement(ForStatement* node) {
|
||||||
|
IncrementNodeCount();
|
||||||
node->set_base_id(ReserveIdRange(ForStatement::num_ids()));
|
node->set_base_id(ReserveIdRange(ForStatement::num_ids()));
|
||||||
if (node->init() != NULL) Visit(node->init());
|
if (node->init() != NULL) Visit(node->init());
|
||||||
if (node->cond() != NULL) Visit(node->cond());
|
if (node->cond() != NULL) Visit(node->cond());
|
||||||
@ -315,6 +366,7 @@ void AstNumberingVisitor::VisitForStatement(ForStatement* node) {
|
|||||||
|
|
||||||
|
|
||||||
void AstNumberingVisitor::VisitClassLiteral(ClassLiteral* node) {
|
void AstNumberingVisitor::VisitClassLiteral(ClassLiteral* node) {
|
||||||
|
IncrementNodeCount();
|
||||||
node->set_base_id(ReserveIdRange(ClassLiteral::num_ids()));
|
node->set_base_id(ReserveIdRange(ClassLiteral::num_ids()));
|
||||||
if (node->extends()) Visit(node->extends());
|
if (node->extends()) Visit(node->extends());
|
||||||
if (node->constructor()) Visit(node->constructor());
|
if (node->constructor()) Visit(node->constructor());
|
||||||
@ -325,6 +377,7 @@ void AstNumberingVisitor::VisitClassLiteral(ClassLiteral* node) {
|
|||||||
|
|
||||||
|
|
||||||
void AstNumberingVisitor::VisitObjectLiteral(ObjectLiteral* node) {
|
void AstNumberingVisitor::VisitObjectLiteral(ObjectLiteral* node) {
|
||||||
|
IncrementNodeCount();
|
||||||
node->set_base_id(ReserveIdRange(ObjectLiteral::num_ids()));
|
node->set_base_id(ReserveIdRange(ObjectLiteral::num_ids()));
|
||||||
for (int i = 0; i < node->properties()->length(); i++) {
|
for (int i = 0; i < node->properties()->length(); i++) {
|
||||||
VisitObjectLiteralProperty(node->properties()->at(i));
|
VisitObjectLiteralProperty(node->properties()->at(i));
|
||||||
@ -340,6 +393,7 @@ void AstNumberingVisitor::VisitObjectLiteralProperty(
|
|||||||
|
|
||||||
|
|
||||||
void AstNumberingVisitor::VisitArrayLiteral(ArrayLiteral* node) {
|
void AstNumberingVisitor::VisitArrayLiteral(ArrayLiteral* node) {
|
||||||
|
IncrementNodeCount();
|
||||||
node->set_base_id(ReserveIdRange(node->num_ids()));
|
node->set_base_id(ReserveIdRange(node->num_ids()));
|
||||||
for (int i = 0; i < node->values()->length(); i++) {
|
for (int i = 0; i < node->values()->length(); i++) {
|
||||||
Visit(node->values()->at(i));
|
Visit(node->values()->at(i));
|
||||||
@ -348,6 +402,7 @@ void AstNumberingVisitor::VisitArrayLiteral(ArrayLiteral* node) {
|
|||||||
|
|
||||||
|
|
||||||
void AstNumberingVisitor::VisitCall(Call* node) {
|
void AstNumberingVisitor::VisitCall(Call* node) {
|
||||||
|
IncrementNodeCount();
|
||||||
node->set_base_id(ReserveIdRange(Call::num_ids()));
|
node->set_base_id(ReserveIdRange(Call::num_ids()));
|
||||||
Visit(node->expression());
|
Visit(node->expression());
|
||||||
VisitArguments(node->arguments());
|
VisitArguments(node->arguments());
|
||||||
@ -355,6 +410,7 @@ void AstNumberingVisitor::VisitCall(Call* node) {
|
|||||||
|
|
||||||
|
|
||||||
void AstNumberingVisitor::VisitCallNew(CallNew* node) {
|
void AstNumberingVisitor::VisitCallNew(CallNew* node) {
|
||||||
|
IncrementNodeCount();
|
||||||
node->set_base_id(ReserveIdRange(CallNew::num_ids()));
|
node->set_base_id(ReserveIdRange(CallNew::num_ids()));
|
||||||
Visit(node->expression());
|
Visit(node->expression());
|
||||||
VisitArguments(node->arguments());
|
VisitArguments(node->arguments());
|
||||||
@ -385,6 +441,7 @@ void AstNumberingVisitor::VisitArguments(ZoneList<Expression*>* arguments) {
|
|||||||
|
|
||||||
|
|
||||||
void AstNumberingVisitor::VisitFunctionLiteral(FunctionLiteral* node) {
|
void AstNumberingVisitor::VisitFunctionLiteral(FunctionLiteral* node) {
|
||||||
|
IncrementNodeCount();
|
||||||
node->set_base_id(ReserveIdRange(FunctionLiteral::num_ids()));
|
node->set_base_id(ReserveIdRange(FunctionLiteral::num_ids()));
|
||||||
// We don't recurse into the declarations or body of the function literal:
|
// We don't recurse into the declarations or body of the function literal:
|
||||||
// you have to separately Renumber() each FunctionLiteral that you compile.
|
// you have to separately Renumber() each FunctionLiteral that you compile.
|
||||||
@ -392,6 +449,10 @@ void AstNumberingVisitor::VisitFunctionLiteral(FunctionLiteral* node) {
|
|||||||
|
|
||||||
|
|
||||||
void AstNumberingVisitor::Renumber(FunctionLiteral* node) {
|
void AstNumberingVisitor::Renumber(FunctionLiteral* node) {
|
||||||
|
properties_.flags()->Add(*node->flags());
|
||||||
|
properties_.increase_feedback_slots(node->slot_count());
|
||||||
|
properties_.increase_ic_feedback_slots(node->ic_slot_count());
|
||||||
|
|
||||||
if (node->scope()->HasIllegalRedeclaration()) {
|
if (node->scope()->HasIllegalRedeclaration()) {
|
||||||
node->scope()->VisitIllegalRedeclaration(this);
|
node->scope()->VisitIllegalRedeclaration(this);
|
||||||
return;
|
return;
|
||||||
@ -404,6 +465,8 @@ void AstNumberingVisitor::Renumber(FunctionLiteral* node) {
|
|||||||
Visit(scope->function());
|
Visit(scope->function());
|
||||||
}
|
}
|
||||||
VisitStatements(node->body());
|
VisitStatements(node->body());
|
||||||
|
|
||||||
|
node->set_ast_properties(&properties_);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
10
src/ast.cc
10
src/ast.cc
@ -998,36 +998,30 @@ CaseClause::CaseClause(Zone* zone, Expression* label,
|
|||||||
|
|
||||||
#define REGULAR_NODE(NodeType) \
|
#define REGULAR_NODE(NodeType) \
|
||||||
void AstConstructionVisitor::Visit##NodeType(NodeType* node) { \
|
void AstConstructionVisitor::Visit##NodeType(NodeType* node) { \
|
||||||
increase_node_count(); \
|
|
||||||
}
|
}
|
||||||
#define REGULAR_NODE_WITH_FEEDBACK_SLOTS(NodeType) \
|
#define REGULAR_NODE_WITH_FEEDBACK_SLOTS(NodeType) \
|
||||||
void AstConstructionVisitor::Visit##NodeType(NodeType* node) { \
|
void AstConstructionVisitor::Visit##NodeType(NodeType* node) { \
|
||||||
increase_node_count(); \
|
|
||||||
add_slot_node(node); \
|
add_slot_node(node); \
|
||||||
}
|
}
|
||||||
#define DONT_OPTIMIZE_NODE(NodeType) \
|
#define DONT_OPTIMIZE_NODE(NodeType) \
|
||||||
void AstConstructionVisitor::Visit##NodeType(NodeType* node) { \
|
void AstConstructionVisitor::Visit##NodeType(NodeType* node) { \
|
||||||
increase_node_count(); \
|
|
||||||
set_dont_crankshaft_reason(k##NodeType); \
|
set_dont_crankshaft_reason(k##NodeType); \
|
||||||
add_flag(kDontSelfOptimize); \
|
add_flag(kDontSelfOptimize); \
|
||||||
}
|
}
|
||||||
#define DONT_OPTIMIZE_NODE_WITH_FEEDBACK_SLOTS(NodeType) \
|
#define DONT_OPTIMIZE_NODE_WITH_FEEDBACK_SLOTS(NodeType) \
|
||||||
void AstConstructionVisitor::Visit##NodeType(NodeType* node) { \
|
void AstConstructionVisitor::Visit##NodeType(NodeType* node) { \
|
||||||
increase_node_count(); \
|
|
||||||
add_slot_node(node); \
|
add_slot_node(node); \
|
||||||
set_dont_crankshaft_reason(k##NodeType); \
|
set_dont_crankshaft_reason(k##NodeType); \
|
||||||
add_flag(kDontSelfOptimize); \
|
add_flag(kDontSelfOptimize); \
|
||||||
}
|
}
|
||||||
#define DONT_TURBOFAN_NODE(NodeType) \
|
#define DONT_TURBOFAN_NODE(NodeType) \
|
||||||
void AstConstructionVisitor::Visit##NodeType(NodeType* node) { \
|
void AstConstructionVisitor::Visit##NodeType(NodeType* node) { \
|
||||||
increase_node_count(); \
|
|
||||||
set_dont_crankshaft_reason(k##NodeType); \
|
set_dont_crankshaft_reason(k##NodeType); \
|
||||||
set_dont_turbofan_reason(k##NodeType); \
|
set_dont_turbofan_reason(k##NodeType); \
|
||||||
add_flag(kDontSelfOptimize); \
|
add_flag(kDontSelfOptimize); \
|
||||||
}
|
}
|
||||||
#define DONT_TURBOFAN_NODE_WITH_FEEDBACK_SLOTS(NodeType) \
|
#define DONT_TURBOFAN_NODE_WITH_FEEDBACK_SLOTS(NodeType) \
|
||||||
void AstConstructionVisitor::Visit##NodeType(NodeType* node) { \
|
void AstConstructionVisitor::Visit##NodeType(NodeType* node) { \
|
||||||
increase_node_count(); \
|
|
||||||
add_slot_node(node); \
|
add_slot_node(node); \
|
||||||
set_dont_crankshaft_reason(k##NodeType); \
|
set_dont_crankshaft_reason(k##NodeType); \
|
||||||
set_dont_turbofan_reason(k##NodeType); \
|
set_dont_turbofan_reason(k##NodeType); \
|
||||||
@ -1035,18 +1029,15 @@ CaseClause::CaseClause(Zone* zone, Expression* label,
|
|||||||
}
|
}
|
||||||
#define DONT_SELFOPTIMIZE_NODE(NodeType) \
|
#define DONT_SELFOPTIMIZE_NODE(NodeType) \
|
||||||
void AstConstructionVisitor::Visit##NodeType(NodeType* node) { \
|
void AstConstructionVisitor::Visit##NodeType(NodeType* node) { \
|
||||||
increase_node_count(); \
|
|
||||||
add_flag(kDontSelfOptimize); \
|
add_flag(kDontSelfOptimize); \
|
||||||
}
|
}
|
||||||
#define DONT_SELFOPTIMIZE_NODE_WITH_FEEDBACK_SLOTS(NodeType) \
|
#define DONT_SELFOPTIMIZE_NODE_WITH_FEEDBACK_SLOTS(NodeType) \
|
||||||
void AstConstructionVisitor::Visit##NodeType(NodeType* node) { \
|
void AstConstructionVisitor::Visit##NodeType(NodeType* node) { \
|
||||||
increase_node_count(); \
|
|
||||||
add_slot_node(node); \
|
add_slot_node(node); \
|
||||||
add_flag(kDontSelfOptimize); \
|
add_flag(kDontSelfOptimize); \
|
||||||
}
|
}
|
||||||
#define DONT_CACHE_NODE(NodeType) \
|
#define DONT_CACHE_NODE(NodeType) \
|
||||||
void AstConstructionVisitor::Visit##NodeType(NodeType* node) { \
|
void AstConstructionVisitor::Visit##NodeType(NodeType* node) { \
|
||||||
increase_node_count(); \
|
|
||||||
set_dont_crankshaft_reason(k##NodeType); \
|
set_dont_crankshaft_reason(k##NodeType); \
|
||||||
add_flag(kDontSelfOptimize); \
|
add_flag(kDontSelfOptimize); \
|
||||||
add_flag(kDontCache); \
|
add_flag(kDontCache); \
|
||||||
@ -1120,7 +1111,6 @@ DONT_CACHE_NODE(ModuleLiteral)
|
|||||||
|
|
||||||
|
|
||||||
void AstConstructionVisitor::VisitCallRuntime(CallRuntime* node) {
|
void AstConstructionVisitor::VisitCallRuntime(CallRuntime* node) {
|
||||||
increase_node_count();
|
|
||||||
add_slot_node(node);
|
add_slot_node(node);
|
||||||
if (node->is_jsruntime()) {
|
if (node->is_jsruntime()) {
|
||||||
// Don't try to optimize JS runtime calls because we bailout on them.
|
// Don't try to optimize JS runtime calls because we bailout on them.
|
||||||
|
@ -3146,7 +3146,6 @@ class AstConstructionVisitor BASE_EMBEDDED {
|
|||||||
AST_NODE_LIST(DEF_VISIT)
|
AST_NODE_LIST(DEF_VISIT)
|
||||||
#undef DEF_VISIT
|
#undef DEF_VISIT
|
||||||
|
|
||||||
void increase_node_count() { properties_.add_node_count(1); }
|
|
||||||
void add_flag(AstPropertiesFlag flag) { properties_.flags()->Add(flag); }
|
void add_flag(AstPropertiesFlag flag) { properties_.flags()->Add(flag); }
|
||||||
void set_dont_crankshaft_reason(BailoutReason reason) {
|
void set_dont_crankshaft_reason(BailoutReason reason) {
|
||||||
dont_crankshaft_reason_ = reason;
|
dont_crankshaft_reason_ = reason;
|
||||||
|
@ -647,12 +647,7 @@ static void RecordFunctionCompilation(Logger::LogEventsAndTags tag,
|
|||||||
|
|
||||||
static bool CompileUnoptimizedCode(CompilationInfo* info) {
|
static bool CompileUnoptimizedCode(CompilationInfo* info) {
|
||||||
DCHECK(AllowCompilation::IsAllowed(info->isolate()));
|
DCHECK(AllowCompilation::IsAllowed(info->isolate()));
|
||||||
DCHECK(info->function() != NULL);
|
if (!Compiler::Analyze(info) || !FullCodeGenerator::MakeCode(info)) {
|
||||||
if (!Rewriter::Rewrite(info)) return false;
|
|
||||||
if (!Scope::Analyze(info)) return false;
|
|
||||||
DCHECK(info->scope() != NULL);
|
|
||||||
|
|
||||||
if (!FullCodeGenerator::MakeCode(info)) {
|
|
||||||
Isolate* isolate = info->isolate();
|
Isolate* isolate = info->isolate();
|
||||||
if (!isolate->has_pending_exception()) isolate->StackOverflow();
|
if (!isolate->has_pending_exception()) isolate->StackOverflow();
|
||||||
return false;
|
return false;
|
||||||
@ -673,7 +668,6 @@ MUST_USE_RESULT static MaybeHandle<Code> GetUnoptimizedCodeCommon(
|
|||||||
shared->set_strict_mode(lit->strict_mode());
|
shared->set_strict_mode(lit->strict_mode());
|
||||||
SetExpectedNofPropertiesFromEstimate(shared, lit->expected_property_count());
|
SetExpectedNofPropertiesFromEstimate(shared, lit->expected_property_count());
|
||||||
shared->set_bailout_reason(lit->dont_optimize_reason());
|
shared->set_bailout_reason(lit->dont_optimize_reason());
|
||||||
shared->set_ast_node_count(lit->ast_node_count());
|
|
||||||
|
|
||||||
// Compile unoptimized code.
|
// Compile unoptimized code.
|
||||||
if (!CompileUnoptimizedCode(info)) return MaybeHandle<Code>();
|
if (!CompileUnoptimizedCode(info)) return MaybeHandle<Code>();
|
||||||
@ -743,18 +737,33 @@ static void InsertCodeIntoOptimizedCodeMap(CompilationInfo* info) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static bool CompileOptimizedPrologue(CompilationInfo* info) {
|
static bool Renumber(CompilationInfo* info) {
|
||||||
if (!Parser::Parse(info)) return false;
|
if (!AstNumbering::Renumber(info->function(), info->zone())) return false;
|
||||||
|
if (!info->shared_info().is_null()) {
|
||||||
|
info->shared_info()->set_ast_node_count(info->function()->ast_node_count());
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool Compiler::Analyze(CompilationInfo* info) {
|
||||||
|
DCHECK(info->function() != NULL);
|
||||||
if (!Rewriter::Rewrite(info)) return false;
|
if (!Rewriter::Rewrite(info)) return false;
|
||||||
if (!Scope::Analyze(info)) return false;
|
if (!Scope::Analyze(info)) return false;
|
||||||
if (!AstNumbering::Renumber(info->function(), info->zone())) return false;
|
if (!Renumber(info)) return false;
|
||||||
DCHECK(info->scope() != NULL);
|
DCHECK(info->scope() != NULL);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool Compiler::ParseAndAnalyze(CompilationInfo* info) {
|
||||||
|
if (!Parser::Parse(info)) return false;
|
||||||
|
return Compiler::Analyze(info);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static bool GetOptimizedCodeNow(CompilationInfo* info) {
|
static bool GetOptimizedCodeNow(CompilationInfo* info) {
|
||||||
if (!CompileOptimizedPrologue(info)) return false;
|
if (!Compiler::ParseAndAnalyze(info)) return false;
|
||||||
|
|
||||||
TimerEventScope<TimerEventRecompileSynchronous> timer(info->isolate());
|
TimerEventScope<TimerEventRecompileSynchronous> timer(info->isolate());
|
||||||
|
|
||||||
@ -796,7 +805,7 @@ static bool GetOptimizedCodeLater(CompilationInfo* info) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
CompilationHandleScope handle_scope(info);
|
CompilationHandleScope handle_scope(info);
|
||||||
if (!CompileOptimizedPrologue(info)) return false;
|
if (!Compiler::ParseAndAnalyze(info)) return false;
|
||||||
info->SaveHandles(); // Copy handles to the compilation handle scope.
|
info->SaveHandles(); // Copy handles to the compilation handle scope.
|
||||||
|
|
||||||
TimerEventScope<TimerEventRecompileSynchronous> timer(info->isolate());
|
TimerEventScope<TimerEventRecompileSynchronous> timer(info->isolate());
|
||||||
@ -910,6 +919,8 @@ bool Compiler::EnsureCompiled(Handle<JSFunction> function,
|
|||||||
// TODO(turbofan): In the future, unoptimized code with deopt support could
|
// TODO(turbofan): In the future, unoptimized code with deopt support could
|
||||||
// be generated lazily once deopt is triggered.
|
// be generated lazily once deopt is triggered.
|
||||||
bool Compiler::EnsureDeoptimizationSupport(CompilationInfo* info) {
|
bool Compiler::EnsureDeoptimizationSupport(CompilationInfo* info) {
|
||||||
|
DCHECK(info->function() != NULL);
|
||||||
|
DCHECK(info->scope() != NULL);
|
||||||
if (!info->shared_info()->has_deoptimization_support()) {
|
if (!info->shared_info()->has_deoptimization_support()) {
|
||||||
CompilationInfoWithZone unoptimized(info->shared_info());
|
CompilationInfoWithZone unoptimized(info->shared_info());
|
||||||
// Note that we use the same AST that we will use for generating the
|
// Note that we use the same AST that we will use for generating the
|
||||||
@ -1302,7 +1313,7 @@ Handle<SharedFunctionInfo> Compiler::BuildFunctionInfo(
|
|||||||
Handle<Code> code = isolate->builtins()->CompileLazy();
|
Handle<Code> code = isolate->builtins()->CompileLazy();
|
||||||
info.SetCode(code);
|
info.SetCode(code);
|
||||||
scope_info = Handle<ScopeInfo>(ScopeInfo::Empty(isolate));
|
scope_info = Handle<ScopeInfo>(ScopeInfo::Empty(isolate));
|
||||||
} else if (FullCodeGenerator::MakeCode(&info)) {
|
} else if (Renumber(&info) && FullCodeGenerator::MakeCode(&info)) {
|
||||||
DCHECK(!info.code().is_null());
|
DCHECK(!info.code().is_null());
|
||||||
scope_info = ScopeInfo::Create(info.scope(), info.zone());
|
scope_info = ScopeInfo::Create(info.scope(), info.zone());
|
||||||
} else {
|
} else {
|
||||||
|
@ -675,11 +675,16 @@ class Compiler : public AllStatic {
|
|||||||
MUST_USE_RESULT static MaybeHandle<Code> GetDebugCode(
|
MUST_USE_RESULT static MaybeHandle<Code> GetDebugCode(
|
||||||
Handle<JSFunction> function);
|
Handle<JSFunction> function);
|
||||||
|
|
||||||
|
// Parser::Parse, then Compiler::Analyze.
|
||||||
|
static bool ParseAndAnalyze(CompilationInfo* info);
|
||||||
|
// Rewrite, analyze scopes, and renumber.
|
||||||
|
static bool Analyze(CompilationInfo* info);
|
||||||
|
// Adds deoptimization support, requires ParseAndAnalyze.
|
||||||
|
static bool EnsureDeoptimizationSupport(CompilationInfo* info);
|
||||||
|
|
||||||
static bool EnsureCompiled(Handle<JSFunction> function,
|
static bool EnsureCompiled(Handle<JSFunction> function,
|
||||||
ClearExceptionFlag flag);
|
ClearExceptionFlag flag);
|
||||||
|
|
||||||
static bool EnsureDeoptimizationSupport(CompilationInfo* info);
|
|
||||||
|
|
||||||
static void CompileForLiveEdit(Handle<Script> script);
|
static void CompileForLiveEdit(Handle<Script> script);
|
||||||
|
|
||||||
// Compile a String source within a context for eval.
|
// Compile a String source within a context for eval.
|
||||||
|
@ -59,17 +59,6 @@ void JSInliner::Inline() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// TODO(sigurds) Find a home for this function and reuse it everywhere (esp. in
|
|
||||||
// test cases, where similar code is currently duplicated).
|
|
||||||
static void Parse(Handle<JSFunction> function, CompilationInfoWithZone* info) {
|
|
||||||
CHECK(Parser::Parse(info));
|
|
||||||
CHECK(Rewriter::Rewrite(info));
|
|
||||||
CHECK(Scope::Analyze(info));
|
|
||||||
CHECK(AstNumbering::Renumber(info->function(), info->zone()));
|
|
||||||
CHECK(Compiler::EnsureDeoptimizationSupport(info));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// A facade on a JSFunction's graph to facilitate inlining. It assumes the
|
// A facade on a JSFunction's graph to facilitate inlining. It assumes the
|
||||||
// that the function graph has only one return statement, and provides
|
// that the function graph has only one return statement, and provides
|
||||||
// {UnifyReturn} to convert a function graph to that end.
|
// {UnifyReturn} to convert a function graph to that end.
|
||||||
@ -385,7 +374,9 @@ void JSInliner::TryInlineJSCall(Node* call_node) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
CompilationInfoWithZone info(function);
|
CompilationInfoWithZone info(function);
|
||||||
Parse(function, &info);
|
// TODO(wingo): ParseAndAnalyze can fail due to stack overflow.
|
||||||
|
CHECK(Compiler::ParseAndAnalyze(&info));
|
||||||
|
CHECK(Compiler::EnsureDeoptimizationSupport(&info));
|
||||||
|
|
||||||
if (info.scope()->arguments() != NULL && info.strict_mode() != STRICT) {
|
if (info.scope()->arguments() != NULL && info.strict_mode() != STRICT) {
|
||||||
// For now do not inline functions that use their arguments array.
|
// For now do not inline functions that use their arguments array.
|
||||||
|
@ -308,11 +308,6 @@ bool FullCodeGenerator::MakeCode(CompilationInfo* info) {
|
|||||||
|
|
||||||
TimerEventScope<TimerEventCompileFullCode> timer(info->isolate());
|
TimerEventScope<TimerEventCompileFullCode> timer(info->isolate());
|
||||||
|
|
||||||
if (!AstNumbering::Renumber(info->function(), info->zone())) {
|
|
||||||
DCHECK(!isolate->has_pending_exception());
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
Handle<Script> script = info->script();
|
Handle<Script> script = info->script();
|
||||||
if (!script->IsUndefined() && !script->source()->IsUndefined()) {
|
if (!script->IsUndefined() && !script->source()->IsUndefined()) {
|
||||||
int len = String::cast(script->source())->length();
|
int len = String::cast(script->source())->length();
|
||||||
|
@ -7845,8 +7845,7 @@ bool HOptimizedGraphBuilder::TryInline(Handle<JSFunction> target,
|
|||||||
// step, but don't transfer ownership to target_info.
|
// step, but don't transfer ownership to target_info.
|
||||||
target_info.SetAstValueFactory(top_info()->ast_value_factory(), false);
|
target_info.SetAstValueFactory(top_info()->ast_value_factory(), false);
|
||||||
Handle<SharedFunctionInfo> target_shared(target->shared());
|
Handle<SharedFunctionInfo> target_shared(target->shared());
|
||||||
if (!Parser::Parse(&target_info) || !Scope::Analyze(&target_info) ||
|
if (!Compiler::ParseAndAnalyze(&target_info)) {
|
||||||
!AstNumbering::Renumber(target_info.function(), target_info.zone())) {
|
|
||||||
if (target_info.isolate()->has_pending_exception()) {
|
if (target_info.isolate()->has_pending_exception()) {
|
||||||
// Parse or scope error, never optimize this function.
|
// Parse or scope error, never optimize this function.
|
||||||
SetStackOverflow();
|
SetStackOverflow();
|
||||||
|
@ -165,9 +165,7 @@ class FunctionTester : public InitializedHandleScope {
|
|||||||
if (flags_ & CompilationInfo::kTypingEnabled) {
|
if (flags_ & CompilationInfo::kTypingEnabled) {
|
||||||
info.MarkAsTypingEnabled();
|
info.MarkAsTypingEnabled();
|
||||||
}
|
}
|
||||||
CHECK(Rewriter::Rewrite(&info));
|
CHECK(Compiler::Analyze(&info));
|
||||||
CHECK(Scope::Analyze(&info));
|
|
||||||
CHECK(AstNumbering::Renumber(info.function(), info.zone()));
|
|
||||||
CHECK(Compiler::EnsureDeoptimizationSupport(&info));
|
CHECK(Compiler::EnsureDeoptimizationSupport(&info));
|
||||||
|
|
||||||
Pipeline pipeline(&info);
|
Pipeline pipeline(&info);
|
||||||
@ -215,9 +213,7 @@ class FunctionTester : public InitializedHandleScope {
|
|||||||
CHECK(Parser::Parse(&info));
|
CHECK(Parser::Parse(&info));
|
||||||
info.SetOptimizing(BailoutId::None(),
|
info.SetOptimizing(BailoutId::None(),
|
||||||
Handle<Code>(function->shared()->code()));
|
Handle<Code>(function->shared()->code()));
|
||||||
CHECK(Rewriter::Rewrite(&info));
|
CHECK(Compiler::Analyze(&info));
|
||||||
CHECK(Scope::Analyze(&info));
|
|
||||||
CHECK(AstNumbering::Renumber(info.function(), info.zone()));
|
|
||||||
CHECK(Compiler::EnsureDeoptimizationSupport(&info));
|
CHECK(Compiler::EnsureDeoptimizationSupport(&info));
|
||||||
|
|
||||||
Pipeline pipeline(&info);
|
Pipeline pipeline(&info);
|
||||||
|
@ -47,9 +47,7 @@ class DeoptCodegenTester {
|
|||||||
bailout_id(-1) {
|
bailout_id(-1) {
|
||||||
CHECK(Parser::Parse(&info));
|
CHECK(Parser::Parse(&info));
|
||||||
info.SetOptimizing(BailoutId::None(), Handle<Code>(function->code()));
|
info.SetOptimizing(BailoutId::None(), Handle<Code>(function->code()));
|
||||||
CHECK(Rewriter::Rewrite(&info));
|
CHECK(Compiler::Analyze(&info));
|
||||||
CHECK(Scope::Analyze(&info));
|
|
||||||
CHECK(AstNumbering::Renumber(info.function(), info.zone()));
|
|
||||||
CHECK(Compiler::EnsureDeoptimizationSupport(&info));
|
CHECK(Compiler::EnsureDeoptimizationSupport(&info));
|
||||||
|
|
||||||
DCHECK(info.shared_info()->has_deoptimization_support());
|
DCHECK(info.shared_info()->has_deoptimization_support());
|
||||||
|
@ -23,11 +23,7 @@ TEST(PipelineAdd) {
|
|||||||
*v8::Handle<v8::Function>::Cast(CompileRun(source)));
|
*v8::Handle<v8::Function>::Cast(CompileRun(source)));
|
||||||
CompilationInfoWithZone info(function);
|
CompilationInfoWithZone info(function);
|
||||||
|
|
||||||
CHECK(Parser::Parse(&info));
|
CHECK(Compiler::ParseAndAnalyze(&info));
|
||||||
CHECK(Rewriter::Rewrite(&info));
|
|
||||||
CHECK(Scope::Analyze(&info));
|
|
||||||
CHECK(AstNumbering::Renumber(info.function(), info.zone()));
|
|
||||||
CHECK_NE(NULL, info.scope());
|
|
||||||
|
|
||||||
Pipeline pipeline(&info);
|
Pipeline pipeline(&info);
|
||||||
#if V8_TURBOFAN_TARGET
|
#if V8_TURBOFAN_TARGET
|
||||||
|
@ -3273,9 +3273,7 @@ TEST(InnerAssignment) {
|
|||||||
i::Parser parser(&info, &parse_info);
|
i::Parser parser(&info, &parse_info);
|
||||||
parser.set_allow_harmony_scoping(true);
|
parser.set_allow_harmony_scoping(true);
|
||||||
CHECK(parser.Parse());
|
CHECK(parser.Parse());
|
||||||
CHECK(i::Rewriter::Rewrite(&info));
|
CHECK(i::Compiler::Analyze(&info));
|
||||||
CHECK(i::Scope::Analyze(&info));
|
|
||||||
CHECK(i::AstNumbering::Renumber(info.function(), info.zone()));
|
|
||||||
CHECK(info.function() != NULL);
|
CHECK(info.function() != NULL);
|
||||||
|
|
||||||
i::Scope* scope = info.function()->scope();
|
i::Scope* scope = info.function()->scope();
|
||||||
|
Loading…
Reference in New Issue
Block a user