Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2016 the V8 project authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "src/ast/collect-eager-literals.h" | |
| 6 | |
| 7 #include "src/ast/ast.h" | |
| 8 #include "src/compilation-info.h" | |
| 9 #include "src/parsing/parse-info.h" | |
| 10 | |
| 11 namespace v8 { | |
| 12 namespace internal { | |
| 13 | |
| 14 CollectEagerLiterals::CollectEagerLiterals(CompilationInfo* info) | |
| 15 : AstTraversalVisitor(info->isolate(), info->parse_info()->literal()), | |
| 16 parse_info_(info->parse_info()) {} | |
| 17 | |
| 18 CollectEagerLiterals::~CollectEagerLiterals() {} | |
| 19 | |
| 20 void CollectEagerLiterals::VisitFunctionDeclaration(FunctionDeclaration* decl) { | |
| 21 i::Variable* variable = decl->proxy()->var(); | |
| 22 DCHECK(variable->mode() == LET || variable->mode() == VAR); | |
| 23 if (variable->location() == VariableLocation::UNALLOCATED) { | |
|
Michael Starzinger
2016/10/17 13:16:03
Why have this special handling here? Any FunctionD
jochen (gone - plz use gerrit)
2016/10/17 13:19:10
VisitFunctionLiteral doesn't visit the declaration
Michael Starzinger
2016/10/17 13:37:48
Not sure I fully understand your response, AstTrav
| |
| 24 if (decl->fun()->ShouldEagerCompile()) { | |
| 25 eager_literals_.insert(decl->fun()); | |
| 26 } else { | |
| 27 return; | |
|
Michael Starzinger
2016/10/17 13:16:03
nit: Why return here? Shouldn't we always fall thr
jochen (gone - plz use gerrit)
2016/10/17 13:19:10
if a function doesn't eager compiler, it might not
Michael Starzinger
2016/10/17 13:37:48
Then this should go into VisitFunctionLiteral belo
| |
| 28 } | |
| 29 } | |
| 30 AstTraversalVisitor::VisitFunctionDeclaration(decl); | |
| 31 } | |
| 32 | |
| 33 void CollectEagerLiterals::VisitFunctionLiteral(FunctionLiteral* fun) { | |
| 34 if (fun->ShouldEagerCompile()) { | |
| 35 if (fun != parse_info_->literal()) { | |
| 36 eager_literals_.insert(fun); | |
| 37 } | |
| 38 AstTraversalVisitor::VisitFunctionLiteral(fun); | |
| 39 } | |
| 40 } | |
| 41 | |
| 42 } // namespace internal | |
| 43 } // namespace v8 | |
| OLD | NEW |