Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(45)

Unified Diff: src/ast/ast-numbering.cc

Issue 2755973002: [type profile] Collect return types. (Closed)
Patch Set: Clean up. Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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());

Powered by Google App Engine
This is Rietveld 408576698