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

Unified Diff: src/compiler.cc

Issue 2707873002: Collect type profile for DevTools. (Closed)
Patch Set: Add documentation and sprinkle consts around. 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/compiler.cc
diff --git a/src/compiler.cc b/src/compiler.cc
index 4e944f7fcda41fdde7cbd60e7f5931be9dfc69bd..86c1f3c0465848ac17871b5aa429fe4918bea1f4 100644
--- a/src/compiler.cc
+++ b/src/compiler.cc
@@ -321,6 +321,16 @@ void EnsureFeedbackMetadata(CompilationInfo* info) {
info->shared_info()->set_feedback_metadata(*feedback_metadata);
}
+ // CollectTypeProfile uses its own feedback slot. The decision
+ // whether we collect type profile or not must match the
+ // feedback metadata.
+ // If we have not decided whether we collect type feedback, we
+ // make a decision based on the FLAG. Otherwise we cannot change it.
+ if (!info->shared_info()->computed_collects_type_profile()) {
Yang 2017/03/09 10:28:27 Michael, here's where I'd like you to take a close
mvstanton 2017/03/10 12:12:24 Yep, it makes sense to avoid these flags and just
Franzi 2017/03/10 14:33:49 I deleted the constants and instead check the Feed
+ info->shared_info()->set_collects_type_profile(FLAG_type_profile);
+ info->shared_info()->set_computed_collects_type_profile(true);
+ }
+
// It's very important that recompiles do not alter the structure of the type
// feedback vector. Verify that the structure fits the function literal.
CHECK(!info->shared_info()->feedback_metadata()->SpecDiffersFrom(
@@ -478,9 +488,25 @@ bool Renumber(ParseInfo* parse_info,
Compiler::EagerInnerFunctionLiterals* eager_literals) {
RuntimeCallTimerScope runtimeTimer(parse_info->isolate(),
&RuntimeCallStats::CompileRenumber);
+
+ // CollectTypeProfile uses its own feedback slot. The decision
+ // whether we collect type profile or not must match the
+ // feedback metadata.
+ // If we parse for the first time or if we have not decided whether we collect
+ // type feedback, we make a decision based on the FLAG. Otherwise we stick
+ // with the previous decision.
+ bool collect_type_profile =
+ (FLAG_type_profile &&
+ (parse_info->shared_info().is_null() ||
+ !parse_info->shared_info()->computed_collects_type_profile())) ||
+ (!parse_info->shared_info().is_null() &&
+ parse_info->shared_info()->computed_collects_type_profile() &&
+ parse_info->shared_info()->collects_type_profile());
Yang 2017/03/09 10:28:27 This expression seems correct. But can we make thi
Franzi 2017/03/10 12:14:28 Thanks for the suggestions. Done.
+
if (!AstNumbering::Renumber(
parse_info->isolate()->stack_guard()->real_climit(),
- parse_info->zone(), parse_info->literal(), eager_literals)) {
+ parse_info->zone(), parse_info->literal(), eager_literals,
+ collect_type_profile)) {
return false;
}
if (!parse_info->shared_info().is_null()) {

Powered by Google App Engine
This is Rietveld 408576698