Chromium Code Reviews| Index: src/compiler.cc |
| diff --git a/src/compiler.cc b/src/compiler.cc |
| index 284919d5f228e2a92b531eb579b905389bce2355..149a71f1a7f1d47197284bed465c30523038b777 100644 |
| --- a/src/compiler.cc |
| +++ b/src/compiler.cc |
| @@ -141,6 +141,15 @@ void CompilationInfo::Initialize(Isolate* isolate, |
| SetLanguageMode(shared_info_->language_mode()); |
| } |
| set_bailout_reason(kUnknown); |
| + |
| + if (!shared_info().is_null()) { |
| + FixedArray* info_feedback_vector = shared_info()->feedback_vector(); |
| + if (info_feedback_vector->length() > 0) { |
| + // We should initialize the CompilationInfo feedback vector from the |
| + // passed in shared info, rather than creating a new one. |
| + feedback_vector_ = Handle<FixedArray>(info_feedback_vector, isolate); |
| + } |
| + } |
| } |
| @@ -250,6 +259,15 @@ void CompilationInfo::PrepareForCompilation(Scope* scope) { |
| ASSERT(scope_ == NULL); |
| scope_ = scope; |
| function()->ProcessFeedbackSlots(isolate_); |
| + // Allocate the feedback vector too. |
| + ASSERT_EQ(isolate()->heap()->the_hole_value(), |
| + *TypeFeedbackInfo::UninitializedSentinel(isolate())); |
|
Benedikt Meurer
2014/03/05 07:22:56
Nit: indentation
mvstanton
2014/03/05 08:48:02
Done.
|
| + int length = function()->slot_count(); |
| + if (feedback_vector_.is_null()) { |
| + feedback_vector_ = isolate()->factory()->NewFixedArrayWithHoles(length, |
|
Benedikt Meurer
2014/03/05 07:22:56
Nit: put arguments on next line.
mvstanton
2014/03/05 08:48:02
Done.
|
| + TENURED); |
| + } |
| + ASSERT(feedback_vector_->length() == length); |
| } |
| @@ -571,6 +589,8 @@ static void UpdateSharedFunctionInfo(CompilationInfo* info) { |
| shared->ReplaceCode(*code); |
| if (shared->optimization_disabled()) code->set_optimizable(false); |
| + shared->set_feedback_vector(*(info->feedback_vector())); |
|
Benedikt Meurer
2014/03/05 07:22:56
Nit: *info->feedback_vector()
mvstanton
2014/03/05 08:48:02
Done.
|
| + |
| // Set the expected number of properties for instances. |
| FunctionLiteral* lit = info->function(); |
| int expected = lit->expected_property_count(); |
| @@ -826,7 +846,8 @@ static Handle<SharedFunctionInfo> CompileToplevel(CompilationInfo* info) { |
| lit->materialized_literal_count(), |
| lit->is_generator(), |
| info->code(), |
| - ScopeInfo::Create(info->scope(), info->zone())); |
| + ScopeInfo::Create(info->scope(), info->zone()), |
| + info->feedback_vector()); |
| ASSERT_EQ(RelocInfo::kNoPosition, lit->function_token_position()); |
| SetFunctionInfo(result, lit, true, script); |
| @@ -1037,7 +1058,8 @@ Handle<SharedFunctionInfo> Compiler::BuildFunctionInfo(FunctionLiteral* literal, |
| literal->materialized_literal_count(), |
| literal->is_generator(), |
| info.code(), |
| - scope_info); |
| + scope_info, |
| + info.feedback_vector()); |
| SetFunctionInfo(result, literal, false, script); |
| RecordFunctionCompilation(Logger::FUNCTION_TAG, &info, result); |
| result->set_allows_lazy_compilation(allow_lazy); |