Index: src/ic/ic.cc |
diff --git a/src/ic/ic.cc b/src/ic/ic.cc |
index 538e377758fe23051d8c3f51db33a767202fa24d..387c1cfc567495f0e731301e63e5800a67cdb70e 100644 |
--- a/src/ic/ic.cc |
+++ b/src/ic/ic.cc |
@@ -495,11 +495,8 @@ void IC::Clear(Isolate* isolate, Address address, |
switch (target->kind()) { |
case Code::LOAD_IC: |
- if (FLAG_vector_ics) return; |
- return LoadIC::Clear(isolate, address, target, constant_pool); |
case Code::KEYED_LOAD_IC: |
- if (FLAG_vector_ics) return; |
- return KeyedLoadIC::Clear(isolate, address, target, constant_pool); |
+ return; |
case Code::STORE_IC: |
return StoreIC::Clear(isolate, address, target, constant_pool); |
case Code::KEYED_STORE_IC: |
@@ -520,18 +517,6 @@ void IC::Clear(Isolate* isolate, Address address, |
} |
-void KeyedLoadIC::Clear(Isolate* isolate, Address address, Code* target, |
- ConstantPoolArray* constant_pool) { |
- DCHECK(!FLAG_vector_ics); |
- if (IsCleared(target)) return; |
- |
- // Make sure to also clear the map used in inline fast cases. If we |
- // do not clear these maps, cached code can keep objects alive |
- // through the embedded maps. |
- SetTargetAtAddress(address, *pre_monomorphic_stub(isolate), constant_pool); |
-} |
- |
- |
void KeyedLoadIC::Clear(Isolate* isolate, Code* host, KeyedLoadICNexus* nexus) { |
if (IsCleared(nexus)) return; |
// Make sure to also clear the map used in inline fast cases. If we |
@@ -556,16 +541,6 @@ void CallIC::Clear(Isolate* isolate, Code* host, CallICNexus* nexus) { |
} |
-void LoadIC::Clear(Isolate* isolate, Address address, Code* target, |
- ConstantPoolArray* constant_pool) { |
- DCHECK(!FLAG_vector_ics); |
- if (IsCleared(target)) return; |
- Code* code = PropertyICCompiler::FindPreMonomorphic(isolate, Code::LOAD_IC, |
- target->extra_ic_state()); |
- SetTargetAtAddress(address, code, constant_pool); |
-} |
- |
- |
void LoadIC::Clear(Isolate* isolate, Code* host, LoadICNexus* nexus) { |
if (IsCleared(nexus)) return; |
State state = nexus->StateFromFeedback(); |
@@ -941,78 +916,29 @@ void IC::PatchCache(Handle<Name> name, Handle<Code> code) { |
Handle<Code> LoadIC::initialize_stub(Isolate* isolate, |
ExtraICState extra_state) { |
- if (FLAG_vector_ics) { |
- return LoadICTrampolineStub(isolate, LoadICState(extra_state)).GetCode(); |
- } |
- |
- return PropertyICCompiler::ComputeLoad(isolate, UNINITIALIZED, extra_state); |
-} |
- |
- |
-Handle<Code> LoadIC::load_global(Isolate* isolate, Handle<GlobalObject> global, |
- Handle<String> name) { |
- // This special IC doesn't work with vector ics. |
- DCHECK(!FLAG_vector_ics); |
- |
- Handle<ScriptContextTable> script_contexts( |
- global->native_context()->script_context_table()); |
- |
- ScriptContextTable::LookupResult lookup_result; |
- if (ScriptContextTable::Lookup(script_contexts, name, &lookup_result)) { |
- return initialize_stub(isolate, LoadICState(CONTEXTUAL).GetExtraICState()); |
- } |
- |
- Handle<Map> global_map(global->map()); |
- Handle<Code> handler = PropertyHandlerCompiler::Find( |
- name, global_map, Code::LOAD_IC, kCacheOnReceiver, Code::NORMAL); |
- if (handler.is_null()) { |
- LookupIterator it(global, name); |
- if (!it.IsFound() || !it.GetHolder<JSObject>().is_identical_to(global) || |
- it.state() != LookupIterator::DATA) { |
- return initialize_stub(isolate, |
- LoadICState(CONTEXTUAL).GetExtraICState()); |
- } |
- NamedLoadHandlerCompiler compiler(isolate, global_map, global, |
- kCacheOnReceiver); |
- Handle<PropertyCell> cell = it.GetPropertyCell(); |
- handler = compiler.CompileLoadGlobal(cell, name, it.IsConfigurable()); |
- Map::UpdateCodeCache(global_map, name, handler); |
- } |
- return PropertyICCompiler::ComputeMonomorphic( |
- Code::LOAD_IC, name, handle(global->map()), handler, |
- LoadICState(CONTEXTUAL).GetExtraICState()); |
+ return LoadICTrampolineStub(isolate, LoadICState(extra_state)).GetCode(); |
} |
Handle<Code> LoadIC::initialize_stub_in_optimized_code( |
Isolate* isolate, ExtraICState extra_state, State initialization_state) { |
- if (FLAG_vector_ics) { |
- return VectorRawLoadStub(isolate, LoadICState(extra_state)).GetCode(); |
- } |
- return PropertyICCompiler::ComputeLoad(isolate, initialization_state, |
- extra_state); |
+ return VectorRawLoadStub(isolate, LoadICState(extra_state)).GetCode(); |
} |
Handle<Code> KeyedLoadIC::initialize_stub(Isolate* isolate) { |
- if (FLAG_vector_ics) { |
- return KeyedLoadICTrampolineStub(isolate).GetCode(); |
- } |
- |
- return isolate->builtins()->KeyedLoadIC_Initialize(); |
+ return KeyedLoadICTrampolineStub(isolate).GetCode(); |
} |
Handle<Code> KeyedLoadIC::initialize_stub_in_optimized_code( |
Isolate* isolate, State initialization_state) { |
- if (FLAG_vector_ics && initialization_state != MEGAMORPHIC) { |
+ if (initialization_state != MEGAMORPHIC) { |
return VectorRawKeyedLoadStub(isolate).GetCode(); |
} |
switch (initialization_state) { |
case UNINITIALIZED: |
return isolate->builtins()->KeyedLoadIC_Initialize(); |
- case PREMONOMORPHIC: |
- return isolate->builtins()->KeyedLoadIC_PreMonomorphic(); |
case MEGAMORPHIC: |
return isolate->builtins()->KeyedLoadIC_Megamorphic(); |
default: |
@@ -1046,35 +972,8 @@ Handle<Code> KeyedStoreIC::initialize_stub(Isolate* isolate, |
Handle<Code> LoadIC::megamorphic_stub() { |
- if (kind() == Code::LOAD_IC) { |
- MegamorphicLoadStub stub(isolate(), LoadICState(extra_ic_state())); |
- return stub.GetCode(); |
- } else { |
- DCHECK_EQ(Code::KEYED_LOAD_IC, kind()); |
- return KeyedLoadIC::ChooseMegamorphicStub(isolate()); |
- } |
-} |
- |
- |
-Handle<Code> LoadIC::pre_monomorphic_stub(Isolate* isolate, |
- ExtraICState extra_state) { |
- DCHECK(!FLAG_vector_ics); |
- return PropertyICCompiler::ComputeLoad(isolate, PREMONOMORPHIC, extra_state); |
-} |
- |
- |
-Handle<Code> KeyedLoadIC::pre_monomorphic_stub(Isolate* isolate) { |
- return isolate->builtins()->KeyedLoadIC_PreMonomorphic(); |
-} |
- |
- |
-Handle<Code> LoadIC::pre_monomorphic_stub() const { |
- if (kind() == Code::LOAD_IC) { |
- return LoadIC::pre_monomorphic_stub(isolate(), extra_ic_state()); |
- } else { |
- DCHECK_EQ(Code::KEYED_LOAD_IC, kind()); |
- return KeyedLoadIC::pre_monomorphic_stub(isolate()); |
- } |
+ DCHECK_EQ(Code::KEYED_LOAD_IC, kind()); |
+ return KeyedLoadIC::ChooseMegamorphicStub(isolate()); |
} |
@@ -1088,11 +987,7 @@ void LoadIC::UpdateCaches(LookupIterator* lookup) { |
if (state() == UNINITIALIZED) { |
// This is the first time we execute this inline cache. Set the target to |
// the pre monomorphic stub to delay setting the monomorphic state. |
- if (UseVector()) { |
- ConfigureVectorState(PREMONOMORPHIC); |
- } else { |
- set_target(*pre_monomorphic_stub()); |
- } |
+ ConfigureVectorState(PREMONOMORPHIC); |
TRACE_IC("LoadIC", lookup->name()); |
return; |
} |
@@ -1360,13 +1255,10 @@ Handle<Code> KeyedLoadIC::LoadElementStub(Handle<HeapObject> receiver) { |
if (target_receiver_maps.length() == 0) { |
- if (FLAG_vector_ics) { |
- Handle<Code> handler = |
- PropertyICCompiler::ComputeKeyedLoadMonomorphicHandler(receiver_map); |
- ConfigureVectorState(Handle<Name>::null(), receiver_map, handler); |
- return null_handle; |
- } |
- return PropertyICCompiler::ComputeKeyedLoadMonomorphic(receiver_map); |
+ Handle<Code> handler = |
+ PropertyICCompiler::ComputeKeyedLoadMonomorphicHandler(receiver_map); |
+ ConfigureVectorState(Handle<Name>::null(), receiver_map, handler); |
+ return null_handle; |
} |
// The first time a receiver is seen that is a transitioned version of the |
@@ -1380,13 +1272,10 @@ Handle<Code> KeyedLoadIC::LoadElementStub(Handle<HeapObject> receiver) { |
IsMoreGeneralElementsKindTransition( |
target_receiver_maps.at(0)->elements_kind(), |
Handle<JSObject>::cast(receiver)->GetElementsKind())) { |
- if (FLAG_vector_ics) { |
- Handle<Code> handler = |
- PropertyICCompiler::ComputeKeyedLoadMonomorphicHandler(receiver_map); |
- ConfigureVectorState(Handle<Name>::null(), receiver_map, handler); |
- return null_handle; |
- } |
- return PropertyICCompiler::ComputeKeyedLoadMonomorphic(receiver_map); |
+ Handle<Code> handler = |
+ PropertyICCompiler::ComputeKeyedLoadMonomorphicHandler(receiver_map); |
+ ConfigureVectorState(Handle<Name>::null(), receiver_map, handler); |
+ return null_handle; |
} |
DCHECK(state() != GENERIC); |
@@ -1407,16 +1296,11 @@ Handle<Code> KeyedLoadIC::LoadElementStub(Handle<HeapObject> receiver) { |
return megamorphic_stub(); |
} |
- if (FLAG_vector_ics) { |
- CodeHandleList handlers(target_receiver_maps.length()); |
- ElementHandlerCompiler compiler(isolate()); |
- compiler.CompileElementHandlers(&target_receiver_maps, &handlers); |
- ConfigureVectorState(Handle<Name>::null(), &target_receiver_maps, |
- &handlers); |
- return null_handle; |
- } |
- |
- return PropertyICCompiler::ComputeKeyedLoadPolymorphic(&target_receiver_maps); |
+ CodeHandleList handlers(target_receiver_maps.length()); |
+ ElementHandlerCompiler compiler(isolate()); |
+ compiler.CompileElementHandlers(&target_receiver_maps, &handlers); |
+ ConfigureVectorState(Handle<Name>::null(), &target_receiver_maps, &handlers); |
+ return null_handle; |
} |
@@ -2369,31 +2253,22 @@ RUNTIME_FUNCTION(LoadIC_Miss) { |
Handle<Name> key = args.at<Name>(1); |
Handle<Object> result; |
- if (FLAG_vector_ics) { |
- DCHECK(args.length() == 4); |
- Handle<Smi> slot = args.at<Smi>(2); |
- Handle<TypeFeedbackVector> vector = args.at<TypeFeedbackVector>(3); |
- FeedbackVectorICSlot vector_slot = vector->ToICSlot(slot->value()); |
- // 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) { |
- 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); |
- KeyedLoadICNexus nexus(vector, vector_slot); |
- KeyedLoadIC ic(IC::NO_EXTRA_FRAME, isolate, &nexus); |
- ic.UpdateState(receiver, key); |
- ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, result, |
- ic.Load(receiver, key)); |
- } |
+ DCHECK(args.length() == 4); |
+ Handle<Smi> slot = args.at<Smi>(2); |
+ Handle<TypeFeedbackVector> vector = args.at<TypeFeedbackVector>(3); |
+ FeedbackVectorICSlot vector_slot = vector->ToICSlot(slot->value()); |
+ // 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) { |
+ 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(args.length() == 2); |
- LoadIC ic(IC::NO_EXTRA_FRAME, isolate); |
+ DCHECK(vector->GetKind(vector_slot) == Code::KEYED_LOAD_IC); |
+ KeyedLoadICNexus nexus(vector, vector_slot); |
+ KeyedLoadIC ic(IC::NO_EXTRA_FRAME, isolate, &nexus); |
ic.UpdateState(receiver, key); |
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, result, ic.Load(receiver, key)); |
} |
@@ -2409,22 +2284,14 @@ RUNTIME_FUNCTION(KeyedLoadIC_Miss) { |
Handle<Object> key = args.at<Object>(1); |
Handle<Object> result; |
- if (FLAG_vector_ics) { |
- DCHECK(args.length() == 4); |
- Handle<Smi> slot = args.at<Smi>(2); |
- Handle<TypeFeedbackVector> vector = args.at<TypeFeedbackVector>(3); |
- FeedbackVectorICSlot vector_slot = vector->ToICSlot(slot->value()); |
- KeyedLoadICNexus nexus(vector, vector_slot); |
- KeyedLoadIC ic(IC::NO_EXTRA_FRAME, isolate, &nexus); |
- ic.UpdateState(receiver, key); |
- ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, result, ic.Load(receiver, key)); |
- } else { |
- DCHECK(args.length() == 2); |
- KeyedLoadIC ic(IC::NO_EXTRA_FRAME, isolate); |
- ic.UpdateState(receiver, key); |
- ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, result, ic.Load(receiver, key)); |
- } |
- |
+ DCHECK(args.length() == 4); |
+ Handle<Smi> slot = args.at<Smi>(2); |
+ Handle<TypeFeedbackVector> vector = args.at<TypeFeedbackVector>(3); |
+ FeedbackVectorICSlot vector_slot = vector->ToICSlot(slot->value()); |
+ KeyedLoadICNexus nexus(vector, vector_slot); |
+ KeyedLoadIC ic(IC::NO_EXTRA_FRAME, isolate, &nexus); |
+ ic.UpdateState(receiver, key); |
+ ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, result, ic.Load(receiver, key)); |
return *result; |
} |
@@ -2436,21 +2303,14 @@ RUNTIME_FUNCTION(KeyedLoadIC_MissFromStubFailure) { |
Handle<Object> key = args.at<Object>(1); |
Handle<Object> result; |
- if (FLAG_vector_ics) { |
- DCHECK(args.length() == 4); |
- Handle<Smi> slot = args.at<Smi>(2); |
- Handle<TypeFeedbackVector> vector = args.at<TypeFeedbackVector>(3); |
- FeedbackVectorICSlot vector_slot = vector->ToICSlot(slot->value()); |
- KeyedLoadICNexus nexus(vector, vector_slot); |
- KeyedLoadIC ic(IC::EXTRA_CALL_FRAME, isolate, &nexus); |
- ic.UpdateState(receiver, key); |
- ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, result, ic.Load(receiver, key)); |
- } else { |
- DCHECK(args.length() == 2); |
- KeyedLoadIC ic(IC::EXTRA_CALL_FRAME, isolate); |
- ic.UpdateState(receiver, key); |
- ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, result, ic.Load(receiver, key)); |
- } |
+ DCHECK(args.length() == 4); |
+ Handle<Smi> slot = args.at<Smi>(2); |
+ Handle<TypeFeedbackVector> vector = args.at<TypeFeedbackVector>(3); |
+ FeedbackVectorICSlot vector_slot = vector->ToICSlot(slot->value()); |
+ KeyedLoadICNexus nexus(vector, vector_slot); |
+ KeyedLoadIC ic(IC::EXTRA_CALL_FRAME, isolate, &nexus); |
+ ic.UpdateState(receiver, key); |
+ ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, result, ic.Load(receiver, key)); |
return *result; |
} |
@@ -3018,31 +2878,22 @@ RUNTIME_FUNCTION(LoadIC_MissFromStubFailure) { |
Handle<Name> key = args.at<Name>(1); |
Handle<Object> result; |
- if (FLAG_vector_ics) { |
- DCHECK(args.length() == 4); |
- Handle<Smi> slot = args.at<Smi>(2); |
- Handle<TypeFeedbackVector> vector = args.at<TypeFeedbackVector>(3); |
- FeedbackVectorICSlot vector_slot = vector->ToICSlot(slot->value()); |
- // 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) { |
- 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); |
- KeyedLoadICNexus nexus(vector, vector_slot); |
- KeyedLoadIC ic(IC::EXTRA_CALL_FRAME, isolate, &nexus); |
- ic.UpdateState(receiver, key); |
- ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, result, |
- ic.Load(receiver, key)); |
- } |
+ DCHECK(args.length() == 4); |
+ Handle<Smi> slot = args.at<Smi>(2); |
+ Handle<TypeFeedbackVector> vector = args.at<TypeFeedbackVector>(3); |
+ FeedbackVectorICSlot vector_slot = vector->ToICSlot(slot->value()); |
+ // 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) { |
+ 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(args.length() == 2); |
- LoadIC ic(IC::EXTRA_CALL_FRAME, isolate); |
+ DCHECK(vector->GetKind(vector_slot) == Code::KEYED_LOAD_IC); |
+ KeyedLoadICNexus nexus(vector, vector_slot); |
+ KeyedLoadIC ic(IC::EXTRA_CALL_FRAME, isolate, &nexus); |
ic.UpdateState(receiver, key); |
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, result, ic.Load(receiver, key)); |
} |