Index: src/objects-inl.h |
diff --git a/src/objects-inl.h b/src/objects-inl.h |
index 376e898ea9c27f4bb78e91590bb27f7a292334bd..ffb786de0c4b8b370c89b3f4f9180cf397a8c6ef 100644 |
--- a/src/objects-inl.h |
+++ b/src/objects-inl.h |
@@ -3494,12 +3494,16 @@ LiteralsArray* LiteralsArray::cast(Object* object) { |
return reinterpret_cast<LiteralsArray*>(object); |
} |
+bool LiteralsArray::needs_feedback_vector() const { |
+ return get(kVectorIndex)->IsUndefined(this->GetIsolate()); |
+} |
TypeFeedbackVector* LiteralsArray::feedback_vector() const { |
- if (length() == 0) { |
+ if (length() == 0 || needs_feedback_vector()) { |
return TypeFeedbackVector::cast( |
- const_cast<FixedArray*>(FixedArray::cast(this))); |
+ this->GetIsolate()->heap()->empty_type_feedback_vector()); |
} |
+ |
return TypeFeedbackVector::cast(get(kVectorIndex)); |
} |
@@ -6626,6 +6630,13 @@ void JSFunction::ReplaceCode(Code* code) { |
} |
} |
+bool JSFunction::needs_literals_array() const { |
+ SharedFunctionInfo* shared = this->shared(); |
+ |
+ return literals() == shared->GetIsolate()->heap()->empty_literals_array() && |
+ (shared->feedback_metadata()->slot_count() > 0 || |
+ shared->num_literals() > 0); |
+} |
Context* JSFunction::context() { |
return Context::cast(READ_FIELD(this, kContextOffset)); |