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

Unified Diff: src/feedback-vector.cc

Issue 2707873002: Collect type profile for DevTools. (Closed)
Patch Set: Explain why throw is needed in message test. 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
« no previous file with comments | « src/feedback-vector.h ('k') | src/feedback-vector-inl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/feedback-vector.cc
diff --git a/src/feedback-vector.cc b/src/feedback-vector.cc
index 5d842763994c75d047839b9423b2d2be298b744d..ef62a634fd55c93b9547869505eec7b44e3def25 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:
@@ -158,6 +160,18 @@ const char* FeedbackMetadata::Kind2String(FeedbackSlotKind kind) {
return "?";
}
+bool FeedbackMetadata::HasTypeProfileSlot() {
+ FeedbackMetadataIterator iter(this);
+ while (iter.HasNext()) {
+ iter.Next();
+ FeedbackSlotKind kind = iter.kind();
+ if (kind == FeedbackSlotKind::kTypeProfile) {
+ return true;
+ }
+ }
+ return false;
+}
+
FeedbackSlotKind FeedbackVector::GetKind(FeedbackSlot slot) const {
DCHECK(!is_empty());
return metadata()->GetKind(slot);
@@ -219,6 +233,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 +351,8 @@ void FeedbackVector::ClearSlots(JSFunction* host_function) {
break;
}
case FeedbackSlotKind::kCreateClosure: {
- break;
+ case FeedbackSlotKind::kTypeProfile:
+ break;
}
case FeedbackSlotKind::kGeneral: {
if (obj->IsHeapObject()) {
@@ -1023,5 +1039,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));
+}
+
+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++) {
+ String* name = String::cast(list->Get(i));
+ PrintF("%s\n", name->ToCString().get());
+ }
+}
+
} // namespace internal
} // namespace v8
« no previous file with comments | « src/feedback-vector.h ('k') | src/feedback-vector-inl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698