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

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

Issue 2755973002: [type profile] Collect return types. (Closed)
Patch Set: Rebase. 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
« no previous file with comments | « src/ast/ast.h ('k') | src/compiler/bytecode-graph-builder.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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());
« no previous file with comments | « src/ast/ast.h ('k') | src/compiler/bytecode-graph-builder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698