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

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

Issue 1563213002: Type Feedback Vector lives in the closure (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Exclude an ignition test. Created 4 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
« 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 698f2a6d17380d6e0771c5194e2259819b864542..28b5830b5a9f482831c9238d04ae531ec0be16b5 100644
--- a/src/type-feedback-vector.cc
+++ b/src/type-feedback-vector.cc
@@ -83,6 +83,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;
}
@@ -102,6 +110,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) {
@@ -246,15 +269,26 @@ 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);
+ }
+ }
+ }
}
}
void TypeFeedbackVector::ClearKeyedStoreICs(SharedFunctionInfo* shared) {
Isolate* isolate = GetIsolate();
-
Code* host = shared->code();
Object* uninitialized_sentinel =
TypeFeedbackVector::RawUninitializedSentinel(isolate);
« 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