Chromium Code Reviews| Index: src/ast/ast-numbering.cc |
| diff --git a/src/ast/ast-numbering.cc b/src/ast/ast-numbering.cc |
| index 1730308d86af7bab45d4bb1900b3af607ee61398..1c6b9c3636a10183948e3212f3e9c49defc6f3ed 100644 |
| --- a/src/ast/ast-numbering.cc |
| +++ b/src/ast/ast-numbering.cc |
| @@ -33,6 +33,13 @@ class AstNumberingVisitor final : public AstVisitor<AstNumberingVisitor> { |
| bool Renumber(FunctionLiteral* node); |
| + FeedbackSlot TypeProfileSlotForReturnValue() const { |
| + if (collect_type_profile_) { |
| + DCHECK(!type_profile_for_return_value_.IsInvalid()); |
| + } |
| + return type_profile_for_return_value_; |
| + } |
| + |
| private: |
| // AST node visitor interface. |
| #define DEFINE_VISIT(type) void Visit##type(type* node); |
| @@ -104,6 +111,7 @@ class AstNumberingVisitor final : public AstVisitor<AstNumberingVisitor> { |
| BailoutReason dont_optimize_reason_; |
| HandlerTable::CatchPrediction catch_prediction_; |
| bool collect_type_profile_; |
| + FeedbackSlot type_profile_for_return_value_; |
| DEFINE_AST_VISITOR_SUBCLASS_MEMBERS(); |
| DISALLOW_COPY_AND_ASSIGN(AstNumberingVisitor); |
| @@ -237,6 +245,8 @@ void AstNumberingVisitor::VisitReturnStatement(ReturnStatement* node) { |
| IncrementNodeCount(); |
| Visit(node->expression()); |
| + node->SetTypeProfileSlot(TypeProfileSlotForReturnValue()); |
| + |
| DCHECK(!node->is_async_return() || |
| properties_.flags() & AstProperties::kMustUseIgnitionTurbo); |
| } |
| @@ -664,6 +674,11 @@ void AstNumberingVisitor::VisitRewritableExpression( |
| bool AstNumberingVisitor::Renumber(FunctionLiteral* node) { |
| + if (collect_type_profile_) { |
| + type_profile_for_return_value_ = |
|
Michael Starzinger
2017/03/20 09:29:26
nit: Please move this down to after the global com
Franzi
2017/03/20 15:38:39
Done.
|
| + properties_.get_spec()->AddTypeProfileSlot(); |
| + } |
| + |
| DeclarationScope* scope = node->scope(); |
| DCHECK(!scope->HasBeenRemoved()); |