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

Unified Diff: src/type-feedback-vector.cc

Issue 1906823002: Move of the type feedback vector to the closure. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: REBASE. Created 4 years, 7 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 | « src/type-feedback-vector.h ('k') | src/type-feedback-vector-inl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/type-feedback-vector.cc
diff --git a/src/type-feedback-vector.cc b/src/type-feedback-vector.cc
index 4519bd65c2c2d79ae6989049d7f1d70070577f07..752e6d262e06363fadd190af4beefa0442175160 100644
--- a/src/type-feedback-vector.cc
+++ b/src/type-feedback-vector.cc
@@ -88,6 +88,14 @@ Handle<TypeFeedbackMetadata> TypeFeedbackMetadata::New(Isolate* isolate,
for (int i = 0; i < slot_count; i++) {
metadata->SetKind(FeedbackVectorSlot(i), spec->GetKind(i));
}
+
+ // It's important that the TypeFeedbackMetadata have a COW map, since it's
+ // pointed to by both a SharedFunctionInfo and indirectly by closures through
+ // the TypeFeedbackVector. The serializer uses the COW map type to decide
+ // this object belongs in the startup snapshot and not the partial
+ // snapshot(s).
+ metadata->set_map(isolate->heap()->fixed_cow_array_map());
+
return metadata;
}
@@ -107,6 +115,21 @@ bool TypeFeedbackMetadata::SpecDiffersFrom(
return false;
}
+bool TypeFeedbackMetadata::DiffersFrom(
+ const TypeFeedbackMetadata* other_metadata) const {
+ if (other_metadata->slot_count() != slot_count()) {
+ return true;
+ }
+
+ int slots = slot_count();
+ for (int i = 0; i < slots; i++) {
+ FeedbackVectorSlot slot(i);
+ if (GetKind(slot) != other_metadata->GetKind(slot)) {
+ return true;
+ }
+ }
+ return false;
+}
const char* TypeFeedbackMetadata::Kind2String(FeedbackVectorSlotKind kind) {
switch (kind) {
@@ -251,8 +274,20 @@ void TypeFeedbackVector::ClearAllKeyedStoreICs(Isolate* isolate) {
SharedFunctionInfo::Iterator iterator(isolate);
SharedFunctionInfo* shared;
while ((shared = iterator.Next())) {
- TypeFeedbackVector* vector = shared->feedback_vector();
- vector->ClearKeyedStoreICs(shared);
+ if (!shared->OptimizedCodeMapIsCleared()) {
+ FixedArray* optimized_code_map = shared->optimized_code_map();
+ int length = optimized_code_map->length();
+ for (int i = SharedFunctionInfo::kEntriesStart; i < length;
+ i += SharedFunctionInfo::kEntryLength) {
+ WeakCell* cell = WeakCell::cast(
+ optimized_code_map->get(i + SharedFunctionInfo::kLiteralsOffset));
+ if (cell->value()->IsLiteralsArray()) {
+ TypeFeedbackVector* vector =
+ LiteralsArray::cast(cell->value())->feedback_vector();
+ vector->ClearKeyedStoreICs(shared);
+ }
+ }
+ }
}
}
« no previous file with comments | « src/type-feedback-vector.h ('k') | src/type-feedback-vector-inl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698