Commit 1a5751f9 authored by mvstanton's avatar mvstanton Committed by Commit bot

VectorICs: refactoring to eliminate "for queries only" vector ic mode.

Since we need the notion of a dummy vector ic, we can use that to avoid
a special case of the IC constructor. Also, consolidate the two dummy
ICs into one.

BUG=

Review URL: https://codereview.chromium.org/1268783004

Cr-Commit-Position: refs/heads/master@{#29956}
parent 3edebf08
......@@ -1451,7 +1451,8 @@ static void Generate_PushAppliedArguments(MacroAssembler* masm,
__ ldr(receiver, MemOperand(fp, argumentsOffset));
// Use inline caching to speed up access to arguments.
FeedbackVectorSpec spec(0, Code::KEYED_LOAD_IC);
Code::Kind kinds[] = {Code::KEYED_LOAD_IC};
FeedbackVectorSpec spec(0, 1, kinds);
Handle<TypeFeedbackVector> feedback_vector =
masm->isolate()->factory()->NewTypeFeedbackVector(&spec);
int index = feedback_vector->GetIndex(FeedbackVectorICSlot(0));
......
......@@ -1483,7 +1483,8 @@ static void Generate_PushAppliedArguments(MacroAssembler* masm,
__ Ldr(receiver, MemOperand(fp, argumentsOffset));
// Use inline caching to speed up access to arguments.
FeedbackVectorSpec spec(0, Code::KEYED_LOAD_IC);
Code::Kind kinds[] = {Code::KEYED_LOAD_IC};
FeedbackVectorSpec spec(0, 1, kinds);
Handle<TypeFeedbackVector> feedback_vector =
masm->isolate()->factory()->NewTypeFeedbackVector(&spec);
int index = feedback_vector->GetIndex(FeedbackVectorICSlot(0));
......
......@@ -3413,25 +3413,17 @@ void Heap::CreateInitialObjects() {
set_microtask_queue(empty_fixed_array());
{
FeedbackVectorSpec spec(0, Code::KEYED_LOAD_IC);
Code::Kind kinds[] = {Code::LOAD_IC, Code::KEYED_LOAD_IC, Code::STORE_IC,
Code::KEYED_STORE_IC};
FeedbackVectorSpec spec(0, 4, kinds);
Handle<TypeFeedbackVector> dummy_vector =
factory->NewTypeFeedbackVector(&spec);
dummy_vector->Set(FeedbackVectorICSlot(0),
*TypeFeedbackVector::MegamorphicSentinel(isolate()),
SKIP_WRITE_BARRIER);
set_keyed_load_dummy_vector(*dummy_vector);
}
if (FLAG_vector_stores) {
FeedbackVectorSpec spec(0, Code::KEYED_STORE_IC);
Handle<TypeFeedbackVector> dummy_vector =
factory->NewTypeFeedbackVector(&spec);
dummy_vector->Set(FeedbackVectorICSlot(0),
*TypeFeedbackVector::MegamorphicSentinel(isolate()),
SKIP_WRITE_BARRIER);
set_keyed_store_dummy_vector(*dummy_vector);
} else {
set_keyed_store_dummy_vector(empty_fixed_array());
for (int i = 0; i < 4; i++) {
dummy_vector->Set(FeedbackVectorICSlot(0),
*TypeFeedbackVector::MegamorphicSentinel(isolate()),
SKIP_WRITE_BARRIER);
}
set_dummy_vector(*dummy_vector);
}
set_detached_contexts(empty_fixed_array());
......
......@@ -169,8 +169,7 @@ namespace internal {
V(FixedArray, materialized_objects, MaterializedObjects) \
V(FixedArray, allocation_sites_scratchpad, AllocationSitesScratchpad) \
V(FixedArray, microtask_queue, MicrotaskQueue) \
V(FixedArray, keyed_load_dummy_vector, KeyedLoadDummyVector) \
V(FixedArray, keyed_store_dummy_vector, KeyedStoreDummyVector) \
V(FixedArray, dummy_vector, DummyVector) \
V(FixedArray, detached_contexts, DetachedContexts) \
V(ArrayList, retained_maps, RetainedMaps) \
V(WeakHashTable, weak_object_to_code_table, WeakObjectToCodeTable) \
......
......@@ -1105,7 +1105,8 @@ static void Generate_PushAppliedArguments(MacroAssembler* masm,
__ mov(receiver, Operand(ebp, argumentsOffset)); // load arguments
// Use inline caching to speed up access to arguments.
FeedbackVectorSpec spec(0, Code::KEYED_LOAD_IC);
Code::Kind kinds[] = {Code::KEYED_LOAD_IC};
FeedbackVectorSpec spec(0, 1, kinds);
Handle<TypeFeedbackVector> feedback_vector =
masm->isolate()->factory()->NewTypeFeedbackVector(&spec);
int index = feedback_vector->GetIndex(FeedbackVectorICSlot(0));
......
......@@ -431,10 +431,11 @@ void KeyedLoadIC::GenerateMegamorphic(MacroAssembler* masm,
Register vector = LoadWithVectorDescriptor::VectorRegister();
Register slot = LoadWithVectorDescriptor::SlotRegister();
DCHECK(!AreAliased(vector, slot, r4, r5, r6, r9));
Handle<TypeFeedbackVector> dummy_vector = Handle<TypeFeedbackVector>::cast(
masm->isolate()->factory()->keyed_load_dummy_vector());
int slot_index = dummy_vector->GetIndex(FeedbackVectorICSlot(0));
__ LoadRoot(vector, Heap::kKeyedLoadDummyVectorRootIndex);
Handle<TypeFeedbackVector> dummy_vector =
TypeFeedbackVector::DummyVector(masm->isolate());
int slot_index = dummy_vector->GetIndex(
FeedbackVectorICSlot(TypeFeedbackVector::kDummyKeyedLoadICSlot));
__ LoadRoot(vector, Heap::kDummyVectorRootIndex);
__ mov(slot, Operand(Smi::FromInt(slot_index)));
Code::Flags flags = Code::RemoveTypeAndHolderFromFlags(
......@@ -699,10 +700,11 @@ void KeyedStoreIC::GenerateMegamorphic(MacroAssembler* masm,
Register vector = VectorStoreICDescriptor::VectorRegister();
Register slot = VectorStoreICDescriptor::SlotRegister();
DCHECK(!AreAliased(vector, slot, r3, r4, r5, r6));
Handle<TypeFeedbackVector> dummy_vector = Handle<TypeFeedbackVector>::cast(
masm->isolate()->factory()->keyed_store_dummy_vector());
int slot_index = dummy_vector->GetIndex(FeedbackVectorICSlot(0));
__ LoadRoot(vector, Heap::kKeyedStoreDummyVectorRootIndex);
Handle<TypeFeedbackVector> dummy_vector =
TypeFeedbackVector::DummyVector(masm->isolate());
int slot_index = dummy_vector->GetIndex(
FeedbackVectorICSlot(TypeFeedbackVector::kDummyKeyedStoreICSlot));
__ LoadRoot(vector, Heap::kDummyVectorRootIndex);
__ mov(slot, Operand(Smi::FromInt(slot_index)));
}
......
......@@ -409,10 +409,11 @@ static void GenerateKeyedLoadWithNameKey(MacroAssembler* masm, Register key,
Register vector = LoadWithVectorDescriptor::VectorRegister();
Register slot = LoadWithVectorDescriptor::SlotRegister();
DCHECK(!AreAliased(vector, slot, scratch1, scratch2, scratch3, scratch4));
Handle<TypeFeedbackVector> dummy_vector = Handle<TypeFeedbackVector>::cast(
masm->isolate()->factory()->keyed_load_dummy_vector());
int slot_index = dummy_vector->GetIndex(FeedbackVectorICSlot(0));
__ LoadRoot(vector, Heap::kKeyedLoadDummyVectorRootIndex);
Handle<TypeFeedbackVector> dummy_vector =
TypeFeedbackVector::DummyVector(masm->isolate());
int slot_index = dummy_vector->GetIndex(
FeedbackVectorICSlot(TypeFeedbackVector::kDummyKeyedLoadICSlot));
__ LoadRoot(vector, Heap::kDummyVectorRootIndex);
__ Mov(slot, Operand(Smi::FromInt(slot_index)));
Code::Flags flags = Code::RemoveTypeAndHolderFromFlags(
......@@ -698,10 +699,11 @@ void KeyedStoreIC::GenerateMegamorphic(MacroAssembler* masm,
Register vector = VectorStoreICDescriptor::VectorRegister();
Register slot = VectorStoreICDescriptor::SlotRegister();
DCHECK(!AreAliased(vector, slot, x3, x4, x5, x6));
Handle<TypeFeedbackVector> dummy_vector = Handle<TypeFeedbackVector>::cast(
masm->isolate()->factory()->keyed_store_dummy_vector());
int slot_index = dummy_vector->GetIndex(FeedbackVectorICSlot(0));
__ LoadRoot(vector, Heap::kKeyedStoreDummyVectorRootIndex);
Handle<TypeFeedbackVector> dummy_vector =
TypeFeedbackVector::DummyVector(masm->isolate());
int slot_index = dummy_vector->GetIndex(
FeedbackVectorICSlot(TypeFeedbackVector::kDummyKeyedStoreICSlot));
__ LoadRoot(vector, Heap::kDummyVectorRootIndex);
__ Mov(slot, Operand(Smi::FromInt(slot_index)));
}
......
......@@ -340,9 +340,10 @@ void KeyedLoadIC::GenerateMegamorphic(MacroAssembler* masm,
// The handlers in the stub cache expect a vector and slot. Since we won't
// change the IC from any downstream misses, a dummy vector can be used.
Handle<TypeFeedbackVector> dummy_vector = Handle<TypeFeedbackVector>::cast(
isolate->factory()->keyed_load_dummy_vector());
int slot = dummy_vector->GetIndex(FeedbackVectorICSlot(0));
Handle<TypeFeedbackVector> dummy_vector =
TypeFeedbackVector::DummyVector(isolate);
int slot = dummy_vector->GetIndex(
FeedbackVectorICSlot(TypeFeedbackVector::kDummyKeyedLoadICSlot));
__ push(Immediate(Smi::FromInt(slot)));
__ push(Immediate(dummy_vector));
......@@ -567,9 +568,10 @@ void KeyedStoreIC::GenerateMegamorphic(MacroAssembler* masm,
if (FLAG_vector_stores) {
// The handlers in the stub cache expect a vector and slot. Since we won't
// change the IC from any downstream misses, a dummy vector can be used.
Handle<TypeFeedbackVector> dummy_vector = Handle<TypeFeedbackVector>::cast(
masm->isolate()->factory()->keyed_store_dummy_vector());
int slot = dummy_vector->GetIndex(FeedbackVectorICSlot(0));
Handle<TypeFeedbackVector> dummy_vector =
TypeFeedbackVector::DummyVector(masm->isolate());
int slot = dummy_vector->GetIndex(
FeedbackVectorICSlot(TypeFeedbackVector::kDummyKeyedStoreICSlot));
__ push(Immediate(Smi::FromInt(slot)));
__ push(Immediate(dummy_vector));
}
......
......@@ -140,8 +140,7 @@ void IC::TraceIC(const char* type, Handle<Object> name, State old_state,
#define TRACE_IC(type, name) TraceIC(type, name)
IC::IC(FrameDepth depth, Isolate* isolate, FeedbackNexus* nexus,
bool for_queries_only)
IC::IC(FrameDepth depth, Isolate* isolate, FeedbackNexus* nexus)
: isolate_(isolate),
target_set_(false),
vector_set_(false),
......@@ -184,8 +183,7 @@ IC::IC(FrameDepth depth, Isolate* isolate, FeedbackNexus* nexus,
pc_address_ = StackFrame::ResolveReturnAddressLocation(pc_address);
target_ = handle(raw_target(), isolate);
kind_ = target_->kind();
state_ = (!for_queries_only && UseVector()) ? nexus->StateFromFeedback()
: target_->ic_state();
state_ = UseVector() ? nexus->StateFromFeedback() : target_->ic_state();
old_state_ = state_;
extra_ic_state_ = target_->extra_ic_state();
}
......@@ -3002,7 +3000,8 @@ RUNTIME_FUNCTION(Runtime_LoadPropertyWithInterceptor) {
// Return the undefined result if the reference error should not be thrown.
// Note that both keyed and non-keyed loads may end up here.
LoadIC ic(IC::NO_EXTRA_FRAME, isolate, true);
LoadICNexus nexus(isolate);
LoadIC ic(IC::NO_EXTRA_FRAME, isolate, &nexus);
if (!ic.ShouldThrowReferenceError(it.GetReceiver())) {
return isolate->heap()->undefined_value();
}
......@@ -3016,7 +3015,8 @@ RUNTIME_FUNCTION(Runtime_LoadPropertyWithInterceptor) {
RUNTIME_FUNCTION(Runtime_StorePropertyWithInterceptor) {
HandleScope scope(isolate);
DCHECK(args.length() == 3);
StoreIC ic(IC::NO_EXTRA_FRAME, isolate);
StoreICNexus nexus(isolate);
StoreIC ic(IC::NO_EXTRA_FRAME, isolate, &nexus);
Handle<JSObject> receiver = args.at<JSObject>(0);
Handle<Name> name = args.at<Name>(1);
Handle<Object> value = args.at<Object>(2);
......
......@@ -26,8 +26,7 @@ class IC {
// Construct the IC structure with the given number of extra
// JavaScript frames on the stack.
IC(FrameDepth depth, Isolate* isolate, FeedbackNexus* nexus = NULL,
bool for_queries_only = false);
IC(FrameDepth depth, Isolate* isolate, FeedbackNexus* nexus = NULL);
virtual ~IC() {}
State state() const { return state_; }
......@@ -320,15 +319,6 @@ class LoadIC : public IC {
DCHECK(IsLoadStub());
}
// TODO(mvstanton): The for_queries_only is because we have a case where we
// construct an IC only to gather the contextual mode, and we don't have
// vector/slot information. for_queries_only is a temporary hack to enable the
// strong DCHECK protection around vector/slot.
LoadIC(FrameDepth depth, Isolate* isolate, bool for_queries_only)
: IC(depth, isolate, NULL, for_queries_only) {
DCHECK(IsLoadStub());
}
bool ShouldThrowReferenceError(Handle<Object> receiver) {
return receiver->IsGlobalObject() && typeof_mode() == NOT_INSIDE_TYPEOF;
}
......
......@@ -436,10 +436,11 @@ void KeyedLoadIC::GenerateMegamorphic(MacroAssembler* masm,
Register vector = LoadWithVectorDescriptor::VectorRegister();
Register slot = LoadWithVectorDescriptor::SlotRegister();
DCHECK(!AreAliased(vector, slot, t0, t1, t2, t5));
Handle<TypeFeedbackVector> dummy_vector = Handle<TypeFeedbackVector>::cast(
masm->isolate()->factory()->keyed_load_dummy_vector());
int slot_index = dummy_vector->GetIndex(FeedbackVectorICSlot(0));
__ LoadRoot(vector, Heap::kKeyedLoadDummyVectorRootIndex);
Handle<TypeFeedbackVector> dummy_vector =
TypeFeedbackVector::DummyVector(masm->isolate());
int slot_index = dummy_vector->GetIndex(
FeedbackVectorICSlot(TypeFeedbackVector::kDummyKeyedLoadICSlot));
__ LoadRoot(vector, Heap::kDummyVectorRootIndex);
__ li(slot, Operand(Smi::FromInt(slot_index)));
Code::Flags flags = Code::RemoveTypeAndHolderFromFlags(
......@@ -684,10 +685,11 @@ void KeyedStoreIC::GenerateMegamorphic(MacroAssembler* masm,
Register vector = VectorStoreICDescriptor::VectorRegister();
Register slot = VectorStoreICDescriptor::SlotRegister();
DCHECK(!AreAliased(vector, slot, a3, t0, t1, t2));
Handle<TypeFeedbackVector> dummy_vector = Handle<TypeFeedbackVector>::cast(
masm->isolate()->factory()->keyed_store_dummy_vector());
int slot_index = dummy_vector->GetIndex(FeedbackVectorICSlot(0));
__ LoadRoot(vector, Heap::kKeyedStoreDummyVectorRootIndex);
Handle<TypeFeedbackVector> dummy_vector =
TypeFeedbackVector::DummyVector(masm->isolate());
int slot_index = dummy_vector->GetIndex(
FeedbackVectorICSlot(TypeFeedbackVector::kDummyKeyedStoreICSlot));
__ LoadRoot(vector, Heap::kDummyVectorRootIndex);
__ li(slot, Operand(Smi::FromInt(slot_index)));
}
......
......@@ -433,10 +433,11 @@ void KeyedLoadIC::GenerateMegamorphic(MacroAssembler* masm,
Register vector = LoadWithVectorDescriptor::VectorRegister();
Register slot = LoadWithVectorDescriptor::SlotRegister();
DCHECK(!AreAliased(vector, slot, a4, a5, a6, t1));
Handle<TypeFeedbackVector> dummy_vector = Handle<TypeFeedbackVector>::cast(
masm->isolate()->factory()->keyed_load_dummy_vector());
int slot_index = dummy_vector->GetIndex(FeedbackVectorICSlot(0));
__ LoadRoot(vector, Heap::kKeyedLoadDummyVectorRootIndex);
Handle<TypeFeedbackVector> dummy_vector =
TypeFeedbackVector::DummyVector(masm->isolate());
int slot_index = dummy_vector->GetIndex(
FeedbackVectorICSlot(TypeFeedbackVector::kDummyKeyedLoadICSlot));
__ LoadRoot(vector, Heap::kDummyVectorRootIndex);
__ li(slot, Operand(Smi::FromInt(slot_index)));
Code::Flags flags = Code::RemoveTypeAndHolderFromFlags(
......@@ -682,10 +683,11 @@ void KeyedStoreIC::GenerateMegamorphic(MacroAssembler* masm,
Register vector = LoadWithVectorDescriptor::VectorRegister();
Register slot = LoadWithVectorDescriptor::SlotRegister();
DCHECK(!AreAliased(vector, slot, a3, a4, a5, a6));
Handle<TypeFeedbackVector> dummy_vector = Handle<TypeFeedbackVector>::cast(
masm->isolate()->factory()->keyed_store_dummy_vector());
int slot_index = dummy_vector->GetIndex(FeedbackVectorICSlot(0));
__ LoadRoot(vector, Heap::kKeyedStoreDummyVectorRootIndex);
Handle<TypeFeedbackVector> dummy_vector =
TypeFeedbackVector::DummyVector(masm->isolate());
int slot_index = dummy_vector->GetIndex(
FeedbackVectorICSlot(TypeFeedbackVector::kDummyKeyedStoreICSlot));
__ LoadRoot(vector, Heap::kDummyVectorRootIndex);
__ li(slot, Operand(Smi::FromInt(slot_index)));
}
......
......@@ -345,9 +345,10 @@ void KeyedLoadIC::GenerateMegamorphic(MacroAssembler* masm,
Register vector = LoadWithVectorDescriptor::VectorRegister();
Register slot = LoadDescriptor::SlotRegister();
DCHECK(!AreAliased(megamorphic_scratch, vector, slot));
Handle<TypeFeedbackVector> dummy_vector = Handle<TypeFeedbackVector>::cast(
masm->isolate()->factory()->keyed_load_dummy_vector());
int slot_index = dummy_vector->GetIndex(FeedbackVectorICSlot(0));
Handle<TypeFeedbackVector> dummy_vector =
TypeFeedbackVector::DummyVector(masm->isolate());
int slot_index = dummy_vector->GetIndex(
FeedbackVectorICSlot(TypeFeedbackVector::kDummyKeyedLoadICSlot));
__ Move(vector, dummy_vector);
__ Move(slot, Smi::FromInt(slot_index));
......@@ -572,9 +573,10 @@ void KeyedStoreIC::GenerateMegamorphic(MacroAssembler* masm,
Register slot = VectorStoreICDescriptor::SlotRegister();
// The handlers in the stub cache expect a vector and slot. Since we won't
// change the IC from any downstream misses, a dummy vector can be used.
Handle<TypeFeedbackVector> dummy_vector = Handle<TypeFeedbackVector>::cast(
masm->isolate()->factory()->keyed_store_dummy_vector());
int slot_index = dummy_vector->GetIndex(FeedbackVectorICSlot(0));
Handle<TypeFeedbackVector> dummy_vector =
TypeFeedbackVector::DummyVector(masm->isolate());
int slot_index = dummy_vector->GetIndex(
FeedbackVectorICSlot(TypeFeedbackVector::kDummyKeyedStoreICSlot));
__ Move(vector, dummy_vector);
__ Move(slot, Smi::FromInt(slot_index));
}
......
......@@ -1446,7 +1446,8 @@ static void Generate_PushAppliedArguments(MacroAssembler* masm,
__ lw(receiver, MemOperand(fp, argumentsOffset));
// Use inline caching to speed up access to arguments.
FeedbackVectorSpec spec(0, Code::KEYED_LOAD_IC);
Code::Kind kinds[] = {Code::KEYED_LOAD_IC};
FeedbackVectorSpec spec(0, 1, kinds);
Handle<TypeFeedbackVector> feedback_vector =
masm->isolate()->factory()->NewTypeFeedbackVector(&spec);
int index = feedback_vector->GetIndex(FeedbackVectorICSlot(0));
......
......@@ -1442,7 +1442,8 @@ static void Generate_PushAppliedArguments(MacroAssembler* masm,
__ ld(receiver, MemOperand(fp, argumentsOffset));
// Use inline caching to speed up access to arguments.
FeedbackVectorSpec spec(0, Code::KEYED_LOAD_IC);
Code::Kind kinds[] = {Code::KEYED_LOAD_IC};
FeedbackVectorSpec spec(0, 1, kinds);
Handle<TypeFeedbackVector> feedback_vector =
masm->isolate()->factory()->NewTypeFeedbackVector(&spec);
int index = feedback_vector->GetIndex(FeedbackVectorICSlot(0));
......
......@@ -24,10 +24,8 @@ TypeFeedbackVector::VectorICKind TypeFeedbackVector::FromCodeKind(
case Code::KEYED_LOAD_IC:
return KindKeyedLoadIC;
case Code::STORE_IC:
DCHECK(FLAG_vector_stores);
return KindStoreIC;
case Code::KEYED_STORE_IC:
DCHECK(FLAG_vector_stores);
return KindKeyedStoreIC;
default:
// Shouldn't get here.
......@@ -225,6 +223,12 @@ void TypeFeedbackVector::ClearICSlotsImpl(SharedFunctionInfo* shared,
}
// static
Handle<TypeFeedbackVector> TypeFeedbackVector::DummyVector(Isolate* isolate) {
return Handle<TypeFeedbackVector>::cast(isolate->factory()->dummy_vector());
}
Handle<FixedArray> FeedbackNexus::EnsureArrayOfSize(int length) {
Isolate* isolate = GetIsolate();
Handle<Object> feedback = handle(GetFeedback(), isolate);
......
......@@ -19,24 +19,25 @@ namespace internal {
class FeedbackVectorSpec {
public:
FeedbackVectorSpec() : slots_(0), has_ic_slot_(false) {}
explicit FeedbackVectorSpec(int slots) : slots_(slots), has_ic_slot_(false) {}
FeedbackVectorSpec(int slots, Code::Kind ic_slot_kind)
: slots_(slots), has_ic_slot_(true), ic_kind_(ic_slot_kind) {}
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)
: slots_(slots), ic_slots_(ic_slots), ic_kinds_(ic_slot_kinds) {}
int slots() const { return slots_; }
int ic_slots() const { return has_ic_slot_ ? 1 : 0; }
int ic_slots() const { return ic_slots_; }
Code::Kind GetKind(int ic_slot) const {
DCHECK(has_ic_slot_ && ic_slot == 0);
return ic_kind_;
DCHECK(ic_slots_ > 0 && ic_slot < ic_slots_);
return ic_kinds_[ic_slot];
}
private:
int slots_;
bool has_ic_slot_;
Code::Kind ic_kind_;
int ic_slots_;
Code::Kind* ic_kinds_;
};
......@@ -225,6 +226,17 @@ class TypeFeedbackVector : public FixedArray {
// garbage collection (e.g., for patching the cache).
static inline Object* RawUninitializedSentinel(Heap* heap);
static const int kDummyLoadICSlot = 0;
static const int kDummyKeyedLoadICSlot = 1;
static const int kDummyStoreICSlot = 2;
static const int kDummyKeyedStoreICSlot = 3;
static Handle<TypeFeedbackVector> DummyVector(Isolate* isolate);
static FeedbackVectorICSlot DummySlot(int dummyIndex) {
DCHECK(dummyIndex >= 0 && dummyIndex <= kDummyKeyedStoreICSlot);
return FeedbackVectorICSlot(dummyIndex);
}
private:
enum VectorICKind {
KindUnused = 0x0,
......@@ -386,6 +398,10 @@ class LoadICNexus : public FeedbackNexus {
: FeedbackNexus(vector, slot) {
DCHECK(vector->GetKind(slot) == Code::LOAD_IC);
}
explicit LoadICNexus(Isolate* isolate)
: FeedbackNexus(TypeFeedbackVector::DummyVector(isolate),
TypeFeedbackVector::DummySlot(
TypeFeedbackVector::kDummyLoadICSlot)) {}
LoadICNexus(TypeFeedbackVector* vector, FeedbackVectorICSlot slot)
: FeedbackNexus(vector, slot) {
DCHECK(vector->GetKind(slot) == Code::LOAD_IC);
......@@ -432,6 +448,10 @@ class StoreICNexus : public FeedbackNexus {
: FeedbackNexus(vector, slot) {
DCHECK(vector->GetKind(slot) == Code::STORE_IC);
}
explicit StoreICNexus(Isolate* isolate)
: FeedbackNexus(TypeFeedbackVector::DummyVector(isolate),
TypeFeedbackVector::DummySlot(
TypeFeedbackVector::kDummyStoreICSlot)) {}
StoreICNexus(TypeFeedbackVector* vector, FeedbackVectorICSlot slot)
: FeedbackNexus(vector, slot) {
DCHECK(vector->GetKind(slot) == Code::STORE_IC);
......
......@@ -1166,7 +1166,8 @@ static void Generate_PushAppliedArguments(MacroAssembler* masm,
__ movp(receiver, Operand(rbp, argumentsOffset)); // load arguments
// Use inline caching to speed up access to arguments.
FeedbackVectorSpec spec(0, Code::KEYED_LOAD_IC);
Code::Kind kinds[] = {Code::KEYED_LOAD_IC};
FeedbackVectorSpec spec(0, 1, kinds);
Handle<TypeFeedbackVector> feedback_vector =
masm->isolate()->factory()->NewTypeFeedbackVector(&spec);
int index = feedback_vector->GetIndex(FeedbackVectorICSlot(0));
......
......@@ -40,7 +40,8 @@ TEST(VectorStructure) {
CHECK_EQ(1, vector->Slots());
CHECK_EQ(0, vector->ICSlots());
FeedbackVectorSpec one_icslot(0, Code::CALL_IC);
ZoneFeedbackVectorSpec one_icslot(zone, 0, 1);
one_icslot.SetKind(0, Code::CALL_IC);
vector = factory->NewTypeFeedbackVector(&one_icslot);
CHECK_EQ(0, vector->Slots());
CHECK_EQ(1, vector->ICSlots());
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment