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

Unified Diff: src/objects-inl.h

Issue 2620753003: [TypeFeedbackVector] Root literal arrays in function literals slots (Closed)
Patch Set: Comments, TODOs. 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
Index: src/objects-inl.h
diff --git a/src/objects-inl.h b/src/objects-inl.h
index b56efe305bf70b6cec639af606a1cc0faaa3df22..593ad108efa256327fe2d1f9aeae9668add1e68c 100644
--- a/src/objects-inl.h
+++ b/src/objects-inl.h
@@ -3514,12 +3514,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));
}
@@ -6647,6 +6651,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));

Powered by Google App Engine
This is Rietveld 408576698