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

Unified Diff: src/feedback-vector.cc

Issue 2707873002: Collect type profile for DevTools. (Closed)
Patch Set: Use constructor name if available. Created 3 years, 10 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/feedback-vector.cc
diff --git a/src/feedback-vector.cc b/src/feedback-vector.cc
index 4003068e9b5960e7af1b332c2b926abd9b5c68ba..87713d190ec71bce6101e5be07562705272c64e9 100644
--- a/src/feedback-vector.cc
+++ b/src/feedback-vector.cc
@@ -149,6 +149,8 @@ const char* FeedbackMetadata::Kind2String(FeedbackSlotKind kind) {
return "kCreateClosure";
case FeedbackSlotKind::kLiteral:
return "LITERAL";
+ case FeedbackSlotKind::kTypeProfile:
+ return "TYPE_PROFILE";
case FeedbackSlotKind::kGeneral:
return "STUB";
case FeedbackSlotKind::kKindsNumber:
@@ -219,6 +221,7 @@ Handle<FeedbackVector> FeedbackVector::New(Isolate* isolate,
case FeedbackSlotKind::kStoreKeyedStrict:
case FeedbackSlotKind::kStoreDataPropertyInLiteral:
case FeedbackSlotKind::kGeneral:
+ case FeedbackSlotKind::kTypeProfile:
array->set(index, *uninitialized_sentinel, SKIP_WRITE_BARRIER);
break;
@@ -336,7 +339,8 @@ void FeedbackVector::ClearSlots(JSFunction* host_function) {
break;
}
case FeedbackSlotKind::kCreateClosure: {
- break;
+ case FeedbackSlotKind::kTypeProfile:
+ break;
}
case FeedbackSlotKind::kGeneral: {
if (obj->IsHeapObject()) {
@@ -1019,5 +1023,50 @@ void StoreDataPropertyInLiteralICNexus::ConfigureMonomorphic(
SetFeedbackExtra(*name);
}
+InlineCacheState CollectTypeProfileICNexus::StateFromFeedback() const {
+ Isolate* isolate = GetIsolate();
+ Object* feedback = GetFeedback();
+
+ if (feedback == *FeedbackVector::UninitializedSentinel(isolate)) {
+ return UNINITIALIZED;
+ } else if (feedback == *FeedbackVector::MegamorphicSentinel(isolate)) {
+ return MEGAMORPHIC;
+ } else if (feedback->IsName()) {
+ // Don't check if the map is cleared.
+ return MONOMORPHIC;
+ }
+
+ DCHECK(feedback->IsArrayList());
+ return POLYMORPHIC;
+}
+
+void CollectTypeProfileICNexus::ConfigureMonomorphic(Handle<Name> type) {
+ SetFeedback(*type);
+}
+
+void CollectTypeProfileICNexus::ConfigurePolymorphic(Handle<Name> type) {
+ Isolate* isolate = GetIsolate();
+
+ Object* known_types = GetFeedback();
+ Handle<ArrayList> types;
+ if (known_types->IsName()) {
+ types = ArrayList::New(isolate, kMaxKeyedPolymorphism);
+ ArrayList::Add(types, Handle<Name>(Name::cast(known_types), isolate));
+ ArrayList::Add(types, type);
+ } else {
+ // This should create the union, not a list with double entries.
+ DCHECK(known_types->IsArrayList());
+ types = Handle<ArrayList>(ArrayList::cast(known_types), isolate);
+ ArrayList::Add(types, type);
+
+ // We've reached an arbitrary number of too many different types.
+ if (types->Length() > kMaxKeyedPolymorphism) {
+ SetFeedback(*FeedbackVector::MegamorphicSentinel(isolate));
+ return;
+ }
+ }
+ SetFeedback(*types);
+}
+
} // namespace internal
} // namespace v8
« no previous file with comments | « src/feedback-vector.h ('k') | src/feedback-vector-inl.h » ('j') | src/feedback-vector-inl.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698