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

Unified Diff: src/feedback-vector.cc

Issue 2707873002: Collect type profile for DevTools. (Closed)
Patch Set: Add documentation and sprinkle consts around. Created 3 years, 9 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 5d842763994c75d047839b9423b2d2be298b744d..4b967ba76c71471ab1dd6f3691169ff1a2857cf3 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()) {
@@ -1023,5 +1027,49 @@ void StoreDataPropertyInLiteralICNexus::ConfigureMonomorphic(
SetFeedbackExtra(*name);
}
+InlineCacheState CollectTypeProfileNexus::StateFromFeedback() const {
+ Isolate* isolate = GetIsolate();
+ Object* const feedback = GetFeedback();
+
+ if (feedback == *FeedbackVector::UninitializedSentinel(isolate)) {
+ return UNINITIALIZED;
+ }
+ return MONOMORPHIC;
+}
+
+void CollectTypeProfileNexus::Collect(Handle<Name> type) {
+ Isolate* isolate = GetIsolate();
+
+ Object* const feedback = GetFeedback();
+ Handle<ArrayList> types;
+
+ if (feedback == *FeedbackVector::UninitializedSentinel(isolate)) {
+ types = ArrayList::New(isolate, 1);
+ } else {
+ types = Handle<ArrayList>(ArrayList::cast(feedback), isolate);
+ }
+ // TODO(franzih): Somehow sort this list. Either avoid duplicates
+ // or use the common base type.
+ SetFeedback(*ArrayList::Add(types, type));
Yang 2017/03/09 10:28:27 We could use a StringSet here.
Franzi 2017/03/10 12:14:28 Ok. Didn't know we have those. If it's OK, I'll do
+}
+
+void CollectTypeProfileNexus::Print() const {
+ Isolate* isolate = GetIsolate();
+
+ Object* const feedback = GetFeedback();
+
+ if (feedback == *FeedbackVector::UninitializedSentinel(isolate)) {
+ return;
+ }
+
+ Handle<ArrayList> list;
+ list = Handle<ArrayList>(ArrayList::cast(feedback), isolate);
+
+ for (int i = 0; i < list->Length(); i++) {
+ Name* name = Name::cast(list->Get(i));
+ name->Print();
+ }
+}
+
} // namespace internal
} // namespace v8

Powered by Google App Engine
This is Rietveld 408576698