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

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

Issue 2342853002: [TypeFeedbackVector] special ic slots for interpreter compare/binary ops. (Closed)
Patch Set: Code comments. Created 4 years, 3 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/type-feedback-vector.cc ('k') | src/type-hints.h » ('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 4675c62b8ccaaa6a39fc3a786e269bf318bf0305..b35b07010f50b986f65764041416961554421f95 100644
--- a/src/type-feedback-vector-inl.h
+++ b/src/type-feedback-vector-inl.h
@@ -5,6 +5,7 @@
#ifndef V8_TYPE_FEEDBACK_VECTOR_INL_H_
#define V8_TYPE_FEEDBACK_VECTOR_INL_H_
+#include "src/globals.h"
#include "src/type-feedback-vector.h"
namespace v8 {
@@ -52,7 +53,13 @@ TypeFeedbackVector* TypeFeedbackVector::cast(Object* obj) {
int TypeFeedbackMetadata::GetSlotSize(FeedbackVectorSlotKind kind) {
DCHECK_NE(FeedbackVectorSlotKind::INVALID, kind);
DCHECK_NE(FeedbackVectorSlotKind::KINDS_NUMBER, kind);
- return kind == FeedbackVectorSlotKind::GENERAL ? 1 : 2;
+ if (kind == FeedbackVectorSlotKind::GENERAL ||
+ kind == FeedbackVectorSlotKind::INTERPRETER_BINARYOP_IC ||
+ kind == FeedbackVectorSlotKind::INTERPRETER_COMPARE_IC) {
+ return 1;
+ }
+
+ return 2;
}
bool TypeFeedbackMetadata::SlotRequiresName(FeedbackVectorSlotKind kind) {
@@ -65,6 +72,8 @@ bool TypeFeedbackMetadata::SlotRequiresName(FeedbackVectorSlotKind kind) {
case FeedbackVectorSlotKind::KEYED_LOAD_IC:
case FeedbackVectorSlotKind::STORE_IC:
case FeedbackVectorSlotKind::KEYED_STORE_IC:
+ case FeedbackVectorSlotKind::INTERPRETER_BINARYOP_IC:
+ case FeedbackVectorSlotKind::INTERPRETER_COMPARE_IC:
case FeedbackVectorSlotKind::GENERAL:
case FeedbackVectorSlotKind::INVALID:
return false;
@@ -111,8 +120,35 @@ void TypeFeedbackVector::Set(FeedbackVectorSlot slot, Object* value,
set(GetIndex(slot), value, mode);
}
+// Helper function to transform the feedback to BinaryOperationHint.
+BinaryOperationHint BinaryOperationHintFromFeedback(int type_feedback) {
+ switch (type_feedback) {
+ case BinaryOperationFeedback::kSignedSmall:
+ return BinaryOperationHint::kSignedSmall;
+ case BinaryOperationFeedback::kNumber:
+ return BinaryOperationHint::kNumberOrOddball;
+ case BinaryOperationFeedback::kAny:
+ default:
+ return BinaryOperationHint::kAny;
+ }
+ UNREACHABLE();
+ return BinaryOperationHint::kNone;
+}
+
+// Helper function to transform the feedback to CompareOperationHint.
+CompareOperationHint CompareOperationHintFromFeedback(int type_feedback) {
+ switch (type_feedback) {
+ case CompareOperationFeedback::kSignedSmall:
+ return CompareOperationHint::kSignedSmall;
+ case CompareOperationFeedback::kNumber:
+ return CompareOperationHint::kNumber;
+ default:
+ return CompareOperationHint::kAny;
+ }
+}
-void TypeFeedbackVector::ComputeCounts(int* with_type_info, int* generic) {
+void TypeFeedbackVector::ComputeCounts(int* with_type_info, int* generic,
+ bool code_is_interpreted) {
Object* uninitialized_sentinel =
TypeFeedbackVector::RawUninitializedSentinel(GetIsolate());
Object* megamorphic_sentinel =
@@ -127,7 +163,36 @@ void TypeFeedbackVector::ComputeCounts(int* with_type_info, int* generic) {
Object* obj = Get(slot);
if (obj != uninitialized_sentinel &&
kind != FeedbackVectorSlotKind::GENERAL) {
- if (obj->IsWeakCell() || obj->IsFixedArray() || obj->IsString()) {
+ 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;
Benedikt Meurer 2016/09/20 17:15:00 Ops, this is missing an exclamation mark.
+
+ 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++;
+ }
+ }
+ } else if (obj->IsWeakCell() || obj->IsFixedArray() || obj->IsString()) {
with++;
} else if (obj == megamorphic_sentinel) {
gen++;
« no previous file with comments | « src/type-feedback-vector.cc ('k') | src/type-hints.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698