[ics]: Remove deprecated support for patching LoadICs and StoreICs

Review-Url: https://codereview.chromium.org/2593033002
Cr-Commit-Position: refs/heads/master@{#41897}
This commit is contained in:
danno 2016-12-21 08:02:12 -08:00 committed by Commit bot
parent 7c18f1976a
commit 455c244cbd
9 changed files with 50 additions and 240 deletions

View File

@ -376,25 +376,6 @@ HValue* CodeStubGraphBuilderBase::BuildPushElement(HValue* object, HValue* argc,
return new_length;
}
template <>
HValue* CodeStubGraphBuilder<LoadFastElementStub>::BuildCodeStub() {
LoadKeyedHoleMode hole_mode = casted_stub()->convert_hole_to_undefined()
? CONVERT_HOLE_TO_UNDEFINED
: NEVER_RETURN_HOLE;
HInstruction* load = BuildUncheckedMonomorphicElementAccess(
GetParameter(Descriptor::kReceiver), GetParameter(Descriptor::kName),
NULL, casted_stub()->is_js_array(), casted_stub()->elements_kind(), LOAD,
hole_mode, STANDARD_STORE);
return load;
}
Handle<Code> LoadFastElementStub::GenerateCode() {
return DoGenerateCode(this);
}
HLoadNamedField* CodeStubGraphBuilderBase::BuildLoadNamedField(
HValue* object, FieldIndex index) {
Representation representation = index.is_double()
@ -799,24 +780,5 @@ HValue* CodeStubGraphBuilder<ToBooleanICStub>::BuildCodeInitializedStub() {
Handle<Code> ToBooleanICStub::GenerateCode() { return DoGenerateCode(this); }
template <>
HValue* CodeStubGraphBuilder<LoadDictionaryElementStub>::BuildCodeStub() {
HValue* receiver = GetParameter(Descriptor::kReceiver);
HValue* key = GetParameter(Descriptor::kName);
Add<HCheckSmi>(key);
HValue* elements = AddLoadElements(receiver);
HValue* hash = BuildElementIndexHash(key);
return BuildUncheckedDictionaryElementLoad(receiver, elements, key, hash);
}
Handle<Code> LoadDictionaryElementStub::GenerateCode() {
return DoGenerateCode(this);
}
} // namespace internal
} // namespace v8

View File

@ -2307,12 +2307,6 @@ void JSEntryStub::FinishCode(Handle<Code> code) {
}
void LoadDictionaryElementStub::InitializeDescriptor(
CodeStubDescriptor* descriptor) {
descriptor->Initialize(
FUNCTION_ADDR(Runtime_KeyedLoadIC_MissFromStubFailure));
}
void HandlerStub::InitializeDescriptor(CodeStubDescriptor* descriptor) {
DCHECK(kind() == Code::LOAD_IC || kind() == Code::KEYED_LOAD_IC);
if (kind() == Code::KEYED_LOAD_IC) {

View File

@ -68,8 +68,6 @@ class Node;
/* as part of the new IC system, ask */ \
/* ishell before doing anything */ \
V(LoadConstant) \
V(LoadDictionaryElement) \
V(LoadFastElement) \
V(LoadField) \
/* These should never be ported to TF */ \
/* because they are either used only by */ \
@ -1926,15 +1924,6 @@ class StringCharAtGenerator {
};
class LoadDictionaryElementStub : public HydrogenCodeStub {
public:
explicit LoadDictionaryElementStub(Isolate* isolate)
: HydrogenCodeStub(isolate) {}
DEFINE_CALL_INTERFACE_DESCRIPTOR(LoadWithVector);
DEFINE_HYDROGEN_CODE_STUB(LoadDictionaryElement, HydrogenCodeStub);
};
class LoadICTrampolineStub : public TurboFanCodeStub {
public:
explicit LoadICTrampolineStub(Isolate* isolate) : TurboFanCodeStub(isolate) {}
@ -2239,39 +2228,6 @@ class StoreScriptContextFieldStub : public ScriptContextFieldStub {
DEFINE_TURBOFAN_CODE_STUB(StoreScriptContextField, ScriptContextFieldStub);
};
class LoadFastElementStub : public HandlerStub {
public:
LoadFastElementStub(Isolate* isolate, bool is_js_array,
ElementsKind elements_kind,
bool convert_hole_to_undefined = false)
: HandlerStub(isolate) {
set_sub_minor_key(
ElementsKindBits::encode(elements_kind) |
IsJSArrayBits::encode(is_js_array) |
CanConvertHoleToUndefined::encode(convert_hole_to_undefined));
}
Code::Kind kind() const override { return Code::KEYED_LOAD_IC; }
bool is_js_array() const { return IsJSArrayBits::decode(sub_minor_key()); }
bool convert_hole_to_undefined() const {
return CanConvertHoleToUndefined::decode(sub_minor_key());
}
ElementsKind elements_kind() const {
return ElementsKindBits::decode(sub_minor_key());
}
private:
class ElementsKindBits: public BitField<ElementsKind, 0, 8> {};
class IsJSArrayBits: public BitField<bool, 8, 1> {};
class CanConvertHoleToUndefined : public BitField<bool, 9, 1> {};
DEFINE_CALL_INTERFACE_DESCRIPTOR(LoadWithVector);
DEFINE_HANDLER_CODE_STUB(LoadFastElement, HandlerStub);
};
class StoreFastElementStub : public TurboFanCodeStub {
public:
StoreFastElementStub(Isolate* isolate, bool is_js_array,

View File

@ -751,8 +751,6 @@ class RuntimeCallTimer final {
V(KeyedLoadIC_LoadIndexedInterceptorStub) \
V(KeyedLoadIC_KeyedLoadSloppyArgumentsStub) \
V(KeyedLoadIC_LoadElementDH) \
V(KeyedLoadIC_LoadFastElementStub) \
V(KeyedLoadIC_LoadDictionaryElementStub) \
V(KeyedLoadIC_SlowStub) \
V(KeyedStoreIC_ElementsTransitionAndStoreStub) \
V(KeyedStoreIC_KeyedStoreSloppyArgumentsStub) \
@ -779,7 +777,6 @@ class RuntimeCallTimer final {
V(LoadIC_LoadFieldDH) \
V(LoadIC_LoadFieldFromPrototypeDH) \
V(LoadIC_LoadField) \
V(LoadIC_LoadFieldStub) \
V(LoadIC_LoadGlobal) \
V(LoadIC_LoadInterceptor) \
V(LoadIC_LoadNonexistentDH) \

View File

@ -2797,7 +2797,6 @@ class HOptimizedGraphBuilder : public HGraphBuilder,
friend class FunctionState; // Pushes and pops the state stack.
friend class AstContext; // Pushes and pops the AST context stack.
friend class KeyedLoadFastElementStub;
friend class HOsrBuilder;
DISALLOW_COPY_AND_ASSIGN(HOptimizedGraphBuilder);

View File

@ -818,8 +818,6 @@ DEFINE_BOOL(use_ic, true, "use inline caching")
DEFINE_BOOL(trace_ic, false, "trace inline cache state transitions")
DEFINE_INT(ic_stats, 0, "inline cache state transitions statistics")
DEFINE_VALUE_IMPLICATION(trace_ic, ic_stats, 1)
DEFINE_BOOL_READONLY(tf_load_ic_stub, true, "use TF LoadIC stub")
DEFINE_BOOL(tf_store_ic_stub, true, "use TF StoreIC stub")
// macro-assembler-ia32.cc
DEFINE_BOOL(native_code_counters, false,

View File

@ -220,7 +220,7 @@ void FullCodeGenerator::CallLoadIC(FeedbackVectorSlot slot,
Handle<Code> code = CodeFactory::LoadIC(isolate()).code();
__ Call(code, RelocInfo::CODE_TARGET);
if (FLAG_tf_load_ic_stub) RestoreContext();
RestoreContext();
}
void FullCodeGenerator::CallStoreIC(FeedbackVectorSlot slot,

View File

@ -640,13 +640,8 @@ Handle<Object> ElementHandlerCompiler::GetKeyedLoadHandler(
}
bool is_js_array = instance_type == JS_ARRAY_TYPE;
if (elements_kind == DICTIONARY_ELEMENTS) {
if (FLAG_tf_load_ic_stub) {
TRACE_HANDLER_STATS(isolate, KeyedLoadIC_LoadElementDH);
return LoadHandler::LoadElement(isolate, elements_kind, false,
is_js_array);
}
TRACE_HANDLER_STATS(isolate, KeyedLoadIC_LoadDictionaryElementStub);
return LoadDictionaryElementStub(isolate).GetCode();
TRACE_HANDLER_STATS(isolate, KeyedLoadIC_LoadElementDH);
return LoadHandler::LoadElement(isolate, elements_kind, false, is_js_array);
}
DCHECK(IsFastElementsKind(elements_kind) ||
IsFixedTypedArrayElementsKind(elements_kind));
@ -654,16 +649,9 @@ Handle<Object> ElementHandlerCompiler::GetKeyedLoadHandler(
bool convert_hole_to_undefined =
is_js_array && elements_kind == FAST_HOLEY_ELEMENTS &&
*receiver_map == isolate->get_initial_js_array_map(elements_kind);
if (FLAG_tf_load_ic_stub) {
TRACE_HANDLER_STATS(isolate, KeyedLoadIC_LoadElementDH);
return LoadHandler::LoadElement(isolate, elements_kind,
convert_hole_to_undefined, is_js_array);
} else {
TRACE_HANDLER_STATS(isolate, KeyedLoadIC_LoadFastElementStub);
return LoadFastElementStub(isolate, is_js_array, elements_kind,
convert_hole_to_undefined)
.GetCode();
}
TRACE_HANDLER_STATS(isolate, KeyedLoadIC_LoadElementDH);
return LoadHandler::LoadElement(isolate, elements_kind,
convert_hole_to_undefined, is_js_array);
}
void ElementHandlerCompiler::CompileElementHandlers(

View File

@ -884,13 +884,8 @@ void IC::PatchCache(Handle<Name> name, Handle<Object> handler) {
}
Handle<Object> LoadIC::SimpleFieldLoad(FieldIndex index) {
if (FLAG_tf_load_ic_stub) {
TRACE_HANDLER_STATS(isolate(), LoadIC_LoadFieldDH);
return LoadHandler::LoadField(isolate(), index);
}
TRACE_HANDLER_STATS(isolate(), LoadIC_LoadFieldStub);
LoadFieldStub stub(isolate(), index);
return stub.GetCode();
TRACE_HANDLER_STATS(isolate(), LoadIC_LoadFieldDH);
return LoadHandler::LoadField(isolate(), index);
}
namespace {
@ -1121,15 +1116,8 @@ void LoadIC::UpdateCaches(LookupIterator* lookup) {
code = slow_stub();
} else if (!lookup->IsFound()) {
if (kind() == Code::LOAD_IC || kind() == Code::LOAD_GLOBAL_IC) {
if (FLAG_tf_load_ic_stub) {
TRACE_HANDLER_STATS(isolate(), LoadIC_LoadNonexistentDH);
code = LoadNonExistent(receiver_map(), lookup->name());
} else {
code = NamedLoadHandlerCompiler::ComputeLoadNonexistent(lookup->name(),
receiver_map());
// TODO(jkummerow/verwaest): Introduce a builtin that handles this case.
if (code.is_null()) code = slow_stub();
}
TRACE_HANDLER_STATS(isolate(), LoadIC_LoadNonexistentDH);
code = LoadNonExistent(receiver_map(), lookup->name());
} else {
code = slow_stub();
}
@ -1390,26 +1378,15 @@ Handle<Object> LoadIC::GetMapIndependentHandler(LookupIterator* lookup) {
TRACE_HANDLER_STATS(isolate(), LoadIC_SlowStub);
return slow_stub();
}
if (FLAG_tf_load_ic_stub) {
Handle<Object> smi_handler = LoadHandler::LoadApiGetter(
isolate(), lookup->GetAccessorIndex());
if (receiver_is_holder) {
TRACE_HANDLER_STATS(isolate(), LoadIC_LoadApiGetterDH);
return smi_handler;
}
if (kind() != Code::LOAD_GLOBAL_IC) {
TRACE_HANDLER_STATS(isolate(),
LoadIC_LoadApiGetterFromPrototypeDH);
return LoadFromPrototype(map, holder, lookup->name(),
smi_handler);
}
} else {
if (receiver_is_holder) {
TRACE_HANDLER_STATS(isolate(), LoadIC_LoadApiGetterStub);
int index = lookup->GetAccessorIndex();
LoadApiGetterStub stub(isolate(), true, index);
return stub.GetCode();
}
Handle<Object> smi_handler =
LoadHandler::LoadApiGetter(isolate(), lookup->GetAccessorIndex());
if (receiver_is_holder) {
TRACE_HANDLER_STATS(isolate(), LoadIC_LoadApiGetterDH);
return smi_handler;
}
if (kind() != Code::LOAD_GLOBAL_IC) {
TRACE_HANDLER_STATS(isolate(), LoadIC_LoadApiGetterFromPrototypeDH);
return LoadFromPrototype(map, holder, lookup->name(), smi_handler);
}
break; // Custom-compiled handler.
}
@ -1446,32 +1423,20 @@ Handle<Object> LoadIC::GetMapIndependentHandler(LookupIterator* lookup) {
if (receiver_is_holder) {
return smi_handler;
}
if (FLAG_tf_load_ic_stub) {
TRACE_HANDLER_STATS(isolate(), LoadIC_LoadFieldFromPrototypeDH);
return LoadFromPrototype(map, holder, lookup->name(), smi_handler);
}
break; // Custom-compiled handler.
TRACE_HANDLER_STATS(isolate(), LoadIC_LoadFieldFromPrototypeDH);
return LoadFromPrototype(map, holder, lookup->name(), smi_handler);
}
// -------------- Constant properties --------------
DCHECK(lookup->property_details().type() == DATA_CONSTANT);
if (FLAG_tf_load_ic_stub) {
Handle<Object> smi_handler =
LoadHandler::LoadConstant(isolate(), lookup->GetConstantIndex());
if (receiver_is_holder) {
TRACE_HANDLER_STATS(isolate(), LoadIC_LoadConstantDH);
return smi_handler;
}
TRACE_HANDLER_STATS(isolate(), LoadIC_LoadConstantFromPrototypeDH);
return LoadFromPrototype(map, holder, lookup->name(), smi_handler);
} else {
if (receiver_is_holder) {
TRACE_HANDLER_STATS(isolate(), LoadIC_LoadConstantStub);
LoadConstantStub stub(isolate(), lookup->GetConstantIndex());
return stub.GetCode();
}
Handle<Object> smi_handler =
LoadHandler::LoadConstant(isolate(), lookup->GetConstantIndex());
if (receiver_is_holder) {
TRACE_HANDLER_STATS(isolate(), LoadIC_LoadConstantDH);
return smi_handler;
}
break; // Custom-compiled handler.
TRACE_HANDLER_STATS(isolate(), LoadIC_LoadConstantFromPrototypeDH);
return LoadFromPrototype(map, holder, lookup->name(), smi_handler);
}
case LookupIterator::INTEGER_INDEXED_EXOTIC:
@ -2011,13 +1976,10 @@ Handle<Object> StoreIC::GetMapIndependentHandler(LookupIterator* lookup) {
return slow_stub();
}
DCHECK(lookup->IsCacheableTransition());
if (FLAG_tf_store_ic_stub) {
Handle<Map> transition = lookup->transition_map();
TRACE_HANDLER_STATS(isolate(), StoreIC_StoreTransitionDH);
return StoreTransition(receiver_map(), holder, transition,
lookup->name());
}
break; // Custom-compiled handler.
Handle<Map> transition = lookup->transition_map();
TRACE_HANDLER_STATS(isolate(), StoreIC_StoreTransitionDH);
return StoreTransition(receiver_map(), holder, transition,
lookup->name());
}
case LookupIterator::INTERCEPTOR: {
@ -2094,27 +2056,11 @@ Handle<Object> StoreIC::GetMapIndependentHandler(LookupIterator* lookup) {
// -------------- Fields --------------
if (lookup->property_details().type() == DATA) {
if (FLAG_tf_store_ic_stub) {
TRACE_HANDLER_STATS(isolate(), StoreIC_StoreFieldDH);
int descriptor = lookup->GetFieldDescriptorIndex();
FieldIndex index = lookup->GetFieldIndex();
return StoreHandler::StoreField(isolate(), descriptor, index,
lookup->representation());
} else {
bool use_stub = true;
if (lookup->representation().IsHeapObject()) {
// Only use a generic stub if no types need to be tracked.
Handle<FieldType> field_type = lookup->GetFieldType();
use_stub = !field_type->IsClass();
}
if (use_stub) {
TRACE_HANDLER_STATS(isolate(), StoreIC_StoreFieldStub);
StoreFieldStub stub(isolate(), lookup->GetFieldIndex(),
lookup->representation());
return stub.GetCode();
}
}
break; // Custom-compiled handler.
TRACE_HANDLER_STATS(isolate(), StoreIC_StoreFieldDH);
int descriptor = lookup->GetFieldDescriptorIndex();
FieldIndex index = lookup->GetFieldIndex();
return StoreHandler::StoreField(isolate(), descriptor, index,
lookup->representation());
}
// -------------- Constant properties --------------
@ -2156,15 +2102,7 @@ Handle<Object> StoreIC::CompileHandler(LookupIterator* lookup,
cell->set_value(isolate()->heap()->the_hole_value());
return code;
}
DCHECK(!FLAG_tf_store_ic_stub);
Handle<Map> transition = lookup->transition_map();
// Currently not handled by CompileStoreTransition.
DCHECK(holder->HasFastProperties());
DCHECK(lookup->IsCacheableTransition());
TRACE_HANDLER_STATS(isolate(), StoreIC_StoreTransition);
NamedStoreHandlerCompiler compiler(isolate(), receiver_map(), holder);
return compiler.CompileStoreTransition(transition, lookup->name());
UNREACHABLE();
}
case LookupIterator::INTERCEPTOR:
@ -2212,40 +2150,18 @@ Handle<Object> StoreIC::CompileHandler(LookupIterator* lookup,
}
case LookupIterator::DATA: {
if (lookup->is_dictionary_holder()) {
DCHECK(holder->IsJSGlobalObject());
TRACE_HANDLER_STATS(isolate(), StoreIC_StoreGlobal);
DCHECK(holder.is_identical_to(receiver) ||
receiver->map()->prototype() == *holder);
auto cell = lookup->GetPropertyCell();
auto updated_type =
PropertyCell::UpdatedType(cell, value, lookup->property_details());
auto code = PropertyCellStoreHandler(
isolate(), receiver, Handle<JSGlobalObject>::cast(holder),
lookup->name(), cell, updated_type);
return code;
}
// -------------- Fields --------------
if (lookup->property_details().type() == DATA) {
DCHECK(!FLAG_tf_store_ic_stub);
#ifdef DEBUG
bool use_stub = true;
if (lookup->representation().IsHeapObject()) {
// Only use a generic stub if no types need to be tracked.
Handle<FieldType> field_type = lookup->GetFieldType();
use_stub = !field_type->IsClass();
}
DCHECK(!use_stub);
#endif
TRACE_HANDLER_STATS(isolate(), StoreIC_StoreField);
NamedStoreHandlerCompiler compiler(isolate(), receiver_map(), holder);
return compiler.CompileStoreField(lookup);
}
// -------------- Constant properties --------------
DCHECK(lookup->property_details().type() == DATA_CONSTANT);
UNREACHABLE();
DCHECK(lookup->is_dictionary_holder());
DCHECK(holder->IsJSGlobalObject());
TRACE_HANDLER_STATS(isolate(), StoreIC_StoreGlobal);
DCHECK(holder.is_identical_to(receiver) ||
receiver->map()->prototype() == *holder);
auto cell = lookup->GetPropertyCell();
auto updated_type =
PropertyCell::UpdatedType(cell, value, lookup->property_details());
auto code = PropertyCellStoreHandler(isolate(), receiver,
Handle<JSGlobalObject>::cast(holder),
lookup->name(), cell, updated_type);
return code;
}
case LookupIterator::INTEGER_INDEXED_EXOTIC: