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

Unified Diff: src/compiler.cc

Issue 2631253002: [compiler] Unify EnsureFeedbackMetadata call sites. (Closed)
Patch Set: Remove helper method. Created 3 years, 11 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 | « no previous file | src/interpreter/bytecode-generator.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler.cc
diff --git a/src/compiler.cc b/src/compiler.cc
index bc7c6ecd7467d97e90dc1f5e16c626d936e34aaa..d0e6816d51c96a2a0f5f5ff1f6c8cb8b58b629ff 100644
--- a/src/compiler.cc
+++ b/src/compiler.cc
@@ -292,9 +292,24 @@ void RecordFunctionCompilation(CodeEventListener::LogEventsAndTags tag,
void EnsureFeedbackMetadata(CompilationInfo* info) {
DCHECK(info->has_shared_info());
- TypeFeedbackMetadata::EnsureAllocated(
- info->isolate(), info->shared_info(),
- info->literal()->feedback_vector_spec());
+
+ // If no type feedback metadata exists, create it. At this point the
+ // AstNumbering pass has already run. Note the snapshot can contain outdated
+ // vectors for a different configuration, hence we also recreate a new vector
+ // when the function is not compiled (i.e. no code was serialized).
+
+ // TODO(mvstanton): reintroduce is_empty() predicate to feedback_metadata().
+ if (info->shared_info()->feedback_metadata()->length() == 0 ||
+ !info->shared_info()->is_compiled()) {
+ Handle<TypeFeedbackMetadata> feedback_metadata = TypeFeedbackMetadata::New(
+ info->isolate(), info->literal()->feedback_vector_spec());
+ info->shared_info()->set_feedback_metadata(*feedback_metadata);
+ }
+
+ // 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(
+ info->literal()->feedback_vector_spec()));
}
bool UseTurboFan(Handle<SharedFunctionInfo> shared) {
@@ -367,10 +382,8 @@ CompilationJob* GetUnoptimizedCompilationJob(CompilationInfo* info) {
DCHECK_NOT_NULL(info->scope());
if (ShouldUseIgnition(info)) {
- // The bytecode generator will take care of feedback metadata creation.
return interpreter::Interpreter::NewCompilationJob(info);
} else {
- EnsureFeedbackMetadata(info);
return FullCodeGenerator::NewCompilationJob(info);
}
}
@@ -414,6 +427,7 @@ void InstallUnoptimizedCode(CompilationInfo* info) {
CompilationJob::Status FinalizeUnoptimizedCompilationJob(CompilationJob* job) {
CompilationJob::Status status = job->FinalizeJob();
if (status == CompilationJob::SUCCEEDED) {
+ EnsureFeedbackMetadata(job->info());
InstallUnoptimizedCode(job->info());
job->RecordUnoptimizedCompilationStats();
}
« no previous file with comments | « no previous file | src/interpreter/bytecode-generator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698