| 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();
|
| }
|
|
|