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

Unified Diff: src/type-feedback-vector-inl.h

Issue 1507903004: Type Feedback Vector: Calculate profiler counts on the fly. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Comment response. Created 5 years 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.cc ('k') | src/x64/code-stubs-x64.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/type-feedback-vector-inl.h
diff --git a/src/type-feedback-vector-inl.h b/src/type-feedback-vector-inl.h
index fed28b671e5d3c3555b56fa22f1eae8fdb5fcdf7..97df1b9ae994abac87a7615d865a08bede05192c 100644
--- a/src/type-feedback-vector-inl.h
+++ b/src/type-feedback-vector-inl.h
@@ -81,35 +81,6 @@ FeedbackVectorSlotKind TypeFeedbackVector::GetKind(
}
-int TypeFeedbackVector::ic_with_type_info_count() {
- return length() > 0 ? Smi::cast(get(kWithTypesIndex))->value() : 0;
-}
-
-
-void TypeFeedbackVector::change_ic_with_type_info_count(int delta) {
- if (delta == 0) return;
- int value = ic_with_type_info_count() + delta;
- // Could go negative because of the debugger.
- if (value >= 0) {
- set(kWithTypesIndex, Smi::FromInt(value));
- }
-}
-
-
-int TypeFeedbackVector::ic_generic_count() {
- return length() > 0 ? Smi::cast(get(kGenericCountIndex))->value() : 0;
-}
-
-
-void TypeFeedbackVector::change_ic_generic_count(int delta) {
- if (delta == 0) return;
- int value = ic_generic_count() + delta;
- if (value >= 0) {
- set(kGenericCountIndex, Smi::FromInt(value));
- }
-}
-
-
int TypeFeedbackVector::GetIndex(FeedbackVectorSlot slot) const {
DCHECK(slot.ToInt() < slot_count());
return kReservedIndexCount + slot.ToInt();
@@ -135,6 +106,34 @@ void TypeFeedbackVector::Set(FeedbackVectorSlot slot, Object* value,
}
+void TypeFeedbackVector::ComputeCounts(int* with_type_info, int* generic) {
+ Object* uninitialized_sentinel =
+ TypeFeedbackVector::RawUninitializedSentinel(GetIsolate());
+ Object* megamorphic_sentinel =
+ *TypeFeedbackVector::MegamorphicSentinel(GetIsolate());
+ int with = 0;
+ int gen = 0;
+ TypeFeedbackMetadataIterator iter(metadata());
+ while (iter.HasNext()) {
+ FeedbackVectorSlot slot = iter.Next();
+ FeedbackVectorSlotKind kind = iter.kind();
+
+ Object* obj = Get(slot);
+ if (obj != uninitialized_sentinel &&
+ kind != FeedbackVectorSlotKind::GENERAL) {
+ if (obj->IsWeakCell() || obj->IsFixedArray() || obj->IsString()) {
+ with++;
+ } else if (obj == megamorphic_sentinel) {
+ gen++;
+ }
+ }
+ }
+
+ *with_type_info = with;
+ *generic = gen;
+}
+
+
Handle<Object> TypeFeedbackVector::UninitializedSentinel(Isolate* isolate) {
return isolate->factory()->uninitialized_symbol();
}
« no previous file with comments | « src/type-feedback-vector.cc ('k') | src/x64/code-stubs-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698