}
-static Code::Kind GetStoreICKind(Expression* expr) {
+static FeedbackVectorSlotKind GetStoreICKind(Expression* expr) {
LhsKind assign_type = Property::GetAssignType(expr->AsProperty());
- return assign_type == KEYED_PROPERTY ? Code::KEYED_STORE_IC : Code::STORE_IC;
+ return assign_type == KEYED_PROPERTY ? FeedbackVectorSlotKind::KEYED_STORE_IC
+ : FeedbackVectorSlotKind::STORE_IC;
}
}
-Code::Kind ForEachStatement::FeedbackICSlotKind(int index) {
+FeedbackVectorSlotKind ForEachStatement::FeedbackICSlotKind(int index) {
return GetStoreICKind(each());
}
}
-Code::Kind Assignment::FeedbackICSlotKind(int index) {
+FeedbackVectorSlotKind Assignment::FeedbackICSlotKind(int index) {
return GetStoreICKind(target());
}
}
-Code::Kind CountOperation::FeedbackICSlotKind(int index) {
+FeedbackVectorSlotKind CountOperation::FeedbackICSlotKind(int index) {
return GetStoreICKind(expression());
}
int ic_slots() const { return spec_.ic_slots(); }
void increase_ic_slots(int count) { spec_.increase_ic_slots(count); }
- void SetKind(int ic_slot, Code::Kind kind) { spec_.SetKind(ic_slot, kind); }
+ void SetKind(int ic_slot, FeedbackVectorSlotKind kind) {
+ spec_.SetKind(ic_slot, kind);
+ }
const ZoneFeedbackVectorSpec* get_spec() const { return &spec_; }
private:
UNREACHABLE();
}
// Each ICSlot stores a kind of IC which the participating node should know.
- virtual Code::Kind FeedbackICSlotKind(int index) {
+ virtual FeedbackVectorSlotKind FeedbackICSlotKind(int index) {
UNREACHABLE();
- return Code::NUMBER_OF_KINDS;
+ return FeedbackVectorSlotKind::UNUSED;
}
private:
ICSlotCache* cache) override {
each_slot_ = slot;
}
- Code::Kind FeedbackICSlotKind(int index) override;
+ FeedbackVectorSlotKind FeedbackICSlotKind(int index) override;
FeedbackVectorICSlot EachFeedbackSlot() const { return each_slot_; }
protected:
ICSlotCache* cache) override {
slot_ = slot;
}
- Code::Kind FeedbackICSlotKind(int index) override { return Code::STORE_IC; }
+ FeedbackVectorSlotKind FeedbackICSlotKind(int index) override {
+ return FeedbackVectorSlotKind::STORE_IC;
+ }
// After feedback slots were assigned, propagate information to the properties
// which need it.
void SetFirstFeedbackICSlot(FeedbackVectorICSlot slot,
ICSlotCache* cache) override;
- Code::Kind FeedbackICSlotKind(int index) override { return Code::LOAD_IC; }
+ FeedbackVectorSlotKind FeedbackICSlotKind(int index) override {
+ return FeedbackVectorSlotKind::LOAD_IC;
+ }
FeedbackVectorICSlot VariableFeedbackSlot() {
return variable_feedback_slot_;
}
ICSlotCache* cache) override {
property_feedback_slot_ = slot;
}
- Code::Kind FeedbackICSlotKind(int index) override {
- return key()->IsPropertyName() ? Code::LOAD_IC : Code::KEYED_LOAD_IC;
+ FeedbackVectorSlotKind FeedbackICSlotKind(int index) override {
+ return key()->IsPropertyName() ? FeedbackVectorSlotKind::LOAD_IC
+ : FeedbackVectorSlotKind::KEYED_LOAD_IC;
}
FeedbackVectorICSlot PropertyFeedbackSlot() const {
ic_slot_ = slot;
}
void SetFirstFeedbackSlot(FeedbackVectorSlot slot) override { slot_ = slot; }
- Code::Kind FeedbackICSlotKind(int index) override { return Code::CALL_IC; }
+ FeedbackVectorSlotKind FeedbackICSlotKind(int index) override {
+ return FeedbackVectorSlotKind::CALL_IC;
+ }
FeedbackVectorSlot CallFeedbackSlot() const { return slot_; }
ICSlotCache* cache) override {
slot_ = slot;
}
- Code::Kind FeedbackICSlotKind(int index) override;
+ FeedbackVectorSlotKind FeedbackICSlotKind(int index) override;
FeedbackVectorICSlot CountSlot() const { return slot_; }
protected:
ICSlotCache* cache) override {
slot_ = slot;
}
- Code::Kind FeedbackICSlotKind(int index) override;
+ FeedbackVectorSlotKind FeedbackICSlotKind(int index) override;
FeedbackVectorICSlot AssignmentSlot() const { return slot_; }
protected:
ICSlotCache* cache) override {
yield_first_feedback_slot_ = slot;
}
- Code::Kind FeedbackICSlotKind(int index) override {
- return index == 0 ? Code::KEYED_LOAD_IC : Code::LOAD_IC;
+ FeedbackVectorSlotKind FeedbackICSlotKind(int index) override {
+ return index == 0 ? FeedbackVectorSlotKind::KEYED_LOAD_IC
+ : FeedbackVectorSlotKind::LOAD_IC;
}
FeedbackVectorICSlot KeyedLoadFeedbackSlot() {
ICSlotCache* cache) override {
slot_ = slot;
}
- Code::Kind FeedbackICSlotKind(int index) override { return Code::STORE_IC; }
+ FeedbackVectorSlotKind FeedbackICSlotKind(int index) override {
+ return FeedbackVectorSlotKind::STORE_IC;
+ }
bool NeedsProxySlot() const {
return FLAG_vector_stores && scope() != NULL &&
set_microtask_queue(empty_fixed_array());
{
- Code::Kind kinds[] = {Code::LOAD_IC, Code::KEYED_LOAD_IC, Code::STORE_IC,
- Code::KEYED_STORE_IC};
+ FeedbackVectorSlotKind kinds[] = {FeedbackVectorSlotKind::LOAD_IC,
+ FeedbackVectorSlotKind::KEYED_LOAD_IC,
+ FeedbackVectorSlotKind::STORE_IC,
+ FeedbackVectorSlotKind::KEYED_STORE_IC};
FeedbackVectorSpec spec(0, 4, kinds);
Handle<TypeFeedbackVector> dummy_vector =
factory->NewTypeFeedbackVector(&spec);
return result;
} else {
if (FLAG_vector_stores &&
- current_feedback_vector()->GetKind(slot) == Code::KEYED_STORE_IC) {
+ current_feedback_vector()->GetKind(slot) ==
+ FeedbackVectorSlotKind::KEYED_STORE_IC) {
// It's possible that a keyed store of a constant string was converted
// to a named store. Here, at the last minute, we need to make sure to
// use a generic Keyed Store if we are using the type vector, because
// A monomorphic or polymorphic KeyedLoadIC with a string key can call the
// LoadIC miss handler if the handler misses. Since the vector Nexus is
// set up outside the IC, handle that here.
- if (vector->GetKind(vector_slot) == Code::LOAD_IC) {
+ if (vector->GetKind(vector_slot) == FeedbackVectorSlotKind::LOAD_IC) {
LoadICNexus nexus(vector, vector_slot);
LoadIC ic(IC::NO_EXTRA_FRAME, isolate, &nexus);
ic.UpdateState(receiver, key);
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, result, ic.Load(receiver, key));
} else {
- DCHECK(vector->GetKind(vector_slot) == Code::KEYED_LOAD_IC);
+ DCHECK_EQ(FeedbackVectorSlotKind::KEYED_LOAD_IC,
+ vector->GetKind(vector_slot));
KeyedLoadICNexus nexus(vector, vector_slot);
KeyedLoadIC ic(IC::NO_EXTRA_FRAME, isolate, &nexus);
ic.UpdateState(receiver, key);
Handle<Smi> slot = args.at<Smi>(3);
Handle<TypeFeedbackVector> vector = args.at<TypeFeedbackVector>(4);
FeedbackVectorICSlot vector_slot = vector->ToICSlot(slot->value());
- if (vector->GetKind(vector_slot) == Code::STORE_IC) {
+ if (vector->GetKind(vector_slot) == FeedbackVectorSlotKind::STORE_IC) {
StoreICNexus nexus(vector, vector_slot);
StoreIC ic(IC::NO_EXTRA_FRAME, isolate, &nexus);
ic.UpdateState(receiver, key);
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, result,
ic.Store(receiver, key, value));
} else {
- DCHECK(vector->GetKind(vector_slot) == Code::KEYED_STORE_IC);
+ DCHECK_EQ(FeedbackVectorSlotKind::KEYED_STORE_IC,
+ vector->GetKind(vector_slot));
KeyedStoreICNexus nexus(vector, vector_slot);
KeyedStoreIC ic(IC::NO_EXTRA_FRAME, isolate, &nexus);
ic.UpdateState(receiver, key);
Handle<Smi> slot = args.at<Smi>(3);
Handle<TypeFeedbackVector> vector = args.at<TypeFeedbackVector>(4);
FeedbackVectorICSlot vector_slot = vector->ToICSlot(slot->value());
- if (vector->GetKind(vector_slot) == Code::STORE_IC) {
+ if (vector->GetKind(vector_slot) == FeedbackVectorSlotKind::STORE_IC) {
StoreICNexus nexus(vector, vector_slot);
StoreIC ic(IC::EXTRA_CALL_FRAME, isolate, &nexus);
ic.UpdateState(receiver, key);
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, result,
ic.Store(receiver, key, value));
} else {
- DCHECK(vector->GetKind(vector_slot) == Code::KEYED_STORE_IC);
+ DCHECK_EQ(FeedbackVectorSlotKind::KEYED_STORE_IC,
+ vector->GetKind(vector_slot));
KeyedStoreICNexus nexus(vector, vector_slot);
KeyedStoreIC ic(IC::EXTRA_CALL_FRAME, isolate, &nexus);
ic.UpdateState(receiver, key);
// A monomorphic or polymorphic KeyedLoadIC with a string key can call the
// LoadIC miss handler if the handler misses. Since the vector Nexus is
// set up outside the IC, handle that here.
- if (vector->GetKind(vector_slot) == Code::LOAD_IC) {
+ if (vector->GetKind(vector_slot) == FeedbackVectorSlotKind::LOAD_IC) {
LoadICNexus nexus(vector, vector_slot);
LoadIC ic(IC::EXTRA_CALL_FRAME, isolate, &nexus);
ic.UpdateState(receiver, key);
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, result, ic.Load(receiver, key));
} else {
- DCHECK(vector->GetKind(vector_slot) == Code::KEYED_LOAD_IC);
+ DCHECK_EQ(FeedbackVectorSlotKind::KEYED_LOAD_IC,
+ vector->GetKind(vector_slot));
KeyedLoadICNexus nexus(vector, vector_slot);
KeyedLoadIC ic(IC::EXTRA_CALL_FRAME, isolate, &nexus);
ic.UpdateState(receiver, key);
for (int i = 0; i < ICSlots(); i++) {
FeedbackVectorICSlot slot(i);
- Code::Kind kind = GetKind(slot);
- os << "\n ICSlot " << i;
- if (kind == Code::LOAD_IC) {
- LoadICNexus nexus(this, slot);
- os << " LOAD_IC " << Code::ICState2String(nexus.StateFromFeedback());
- } else if (kind == Code::KEYED_LOAD_IC) {
- KeyedLoadICNexus nexus(this, slot);
- os << " KEYED_LOAD_IC "
- << Code::ICState2String(nexus.StateFromFeedback());
- } else if (kind == Code::CALL_IC) {
- CallICNexus nexus(this, slot);
- os << " CALL_IC " << Code::ICState2String(nexus.StateFromFeedback());
- } else if (kind == Code::STORE_IC) {
- StoreICNexus nexus(this, slot);
- os << " STORE_IC " << Code::ICState2String(nexus.StateFromFeedback());
- } else {
- DCHECK(kind == Code::KEYED_STORE_IC);
- KeyedStoreICNexus nexus(this, slot);
- os << " KEYED_STORE_IC "
- << Code::ICState2String(nexus.StateFromFeedback());
+ FeedbackVectorSlotKind kind = GetKind(slot);
+ os << "\n ICSlot " << i << " " << kind << " ";
+ switch (kind) {
+ case FeedbackVectorSlotKind::LOAD_IC: {
+ LoadICNexus nexus(this, slot);
+ os << Code::ICState2String(nexus.StateFromFeedback());
+ break;
+ }
+ case FeedbackVectorSlotKind::KEYED_LOAD_IC: {
+ KeyedLoadICNexus nexus(this, slot);
+ os << Code::ICState2String(nexus.StateFromFeedback());
+ break;
+ }
+ case FeedbackVectorSlotKind::CALL_IC: {
+ CallICNexus nexus(this, slot);
+ os << Code::ICState2String(nexus.StateFromFeedback());
+ break;
+ }
+ case FeedbackVectorSlotKind::STORE_IC: {
+ StoreICNexus nexus(this, slot);
+ os << Code::ICState2String(nexus.StateFromFeedback());
+ break;
+ }
+ case FeedbackVectorSlotKind::KEYED_STORE_IC: {
+ KeyedStoreICNexus nexus(this, slot);
+ os << Code::ICState2String(nexus.StateFromFeedback());
+ break;
+ }
+ case FeedbackVectorSlotKind::UNUSED:
+ case FeedbackVectorSlotKind::KINDS_NUMBER:
+ UNREACHABLE();
+ break;
}
os << "\n [" << GetIndex(slot) << "]: " << Brief(Get(slot));
const char* node_name, FeedbackVectorICSlot slot) {
int pos = SNPrintF(*buf, "%s", node_name);
if (!slot.IsInvalid()) {
- const char* str = Code::Kind2String(node->FeedbackICSlotKind(0));
+ const char* str =
+ TypeFeedbackVector::Kind2String(node->FeedbackICSlotKind(0));
pos = SNPrintF(*buf + pos, " ICSlot(%d, %s)", slot.ToInt(), str);
}
return pos;
namespace v8 {
namespace internal {
-// static
-TypeFeedbackVector::VectorICKind TypeFeedbackVector::FromCodeKind(
- Code::Kind kind) {
- switch (kind) {
- case Code::CALL_IC:
- return KindCallIC;
- case Code::LOAD_IC:
- return KindLoadIC;
- case Code::KEYED_LOAD_IC:
- return KindKeyedLoadIC;
- case Code::STORE_IC:
- return KindStoreIC;
- case Code::KEYED_STORE_IC:
- return KindKeyedStoreIC;
- default:
- // Shouldn't get here.
- UNREACHABLE();
- }
-
- return KindUnused;
+std::ostream& operator<<(std::ostream& os, FeedbackVectorSlotKind kind) {
+ return os << TypeFeedbackVector::Kind2String(kind);
}
-// static
-Code::Kind TypeFeedbackVector::FromVectorICKind(VectorICKind kind) {
- switch (kind) {
- case KindCallIC:
- return Code::CALL_IC;
- case KindLoadIC:
- return Code::LOAD_IC;
- case KindKeyedLoadIC:
- return Code::KEYED_LOAD_IC;
- case KindStoreIC:
- DCHECK(FLAG_vector_stores);
- return Code::STORE_IC;
- case KindKeyedStoreIC:
- DCHECK(FLAG_vector_stores);
- return Code::KEYED_STORE_IC;
- case KindUnused:
- break;
- }
- // Sentinel for no information.
- return Code::NUMBER_OF_KINDS;
-}
-
-
-Code::Kind TypeFeedbackVector::GetKind(FeedbackVectorICSlot slot) const {
+FeedbackVectorSlotKind TypeFeedbackVector::GetKind(
+ FeedbackVectorICSlot slot) const {
int index = VectorICComputer::index(kReservedIndexCount, slot.ToInt());
int data = Smi::cast(get(index))->value();
- VectorICKind b = VectorICComputer::decode(data, slot.ToInt());
- return FromVectorICKind(b);
+ return VectorICComputer::decode(data, slot.ToInt());
}
-void TypeFeedbackVector::SetKind(FeedbackVectorICSlot slot, Code::Kind kind) {
- VectorICKind b = FromCodeKind(kind);
+void TypeFeedbackVector::SetKind(FeedbackVectorICSlot slot,
+ FeedbackVectorSlotKind kind) {
int index = VectorICComputer::index(kReservedIndexCount, slot.ToInt());
int data = Smi::cast(get(index))->value();
- int new_data = VectorICComputer::encode(data, slot.ToInt(), b);
+ int new_data = VectorICComputer::encode(data, slot.ToInt(), kind);
set(index, Smi::FromInt(new_data));
}
// static
Handle<TypeFeedbackVector> TypeFeedbackVector::CreatePushAppliedArgumentsVector(
Isolate* isolate) {
- Code::Kind kinds[] = {Code::KEYED_LOAD_IC};
+ FeedbackVectorSlotKind kinds[] = {FeedbackVectorSlotKind::KEYED_LOAD_IC};
FeedbackVectorSpec spec(0, 1, kinds);
Handle<TypeFeedbackVector> feedback_vector =
isolate->factory()->NewTypeFeedbackVector(&spec);
FeedbackVectorICSlot slot(i);
Object* obj = Get(slot);
if (obj != uninitialized_sentinel) {
- Code::Kind kind = GetKind(slot);
- if (kind == Code::CALL_IC) {
- CallICNexus nexus(this, slot);
- nexus.Clear(host);
- } else if (kind == Code::LOAD_IC) {
- LoadICNexus nexus(this, slot);
- nexus.Clear(host);
- } else if (kind == Code::KEYED_LOAD_IC) {
- KeyedLoadICNexus nexus(this, slot);
- nexus.Clear(host);
- } else if (kind == Code::STORE_IC) {
- DCHECK(FLAG_vector_stores);
- StoreICNexus nexus(this, slot);
- nexus.Clear(host);
- } else if (kind == Code::KEYED_STORE_IC) {
- DCHECK(FLAG_vector_stores);
- KeyedStoreICNexus nexus(this, slot);
- nexus.Clear(host);
+ FeedbackVectorSlotKind kind = GetKind(slot);
+ switch (kind) {
+ case FeedbackVectorSlotKind::CALL_IC: {
+ CallICNexus nexus(this, slot);
+ nexus.Clear(host);
+ break;
+ }
+ case FeedbackVectorSlotKind::LOAD_IC: {
+ LoadICNexus nexus(this, slot);
+ nexus.Clear(host);
+ break;
+ }
+ case FeedbackVectorSlotKind::KEYED_LOAD_IC: {
+ KeyedLoadICNexus nexus(this, slot);
+ nexus.Clear(host);
+ break;
+ }
+ case FeedbackVectorSlotKind::STORE_IC: {
+ DCHECK(FLAG_vector_stores);
+ StoreICNexus nexus(this, slot);
+ nexus.Clear(host);
+ break;
+ }
+ case FeedbackVectorSlotKind::KEYED_STORE_IC: {
+ DCHECK(FLAG_vector_stores);
+ KeyedStoreICNexus nexus(this, slot);
+ nexus.Clear(host);
+ break;
+ }
+ case FeedbackVectorSlotKind::UNUSED:
+ case FeedbackVectorSlotKind::KINDS_NUMBER:
+ UNREACHABLE();
+ break;
}
}
}
FeedbackVectorICSlot slot(i);
Object* obj = Get(slot);
if (obj != uninitialized_sentinel) {
- Code::Kind kind = GetKind(slot);
- if (kind == Code::KEYED_STORE_IC) {
+ FeedbackVectorSlotKind kind = GetKind(slot);
+ if (kind == FeedbackVectorSlotKind::KEYED_STORE_IC) {
DCHECK(FLAG_vector_stores);
KeyedStoreICNexus nexus(this, slot);
nexus.Clear(host);
}
+const char* TypeFeedbackVector::Kind2String(FeedbackVectorSlotKind kind) {
+ switch (kind) {
+ case FeedbackVectorSlotKind::UNUSED:
+ return "UNUSED";
+ case FeedbackVectorSlotKind::CALL_IC:
+ return "CALL_IC";
+ case FeedbackVectorSlotKind::LOAD_IC:
+ return "LOAD_IC";
+ case FeedbackVectorSlotKind::KEYED_LOAD_IC:
+ return "KEYED_LOAD_IC";
+ case FeedbackVectorSlotKind::STORE_IC:
+ return "STORE_IC";
+ case FeedbackVectorSlotKind::KEYED_STORE_IC:
+ return "KEYED_STORE_IC";
+ case FeedbackVectorSlotKind::KINDS_NUMBER:
+ break;
+ }
+ UNREACHABLE();
+ return "?";
+}
+
+
Handle<FixedArray> FeedbackNexus::EnsureArrayOfSize(int length) {
Isolate* isolate = GetIsolate();
Handle<Object> feedback = handle(GetFeedback(), isolate);
namespace v8 {
namespace internal {
+
+enum class FeedbackVectorSlotKind {
+ UNUSED,
+ CALL_IC,
+ LOAD_IC,
+ KEYED_LOAD_IC,
+ STORE_IC,
+ KEYED_STORE_IC,
+
+ KINDS_NUMBER // Last value indicating number of kinds.
+};
+
+
+std::ostream& operator<<(std::ostream& os, FeedbackVectorSlotKind kind);
+
+
class FeedbackVectorSpec {
public:
FeedbackVectorSpec() : slots_(0), ic_slots_(0), ic_kinds_(NULL) {}
explicit FeedbackVectorSpec(int slots)
: slots_(slots), ic_slots_(0), ic_kinds_(NULL) {}
- FeedbackVectorSpec(int slots, int ic_slots, Code::Kind* ic_slot_kinds)
+ FeedbackVectorSpec(int slots, int ic_slots,
+ FeedbackVectorSlotKind* ic_slot_kinds)
: slots_(slots), ic_slots_(ic_slots), ic_kinds_(ic_slot_kinds) {}
int slots() const { return slots_; }
int ic_slots() const { return ic_slots_; }
- Code::Kind GetKind(int ic_slot) const {
+ FeedbackVectorSlotKind GetKind(int ic_slot) const {
DCHECK(ic_slots_ > 0 && ic_slot < ic_slots_);
return ic_kinds_[ic_slot];
}
private:
int slots_;
int ic_slots_;
- Code::Kind* ic_kinds_;
+ FeedbackVectorSlotKind* ic_kinds_;
};
ic_slot_kinds_.resize(ic_slots_);
}
- void SetKind(int ic_slot, Code::Kind kind) {
- ic_slot_kinds_[ic_slot] = kind;
+ void SetKind(int ic_slot, FeedbackVectorSlotKind kind) {
+ ic_slot_kinds_[ic_slot] = static_cast<unsigned char>(kind);
}
- Code::Kind GetKind(int ic_slot) const {
- return static_cast<Code::Kind>(ic_slot_kinds_.at(ic_slot));
+ FeedbackVectorSlotKind GetKind(int ic_slot) const {
+ return static_cast<FeedbackVectorSlotKind>(ic_slot_kinds_.at(ic_slot));
}
private:
WriteBarrierMode mode = UPDATE_WRITE_BARRIER);
// IC slots need metadata to recognize the type of IC.
- Code::Kind GetKind(FeedbackVectorICSlot slot) const;
+ FeedbackVectorSlotKind GetKind(FeedbackVectorICSlot slot) const;
template <typename Spec>
static Handle<TypeFeedbackVector> Allocate(Isolate* isolate,
static Handle<TypeFeedbackVector> CreatePushAppliedArgumentsVector(
Isolate* isolate);
+ static const char* Kind2String(FeedbackVectorSlotKind kind);
+
private:
- enum VectorICKind {
- KindUnused = 0x0,
- KindCallIC = 0x1,
- KindLoadIC = 0x2,
- KindKeyedLoadIC = 0x3,
- KindStoreIC = 0x4,
- KindKeyedStoreIC = 0x5,
- };
-
- static const int kVectorICKindBits = 3;
- static VectorICKind FromCodeKind(Code::Kind kind);
- static Code::Kind FromVectorICKind(VectorICKind kind);
- void SetKind(FeedbackVectorICSlot slot, Code::Kind kind);
-
- typedef BitSetComputer<VectorICKind, kVectorICKindBits, kSmiValueSize,
- uint32_t> VectorICComputer;
+ static const int kFeedbackVectorSlotKindBits = 3;
+ STATIC_ASSERT(static_cast<int>(FeedbackVectorSlotKind::KINDS_NUMBER) <
+ (1 << kFeedbackVectorSlotKindBits));
+
+ void SetKind(FeedbackVectorICSlot slot, FeedbackVectorSlotKind kind);
+
+ typedef BitSetComputer<FeedbackVectorSlotKind, kFeedbackVectorSlotKindBits,
+ kSmiValueSize, uint32_t> VectorICComputer;
void ClearSlotsImpl(SharedFunctionInfo* shared, bool force_clear);
void ClearICSlotsImpl(SharedFunctionInfo* shared, bool force_clear);
CallICNexus(Handle<TypeFeedbackVector> vector, FeedbackVectorICSlot slot)
: FeedbackNexus(vector, slot) {
- DCHECK(vector->GetKind(slot) == Code::CALL_IC);
+ DCHECK_EQ(FeedbackVectorSlotKind::CALL_IC, vector->GetKind(slot));
}
CallICNexus(TypeFeedbackVector* vector, FeedbackVectorICSlot slot)
: FeedbackNexus(vector, slot) {
- DCHECK(vector->GetKind(slot) == Code::CALL_IC);
+ DCHECK_EQ(FeedbackVectorSlotKind::CALL_IC, vector->GetKind(slot));
}
void Clear(Code* host);
public:
LoadICNexus(Handle<TypeFeedbackVector> vector, FeedbackVectorICSlot slot)
: FeedbackNexus(vector, slot) {
- DCHECK(vector->GetKind(slot) == Code::LOAD_IC);
+ DCHECK_EQ(FeedbackVectorSlotKind::LOAD_IC, vector->GetKind(slot));
}
explicit LoadICNexus(Isolate* isolate)
: FeedbackNexus(TypeFeedbackVector::DummyVector(isolate),
TypeFeedbackVector::kDummyLoadICSlot)) {}
LoadICNexus(TypeFeedbackVector* vector, FeedbackVectorICSlot slot)
: FeedbackNexus(vector, slot) {
- DCHECK(vector->GetKind(slot) == Code::LOAD_IC);
+ DCHECK_EQ(FeedbackVectorSlotKind::LOAD_IC, vector->GetKind(slot));
}
void Clear(Code* host);
public:
KeyedLoadICNexus(Handle<TypeFeedbackVector> vector, FeedbackVectorICSlot slot)
: FeedbackNexus(vector, slot) {
- DCHECK(vector->GetKind(slot) == Code::KEYED_LOAD_IC);
+ DCHECK_EQ(FeedbackVectorSlotKind::KEYED_LOAD_IC, vector->GetKind(slot));
}
KeyedLoadICNexus(TypeFeedbackVector* vector, FeedbackVectorICSlot slot)
: FeedbackNexus(vector, slot) {
- DCHECK(vector->GetKind(slot) == Code::KEYED_LOAD_IC);
+ DCHECK_EQ(FeedbackVectorSlotKind::KEYED_LOAD_IC, vector->GetKind(slot));
}
void Clear(Code* host);
public:
StoreICNexus(Handle<TypeFeedbackVector> vector, FeedbackVectorICSlot slot)
: FeedbackNexus(vector, slot) {
- DCHECK(vector->GetKind(slot) == Code::STORE_IC);
+ DCHECK_EQ(FeedbackVectorSlotKind::STORE_IC, vector->GetKind(slot));
}
explicit StoreICNexus(Isolate* isolate)
: FeedbackNexus(TypeFeedbackVector::DummyVector(isolate),
TypeFeedbackVector::kDummyStoreICSlot)) {}
StoreICNexus(TypeFeedbackVector* vector, FeedbackVectorICSlot slot)
: FeedbackNexus(vector, slot) {
- DCHECK(vector->GetKind(slot) == Code::STORE_IC);
+ DCHECK_EQ(FeedbackVectorSlotKind::STORE_IC, vector->GetKind(slot));
}
void Clear(Code* host);
KeyedStoreICNexus(Handle<TypeFeedbackVector> vector,
FeedbackVectorICSlot slot)
: FeedbackNexus(vector, slot) {
- DCHECK(vector->GetKind(slot) == Code::KEYED_STORE_IC);
+ DCHECK_EQ(FeedbackVectorSlotKind::KEYED_STORE_IC, vector->GetKind(slot));
}
explicit KeyedStoreICNexus(Isolate* isolate)
: FeedbackNexus(TypeFeedbackVector::DummyVector(isolate),
TypeFeedbackVector::kDummyKeyedStoreICSlot)) {}
KeyedStoreICNexus(TypeFeedbackVector* vector, FeedbackVectorICSlot slot)
: FeedbackNexus(vector, slot) {
- DCHECK(vector->GetKind(slot) == Code::KEYED_STORE_IC);
+ DCHECK_EQ(FeedbackVectorSlotKind::KEYED_STORE_IC, vector->GetKind(slot));
}
void Clear(Code* host);
InlineCacheState TypeFeedbackOracle::LoadInlineCacheState(
FeedbackVectorICSlot slot) {
if (!slot.IsInvalid()) {
- Code::Kind kind = feedback_vector_->GetKind(slot);
- if (kind == Code::LOAD_IC) {
+ FeedbackVectorSlotKind kind = feedback_vector_->GetKind(slot);
+ if (kind == FeedbackVectorSlotKind::LOAD_IC) {
LoadICNexus nexus(feedback_vector_, slot);
return nexus.StateFromFeedback();
- } else if (kind == Code::KEYED_LOAD_IC) {
+ } else if (kind == FeedbackVectorSlotKind::KEYED_LOAD_IC) {
KeyedLoadICNexus nexus(feedback_vector_, slot);
return nexus.StateFromFeedback();
}
bool TypeFeedbackOracle::StoreIsUninitialized(FeedbackVectorICSlot slot) {
if (!slot.IsInvalid()) {
- Code::Kind kind = feedback_vector_->GetKind(slot);
- if (kind == Code::STORE_IC) {
+ FeedbackVectorSlotKind kind = feedback_vector_->GetKind(slot);
+ if (kind == FeedbackVectorSlotKind::STORE_IC) {
StoreICNexus nexus(feedback_vector_, slot);
return nexus.StateFromFeedback() == UNINITIALIZED;
- } else if (kind == Code::KEYED_STORE_IC) {
+ } else if (kind == FeedbackVectorSlotKind::KEYED_STORE_IC) {
KeyedStoreICNexus nexus(feedback_vector_, slot);
return nexus.StateFromFeedback() == UNINITIALIZED;
}
FeedbackVectorICSlot slot, KeyedAccessStoreMode* store_mode,
IcCheckType* key_type) {
if (!slot.IsInvalid() &&
- feedback_vector_->GetKind(slot) == Code::KEYED_STORE_IC) {
+ feedback_vector_->GetKind(slot) ==
+ FeedbackVectorSlotKind::KEYED_STORE_IC) {
KeyedStoreICNexus nexus(feedback_vector_, slot);
*store_mode = nexus.GetKeyedAccessStoreMode();
*key_type = nexus.GetKeyType();
void TypeFeedbackOracle::CollectReceiverTypes(FeedbackVectorICSlot slot,
SmallMapList* types) {
- Code::Kind kind = feedback_vector_->GetKind(slot);
- if (kind == Code::STORE_IC) {
+ FeedbackVectorSlotKind kind = feedback_vector_->GetKind(slot);
+ if (kind == FeedbackVectorSlotKind::STORE_IC) {
StoreICNexus nexus(feedback_vector_, slot);
CollectReceiverTypes<FeedbackNexus>(&nexus, types);
} else {
- DCHECK(kind == Code::KEYED_STORE_IC);
+ DCHECK_EQ(FeedbackVectorSlotKind::KEYED_STORE_IC, kind);
KeyedStoreICNexus nexus(feedback_vector_, slot);
CollectReceiverTypes<FeedbackNexus>(&nexus, types);
}
InitializedHandleScope handle_scope;
BytecodeGeneratorHelper helper;
- Code::Kind ic_kinds[] = { i::Code::LOAD_IC, i::Code::LOAD_IC };
+ FeedbackVectorSlotKind ic_kinds[] = {i::FeedbackVectorSlotKind::LOAD_IC,
+ i::FeedbackVectorSlotKind::LOAD_IC};
FeedbackVectorSpec feedback_spec(0, 2, ic_kinds);
Handle<i::TypeFeedbackVector> vector =
helper.factory()->NewTypeFeedbackVector(&feedback_spec);
InitializedHandleScope handle_scope;
BytecodeGeneratorHelper helper;
- Code::Kind ic_kinds[] = { i::Code::STORE_IC, i::Code::STORE_IC };
+ FeedbackVectorSlotKind ic_kinds[] = {i::FeedbackVectorSlotKind::STORE_IC,
+ i::FeedbackVectorSlotKind::STORE_IC};
FeedbackVectorSpec feedback_spec(0, 2, ic_kinds);
Handle<i::TypeFeedbackVector> vector =
helper.factory()->NewTypeFeedbackVector(&feedback_spec);
InitializedHandleScope handle_scope;
BytecodeGeneratorHelper helper; //
- Code::Kind ic_kinds[] = { i::Code::LOAD_IC, i::Code::LOAD_IC };
+ FeedbackVectorSlotKind ic_kinds[] = {i::FeedbackVectorSlotKind::LOAD_IC,
+ i::FeedbackVectorSlotKind::LOAD_IC};
FeedbackVectorSpec feedback_spec(0, 2, ic_kinds);
Handle<i::TypeFeedbackVector> vector =
helper.factory()->NewTypeFeedbackVector(&feedback_spec);
i::Isolate* isolate = handles.main_isolate();
i::Factory* factory = isolate->factory();
- i::Code::Kind ic_kinds[] = {i::Code::LOAD_IC};
+ i::FeedbackVectorSlotKind ic_kinds[] = {i::FeedbackVectorSlotKind::LOAD_IC};
i::FeedbackVectorSpec feedback_spec(0, 1, ic_kinds);
Handle<i::TypeFeedbackVector> vector =
factory->NewTypeFeedbackVector(&feedback_spec);
i::Isolate* isolate = handles.main_isolate();
i::Factory* factory = isolate->factory();
- i::Code::Kind ic_kinds[] = { i::Code::KEYED_LOAD_IC };
+ i::FeedbackVectorSlotKind ic_kinds[] = {
+ i::FeedbackVectorSlotKind::KEYED_LOAD_IC};
i::FeedbackVectorSpec feedback_spec(0, 1, ic_kinds);
Handle<i::TypeFeedbackVector> vector =
factory->NewTypeFeedbackVector(&feedback_spec);
i::Isolate* isolate = handles.main_isolate();
i::Factory* factory = isolate->factory();
- i::Code::Kind ic_kinds[] = {i::Code::STORE_IC};
+ i::FeedbackVectorSlotKind ic_kinds[] = {i::FeedbackVectorSlotKind::STORE_IC};
i::FeedbackVectorSpec feedback_spec(0, 1, ic_kinds);
Handle<i::TypeFeedbackVector> vector =
factory->NewTypeFeedbackVector(&feedback_spec);
i::Isolate* isolate = handles.main_isolate();
i::Factory* factory = isolate->factory();
- i::Code::Kind ic_kinds[] = {i::Code::KEYED_STORE_IC};
+ i::FeedbackVectorSlotKind ic_kinds[] = {
+ i::FeedbackVectorSlotKind::KEYED_STORE_IC};
i::FeedbackVectorSpec feedback_spec(0, 1, ic_kinds);
Handle<i::TypeFeedbackVector> vector =
factory->NewTypeFeedbackVector(&feedback_spec);
i::Isolate* isolate = handles.main_isolate();
i::Factory* factory = isolate->factory();
- i::Code::Kind ic_kinds[] = { i::Code::LOAD_IC };
+ i::FeedbackVectorSlotKind ic_kinds[] = {i::FeedbackVectorSlotKind::LOAD_IC};
i::FeedbackVectorSpec feedback_spec(0, 1, ic_kinds);
Handle<i::TypeFeedbackVector> vector =
factory->NewTypeFeedbackVector(&feedback_spec);
namespace {
+#define CHECK_SLOT_KIND(vector, slot, expected_kind) \
+ CHECK_EQ(expected_kind, vector->GetKind(FeedbackVectorICSlot(slot)));
+
+
TEST(VectorStructure) {
LocalContext context;
v8::HandleScope scope(context->GetIsolate());
CHECK_EQ(0, vector->ICSlots());
ZoneFeedbackVectorSpec one_icslot(zone, 0, 1);
- one_icslot.SetKind(0, Code::CALL_IC);
+ one_icslot.SetKind(0, FeedbackVectorSlotKind::CALL_IC);
vector = factory->NewTypeFeedbackVector(&one_icslot);
CHECK_EQ(0, vector->Slots());
CHECK_EQ(1, vector->ICSlots());
ZoneFeedbackVectorSpec spec(zone, 3, 5);
- for (int i = 0; i < 5; i++) spec.SetKind(i, Code::CALL_IC);
+ for (int i = 0; i < 5; i++) spec.SetKind(i, FeedbackVectorSlotKind::CALL_IC);
vector = factory->NewTypeFeedbackVector(&spec);
CHECK_EQ(3, vector->Slots());
CHECK_EQ(5, vector->ICSlots());
ZoneFeedbackVectorSpec spec(zone, 10, 3 * 10);
// Set metadata.
for (int i = 0; i < 30; i++) {
- Code::Kind kind;
+ FeedbackVectorSlotKind kind;
if (i % 3 == 0) {
- kind = Code::CALL_IC;
+ kind = FeedbackVectorSlotKind::CALL_IC;
} else if (i % 3 == 1) {
- kind = Code::LOAD_IC;
+ kind = FeedbackVectorSlotKind::LOAD_IC;
} else {
- kind = Code::KEYED_LOAD_IC;
+ kind = FeedbackVectorSlotKind::KEYED_LOAD_IC;
}
spec.SetKind(i, kind);
}
// Verify the metadata is correctly set up from the spec.
for (int i = 0; i < 30; i++) {
- Code::Kind kind = vector->GetKind(FeedbackVectorICSlot(i));
+ FeedbackVectorSlotKind kind = vector->GetKind(FeedbackVectorICSlot(i));
if (i % 3 == 0) {
- CHECK_EQ(Code::CALL_IC, kind);
+ CHECK_EQ(FeedbackVectorSlotKind::CALL_IC, kind);
} else if (i % 3 == 1) {
- CHECK_EQ(Code::LOAD_IC, kind);
+ CHECK_EQ(FeedbackVectorSlotKind::LOAD_IC, kind);
} else {
- CHECK_EQ(Code::KEYED_LOAD_IC, kind);
+ CHECK_EQ(FeedbackVectorSlotKind::KEYED_LOAD_IC, kind);
}
}
}
handle(f->shared()->feedback_vector(), isolate);
if (FLAG_vector_stores) {
CHECK_EQ(4, feedback_vector->ICSlots());
- CHECK(feedback_vector->GetKind(FeedbackVectorICSlot(0)) == Code::STORE_IC);
- CHECK(feedback_vector->GetKind(FeedbackVectorICSlot(1)) == Code::LOAD_IC);
- CHECK(feedback_vector->GetKind(FeedbackVectorICSlot(2)) == Code::STORE_IC);
- CHECK(feedback_vector->GetKind(FeedbackVectorICSlot(3)) == Code::LOAD_IC);
+ CHECK_SLOT_KIND(feedback_vector, 0, FeedbackVectorSlotKind::STORE_IC);
+ CHECK_SLOT_KIND(feedback_vector, 1, FeedbackVectorSlotKind::LOAD_IC);
+ CHECK_SLOT_KIND(feedback_vector, 2, FeedbackVectorSlotKind::STORE_IC);
+ CHECK_SLOT_KIND(feedback_vector, 3, FeedbackVectorSlotKind::LOAD_IC);
} else {
CHECK_EQ(2, feedback_vector->ICSlots());
- CHECK(feedback_vector->GetKind(FeedbackVectorICSlot(0)) == Code::LOAD_IC);
- CHECK(feedback_vector->GetKind(FeedbackVectorICSlot(1)) == Code::LOAD_IC);
+ CHECK_SLOT_KIND(feedback_vector, 0, FeedbackVectorSlotKind::LOAD_IC);
+ CHECK_SLOT_KIND(feedback_vector, 1, FeedbackVectorSlotKind::LOAD_IC);
}
CompileRun(
feedback_vector = handle(f->shared()->feedback_vector(), isolate);
if (FLAG_vector_stores) {
CHECK_EQ(5, feedback_vector->ICSlots());
- CHECK(feedback_vector->GetKind(FeedbackVectorICSlot(0)) == Code::CALL_IC);
- CHECK(feedback_vector->GetKind(FeedbackVectorICSlot(1)) == Code::LOAD_IC);
- CHECK(feedback_vector->GetKind(FeedbackVectorICSlot(2)) == Code::STORE_IC);
- CHECK(feedback_vector->GetKind(FeedbackVectorICSlot(3)) == Code::CALL_IC);
- CHECK(feedback_vector->GetKind(FeedbackVectorICSlot(4)) == Code::LOAD_IC);
+ CHECK_SLOT_KIND(feedback_vector, 0, FeedbackVectorSlotKind::CALL_IC);
+ CHECK_SLOT_KIND(feedback_vector, 1, FeedbackVectorSlotKind::LOAD_IC);
+ CHECK_SLOT_KIND(feedback_vector, 2, FeedbackVectorSlotKind::STORE_IC);
+ CHECK_SLOT_KIND(feedback_vector, 3, FeedbackVectorSlotKind::CALL_IC);
+ CHECK_SLOT_KIND(feedback_vector, 4, FeedbackVectorSlotKind::LOAD_IC);
} else {
CHECK_EQ(4, feedback_vector->ICSlots());
- CHECK(feedback_vector->GetKind(FeedbackVectorICSlot(0)) == Code::CALL_IC);
- CHECK(feedback_vector->GetKind(FeedbackVectorICSlot(1)) == Code::LOAD_IC);
- CHECK(feedback_vector->GetKind(FeedbackVectorICSlot(2)) == Code::CALL_IC);
- CHECK(feedback_vector->GetKind(FeedbackVectorICSlot(3)) == Code::LOAD_IC);
+ CHECK_SLOT_KIND(feedback_vector, 0, FeedbackVectorSlotKind::CALL_IC);
+ CHECK_SLOT_KIND(feedback_vector, 1, FeedbackVectorSlotKind::LOAD_IC);
+ CHECK_SLOT_KIND(feedback_vector, 2, FeedbackVectorSlotKind::CALL_IC);
+ CHECK_SLOT_KIND(feedback_vector, 3, FeedbackVectorSlotKind::LOAD_IC);
}
CompileRun(
feedback_vector = handle(f->shared()->feedback_vector(), isolate);
if (FLAG_vector_stores) {
CHECK_EQ(3, feedback_vector->ICSlots());
- CHECK(feedback_vector->GetKind(FeedbackVectorICSlot(0)) == Code::LOAD_IC);
- CHECK(feedback_vector->GetKind(FeedbackVectorICSlot(1)) ==
- Code::KEYED_STORE_IC);
- CHECK(feedback_vector->GetKind(FeedbackVectorICSlot(2)) ==
- Code::KEYED_LOAD_IC);
+ CHECK_SLOT_KIND(feedback_vector, 0, FeedbackVectorSlotKind::LOAD_IC);
+ CHECK_SLOT_KIND(feedback_vector, 1, FeedbackVectorSlotKind::KEYED_STORE_IC);
+ CHECK_SLOT_KIND(feedback_vector, 2, FeedbackVectorSlotKind::KEYED_LOAD_IC);
} else {
CHECK_EQ(2, feedback_vector->ICSlots());
- CHECK(feedback_vector->GetKind(FeedbackVectorICSlot(0)) == Code::LOAD_IC);
- CHECK(feedback_vector->GetKind(FeedbackVectorICSlot(1)) ==
- Code::KEYED_LOAD_IC);
+ CHECK_SLOT_KIND(feedback_vector, 0, FeedbackVectorSlotKind::LOAD_IC);
+ CHECK_SLOT_KIND(feedback_vector, 1, FeedbackVectorSlotKind::KEYED_LOAD_IC);
}
CompileRun(
feedback_vector = handle(f->shared()->feedback_vector(), isolate);
if (FLAG_vector_stores) {
CHECK_EQ(6, feedback_vector->ICSlots());
- CHECK(feedback_vector->GetKind(FeedbackVectorICSlot(0)) == Code::LOAD_IC);
- CHECK(feedback_vector->GetKind(FeedbackVectorICSlot(1)) == Code::STORE_IC);
- CHECK(feedback_vector->GetKind(FeedbackVectorICSlot(2)) == Code::STORE_IC);
- CHECK(feedback_vector->GetKind(FeedbackVectorICSlot(3)) == Code::STORE_IC);
- CHECK(feedback_vector->GetKind(FeedbackVectorICSlot(4)) == Code::LOAD_IC);
- CHECK(feedback_vector->GetKind(FeedbackVectorICSlot(5)) == Code::LOAD_IC);
+ CHECK_SLOT_KIND(feedback_vector, 0, FeedbackVectorSlotKind::LOAD_IC);
+ CHECK_SLOT_KIND(feedback_vector, 1, FeedbackVectorSlotKind::STORE_IC);
+ CHECK_SLOT_KIND(feedback_vector, 2, FeedbackVectorSlotKind::STORE_IC);
+ CHECK_SLOT_KIND(feedback_vector, 3, FeedbackVectorSlotKind::STORE_IC);
+ CHECK_SLOT_KIND(feedback_vector, 4, FeedbackVectorSlotKind::LOAD_IC);
+ CHECK_SLOT_KIND(feedback_vector, 5, FeedbackVectorSlotKind::LOAD_IC);
} else {
CHECK_EQ(3, feedback_vector->ICSlots());
- CHECK(feedback_vector->GetKind(FeedbackVectorICSlot(0)) == Code::LOAD_IC);
- CHECK(feedback_vector->GetKind(FeedbackVectorICSlot(1)) == Code::LOAD_IC);
- CHECK(feedback_vector->GetKind(FeedbackVectorICSlot(2)) == Code::LOAD_IC);
+ CHECK_SLOT_KIND(feedback_vector, 0, FeedbackVectorSlotKind::LOAD_IC);
+ CHECK_SLOT_KIND(feedback_vector, 1, FeedbackVectorSlotKind::LOAD_IC);
+ CHECK_SLOT_KIND(feedback_vector, 2, FeedbackVectorSlotKind::LOAD_IC);
}
}
Handle<TypeFeedbackVector> vector =
Handle<TypeFeedbackVector>(f->shared()->feedback_vector());
FeedbackVectorICSlot slot(ic_slot_index);
- if (vector->GetKind(slot) == Code::LOAD_IC) {
+ if (vector->GetKind(slot) == FeedbackVectorSlotKind::LOAD_IC) {
LoadICNexus nexus(vector, slot);
CHECK(nexus.StateFromFeedback() == desired_state);
} else {
- CHECK(vector->GetKind(slot) == Code::KEYED_LOAD_IC);
+ CHECK_EQ(FeedbackVectorSlotKind::KEYED_LOAD_IC, vector->GetKind(slot));
KeyedLoadICNexus nexus(vector, slot);
CHECK(nexus.StateFromFeedback() == desired_state);
}