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

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

Issue 2472653002: [compiler] Sanitize IC counts for vector based ICs. (Closed)
Patch Set: Fix compile. Created 4 years, 1 month 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/runtime-profiler.cc ('k') | no next file » | 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 da0ecaf0574bb8bd7d27482b550b0d5376515cb7..58dfe33ac7208f429a74730027a3a1206056c211 100644
--- a/src/type-feedback-vector-inl.h
+++ b/src/type-feedback-vector-inl.h
@@ -159,8 +159,6 @@ CompareOperationHint CompareOperationHintFromFeedback(int type_feedback) {
void TypeFeedbackVector::ComputeCounts(int* with_type_info, int* generic,
int* vector_ic_count,
bool code_is_interpreted) {
- Object* uninitialized_sentinel =
- TypeFeedbackVector::RawUninitializedSentinel(GetIsolate());
Object* megamorphic_sentinel =
*TypeFeedbackVector::MegamorphicSentinel(GetIsolate());
int with = 0;
@@ -171,47 +169,58 @@ void TypeFeedbackVector::ComputeCounts(int* with_type_info, int* generic,
FeedbackVectorSlot slot = iter.Next();
FeedbackVectorSlotKind kind = iter.kind();
- Object* obj = Get(slot);
- if (kind == FeedbackVectorSlotKind::GENERAL) {
- continue;
- }
- total++;
-
- if (obj != uninitialized_sentinel) {
- if (kind == FeedbackVectorSlotKind::INTERPRETER_COMPARE_IC ||
- kind == FeedbackVectorSlotKind::INTERPRETER_BINARYOP_IC) {
- // If we are not running interpreted code, we need to ignore
- // the special ic slots for binaryop/compare used by the
- // interpreter.
- // TODO(mvstanton): Remove code_is_interpreted when full code
- // is retired from service.
- if (!code_is_interpreted) continue;
-
- DCHECK(obj->IsSmi());
- int op_feedback = static_cast<int>(Smi::cast(obj)->value());
- if (kind == FeedbackVectorSlotKind::INTERPRETER_COMPARE_IC) {
- CompareOperationHint hint =
- CompareOperationHintFromFeedback(op_feedback);
- if (hint == CompareOperationHint::kAny) {
- gen++;
- } else if (hint != CompareOperationHint::kNone) {
- with++;
- }
- } else {
- DCHECK(kind == FeedbackVectorSlotKind::INTERPRETER_BINARYOP_IC);
- BinaryOperationHint hint =
- BinaryOperationHintFromFeedback(op_feedback);
- if (hint == BinaryOperationHint::kAny) {
- gen++;
- } else if (hint != BinaryOperationHint::kNone) {
- with++;
+ Object* const obj = Get(slot);
+ switch (kind) {
+ case FeedbackVectorSlotKind::CALL_IC:
+ case FeedbackVectorSlotKind::LOAD_IC:
+ case FeedbackVectorSlotKind::LOAD_GLOBAL_IC:
+ case FeedbackVectorSlotKind::KEYED_LOAD_IC:
+ case FeedbackVectorSlotKind::STORE_IC:
+ case FeedbackVectorSlotKind::KEYED_STORE_IC: {
+ if (obj->IsWeakCell() || obj->IsFixedArray() || obj->IsString()) {
+ with++;
+ } else if (obj == megamorphic_sentinel) {
+ gen++;
+ }
+ total++;
+ break;
+ }
+ case FeedbackVectorSlotKind::INTERPRETER_BINARYOP_IC:
+ case FeedbackVectorSlotKind::INTERPRETER_COMPARE_IC: {
+ // If we are not running interpreted code, we need to ignore the special
+ // IC slots for binaryop/compare used by the interpreter.
+ // TODO(mvstanton): Remove code_is_interpreted when full code is retired
+ // from service.
+ if (code_is_interpreted) {
+ int const feedback = Smi::cast(obj)->value();
+ if (kind == FeedbackVectorSlotKind::INTERPRETER_COMPARE_IC) {
+ CompareOperationHint hint =
+ CompareOperationHintFromFeedback(feedback);
+ if (hint == CompareOperationHint::kAny) {
+ gen++;
+ } else if (hint != CompareOperationHint::kNone) {
+ with++;
+ }
+ } else {
+ DCHECK_EQ(FeedbackVectorSlotKind::INTERPRETER_BINARYOP_IC, kind);
+ BinaryOperationHint hint =
+ BinaryOperationHintFromFeedback(feedback);
+ if (hint == BinaryOperationHint::kAny) {
+ gen++;
+ } else if (hint != BinaryOperationHint::kNone) {
+ with++;
+ }
}
+ total++;
}
- } else if (obj->IsWeakCell() || obj->IsFixedArray() || obj->IsString()) {
- with++;
- } else if (obj == megamorphic_sentinel) {
- gen++;
+ break;
}
+ case FeedbackVectorSlotKind::GENERAL:
+ break;
+ case FeedbackVectorSlotKind::INVALID:
+ case FeedbackVectorSlotKind::KINDS_NUMBER:
+ UNREACHABLE();
+ break;
}
}
« no previous file with comments | « src/runtime-profiler.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698