| Index: src/ast/ast-numbering.cc
|
| diff --git a/src/ast/ast-numbering.cc b/src/ast/ast-numbering.cc
|
| index 1730308d86af7bab45d4bb1900b3af607ee61398..25ec2dbfe1a84c0fcb10fbd85545cfbf1eb64726 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);
|
| }
|
| @@ -691,6 +701,11 @@ bool AstNumberingVisitor::Renumber(FunctionLiteral* node) {
|
|
|
| LanguageModeScope language_mode_scope(this, node->language_mode());
|
|
|
| + if (collect_type_profile_) {
|
| + type_profile_for_return_value_ =
|
| + properties_.get_spec()->AddTypeProfileSlot();
|
| + }
|
| +
|
| VisitDeclarations(scope->declarations());
|
| VisitStatements(node->body());
|
|
|
|
|