[turbofan] Cleanup PropertyAccessInfos serialization

Bug: v8:7790
Change-Id: I5659dd0fd9cc9eb6c129dbdafbc678d6c62289c9
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1763528
Commit-Queue: Maya Lekova <mslekova@chromium.org>
Commit-Queue: Georg Neis <neis@chromium.org>
Reviewed-by: Georg Neis <neis@chromium.org>
Auto-Submit: Maya Lekova <mslekova@chromium.org>
Cr-Commit-Position: refs/heads/master@{#63305}
This commit is contained in:
Maya Lekova 2019-08-21 11:38:29 +02:00 committed by Commit Bot
parent 3c948f1cd5
commit 688b702eb6
6 changed files with 31 additions and 104 deletions

View File

@ -7119,8 +7119,9 @@ Reduction JSCallReducer::ReduceRegExpPrototypeTest(Node* node) {
// Obtain precomputed access infos from the broker. // Obtain precomputed access infos from the broker.
for (auto map : regexp_maps) { for (auto map : regexp_maps) {
MapRef map_ref(broker(), map); MapRef map_ref(broker(), map);
PropertyAccessInfo access_info = PropertyAccessInfo access_info = broker()->GetPropertyAccessInfo(
broker()->GetAccessInfoForLoadingExec(map_ref); map_ref, NameRef(broker(), isolate()->factory()->exec_string()),
AccessMode::kLoad);
access_infos.push_back(access_info); access_infos.push_back(access_info);
} }
} else { } else {

View File

@ -2204,9 +2204,6 @@ JSHeapBroker::JSHeapBroker(Isolate* isolate, Zone* broker_zone,
tracing_enabled_(tracing_enabled), tracing_enabled_(tracing_enabled),
feedback_(zone()), feedback_(zone()),
bytecode_analyses_(zone()), bytecode_analyses_(zone()),
ais_for_loading_exec_(zone()),
ais_for_loading_has_instance_(zone()),
ais_for_loading_then_(zone()),
property_access_infos_(zone()), property_access_infos_(zone()),
typed_array_string_tags_(zone()) { typed_array_string_tags_(zone()) {
// Note that this initialization of the refs_ pointer with the minimal // Note that this initialization of the refs_ pointer with the minimal
@ -4533,72 +4530,6 @@ base::Optional<NameRef> JSHeapBroker::GetNameFeedback(
return NameRef(this, handle(raw_name, isolate())); return NameRef(this, handle(raw_name, isolate()));
} }
PropertyAccessInfo JSHeapBroker::GetAccessInfoForLoadingThen(MapRef map) {
auto access_info = ais_for_loading_then_.find(map);
if (access_info == ais_for_loading_then_.end()) {
TRACE_BROKER_MISSING(this,
"access info for property 'then' on map " << map);
return PropertyAccessInfo::Invalid(zone());
}
return access_info->second;
}
PropertyAccessInfo JSHeapBroker::GetAccessInfoForLoadingHasInstance(
MapRef map) {
auto access_info = ais_for_loading_has_instance_.find(map);
if (access_info == ais_for_loading_has_instance_.end()) {
TRACE_BROKER_MISSING(
this, "access info for property Symbol.hasInstance on map " << map);
return PropertyAccessInfo::Invalid(zone());
}
return access_info->second;
}
PropertyAccessInfo JSHeapBroker::GetAccessInfoForLoadingExec(MapRef map) {
auto access_info = ais_for_loading_exec_.find(map);
if (access_info == ais_for_loading_exec_.end()) {
TRACE_BROKER_MISSING(this,
"access info for property 'exec' on map " << map);
return PropertyAccessInfo::Invalid(zone());
}
return access_info->second;
}
void JSHeapBroker::CreateAccessInfoForLoadingThen(
MapRef map, CompilationDependencies* dependencies) {
auto access_info = ais_for_loading_then_.find(map);
if (access_info == ais_for_loading_then_.end()) {
AccessInfoFactory access_info_factory(this, dependencies, zone());
Handle<Name> then_string = isolate()->factory()->then_string();
ais_for_loading_then_.insert(
std::make_pair(map, access_info_factory.ComputePropertyAccessInfo(
map.object(), then_string, AccessMode::kLoad)));
}
}
PropertyAccessInfo const& JSHeapBroker::CreateAccessInfoForLoadingHasInstance(
MapRef map, CompilationDependencies* dependencies) {
auto it = ais_for_loading_has_instance_.find(map);
if (it != ais_for_loading_has_instance_.end()) return it->second;
AccessInfoFactory access_info_factory(this, dependencies, zone());
auto access_info = access_info_factory.ComputePropertyAccessInfo(
map.object(), isolate()->factory()->has_instance_symbol(),
AccessMode::kLoad);
return ais_for_loading_has_instance_.insert({map, access_info}).first->second;
}
PropertyAccessInfo const& JSHeapBroker::CreateAccessInfoForLoadingExec(
MapRef map, CompilationDependencies* dependencies) {
auto it = ais_for_loading_exec_.find(map);
if (it != ais_for_loading_exec_.end()) return it->second;
AccessInfoFactory access_info_factory(this, dependencies, zone());
auto access_info = access_info_factory.ComputePropertyAccessInfo(
map.object(), isolate()->factory()->exec_string(), AccessMode::kLoad);
return ais_for_loading_exec_.insert({map, access_info}).first->second;
}
PropertyAccessInfo JSHeapBroker::GetPropertyAccessInfo( PropertyAccessInfo JSHeapBroker::GetPropertyAccessInfo(
MapRef map, NameRef name, AccessMode access_mode, MapRef map, NameRef name, AccessMode access_mode,
CompilationDependencies* dependencies, SerializationPolicy policy) { CompilationDependencies* dependencies, SerializationPolicy policy) {
@ -4613,6 +4544,7 @@ PropertyAccessInfo JSHeapBroker::GetPropertyAccessInfo(
return PropertyAccessInfo::Invalid(zone()); return PropertyAccessInfo::Invalid(zone());
} }
CHECK_NOT_NULL(dependencies);
AccessInfoFactory factory(this, dependencies, zone()); AccessInfoFactory factory(this, dependencies, zone());
PropertyAccessInfo access_info = factory.ComputePropertyAccessInfo( PropertyAccessInfo access_info = factory.ComputePropertyAccessInfo(
map.object(), name.object(), access_mode); map.object(), name.object(), access_mode);

View File

@ -167,22 +167,11 @@ class V8_EXPORT_PRIVATE JSHeapBroker {
base::Optional<NameRef> GetNameFeedback(FeedbackNexus const& nexus); base::Optional<NameRef> GetNameFeedback(FeedbackNexus const& nexus);
// If there is no result stored for {map}, we return an Invalid // If {policy} is {kAssumeSerialized} and the broker doesn't know about the
// PropertyAccessInfo. // combination of {map}, {name}, and {access_mode}, returns Invalid.
PropertyAccessInfo GetAccessInfoForLoadingExec(MapRef map);
PropertyAccessInfo GetAccessInfoForLoadingHasInstance(MapRef map);
PropertyAccessInfo GetAccessInfoForLoadingThen(MapRef map);
PropertyAccessInfo const& CreateAccessInfoForLoadingExec(
MapRef map, CompilationDependencies* dependencies);
PropertyAccessInfo const& CreateAccessInfoForLoadingHasInstance(
MapRef map, CompilationDependencies* dependencies);
void CreateAccessInfoForLoadingThen(MapRef map,
CompilationDependencies* dependencies);
void StorePropertyAccessInfo(MapRef map, NameRef name, AccessMode mode,
PropertyAccessInfo const& access_info);
PropertyAccessInfo GetPropertyAccessInfo( PropertyAccessInfo GetPropertyAccessInfo(
MapRef map, NameRef name, AccessMode access_mode, MapRef map, NameRef name, AccessMode access_mode,
CompilationDependencies* dependencies, CompilationDependencies* dependencies = nullptr,
SerializationPolicy policy = SerializationPolicy::kAssumeSerialized); SerializationPolicy policy = SerializationPolicy::kAssumeSerialized);
StringRef GetTypedArrayStringTag(ElementsKind kind); StringRef GetTypedArrayStringTag(ElementsKind kind);
@ -234,15 +223,6 @@ class V8_EXPORT_PRIVATE JSHeapBroker {
FeedbackSource::Hash, FeedbackSource::Equal> FeedbackSource::Hash, FeedbackSource::Equal>
feedback_; feedback_;
ZoneUnorderedMap<ObjectData*, BytecodeAnalysis*> bytecode_analyses_; ZoneUnorderedMap<ObjectData*, BytecodeAnalysis*> bytecode_analyses_;
typedef ZoneUnorderedMap<MapRef, PropertyAccessInfo, ObjectRef::Hash,
ObjectRef::Equal>
MapToAccessInfos;
// TODO(neis): Replaceby uses of property_access_infos_.
MapToAccessInfos ais_for_loading_exec_;
MapToAccessInfos ais_for_loading_has_instance_;
MapToAccessInfos ais_for_loading_then_;
ZoneUnorderedMap<PropertyAccessTarget, PropertyAccessInfo, ZoneUnorderedMap<PropertyAccessTarget, PropertyAccessInfo,
PropertyAccessTarget::Hash, PropertyAccessTarget::Equal> PropertyAccessTarget::Hash, PropertyAccessTarget::Equal>
property_access_infos_; property_access_infos_;

View File

@ -25,6 +25,8 @@ JSIntrinsicLowering::JSIntrinsicLowering(Editor* editor, JSGraph* jsgraph)
: AdvancedReducer(editor), jsgraph_(jsgraph) {} : AdvancedReducer(editor), jsgraph_(jsgraph) {}
Reduction JSIntrinsicLowering::Reduce(Node* node) { Reduction JSIntrinsicLowering::Reduce(Node* node) {
DisallowHeapAccessIf no_heap_access(FLAG_concurrent_inlining);
if (node->opcode() != IrOpcode::kJSCallRuntime) return NoChange(); if (node->opcode() != IrOpcode::kJSCallRuntime) return NoChange();
const Runtime::Function* const f = const Runtime::Function* const f =
Runtime::FunctionForId(CallRuntimeParametersOf(node->op()).id()); Runtime::FunctionForId(CallRuntimeParametersOf(node->op()).id());

View File

@ -407,7 +407,10 @@ Reduction JSNativeContextSpecialization::ReduceJSInstanceOf(Node* node) {
PropertyAccessInfo access_info = PropertyAccessInfo::Invalid(graph()->zone()); PropertyAccessInfo access_info = PropertyAccessInfo::Invalid(graph()->zone());
if (FLAG_concurrent_inlining) { if (FLAG_concurrent_inlining) {
access_info = broker()->GetAccessInfoForLoadingHasInstance(receiver_map); access_info = broker()->GetPropertyAccessInfo(
receiver_map,
NameRef(broker(), isolate()->factory()->has_instance_symbol()),
AccessMode::kLoad);
} else { } else {
AccessInfoFactory access_info_factory(broker(), dependencies(), AccessInfoFactory access_info_factory(broker(), dependencies(),
graph()->zone()); graph()->zone());
@ -714,7 +717,9 @@ Reduction JSNativeContextSpecialization::ReduceJSResolvePromise(Node* node) {
// Obtain pre-computed access infos from the broker. // Obtain pre-computed access infos from the broker.
for (auto map : resolution_maps) { for (auto map : resolution_maps) {
MapRef map_ref(broker(), map); MapRef map_ref(broker(), map);
access_infos.push_back(broker()->GetAccessInfoForLoadingThen(map_ref)); access_infos.push_back(broker()->GetPropertyAccessInfo(
map_ref, NameRef(broker(), isolate()->factory()->then_string()),
AccessMode::kLoad));
} }
} }
PropertyAccessInfo access_info = PropertyAccessInfo access_info =

View File

@ -1911,8 +1911,11 @@ void SerializerForBackgroundCompilation::ProcessHintsForHasInPrototypeChain(
void SerializerForBackgroundCompilation::ProcessHintsForPromiseResolve( void SerializerForBackgroundCompilation::ProcessHintsForPromiseResolve(
Hints const& resolution_hints) { Hints const& resolution_hints) {
auto processMap = [&](Handle<Map> map) { auto processMap = [&](Handle<Map> map) {
broker()->CreateAccessInfoForLoadingThen(MapRef(broker(), map), broker()->GetPropertyAccessInfo(
dependencies()); MapRef(broker(), map),
NameRef(broker(), broker()->isolate()->factory()->then_string()),
AccessMode::kLoad, dependencies(),
SerializationPolicy::kSerializeIfNeeded);
}; };
for (auto hint : resolution_hints.constants()) { for (auto hint : resolution_hints.constants()) {
@ -1942,8 +1945,10 @@ void SerializerForBackgroundCompilation::ProcessMapHintsForPromises(
PropertyAccessInfo SerializerForBackgroundCompilation::ProcessMapForRegExpTest( PropertyAccessInfo SerializerForBackgroundCompilation::ProcessMapForRegExpTest(
MapRef map) { MapRef map) {
PropertyAccessInfo ai_exec = PropertyAccessInfo ai_exec = broker()->GetPropertyAccessInfo(
broker()->CreateAccessInfoForLoadingExec(map, dependencies()); map, NameRef(broker(), broker()->isolate()->factory()->exec_string()),
AccessMode::kLoad, dependencies(),
SerializationPolicy::kSerializeIfNeeded);
Handle<JSObject> holder; Handle<JSObject> holder;
if (ai_exec.IsDataConstant() && ai_exec.holder().ToHandle(&holder)) { if (ai_exec.IsDataConstant() && ai_exec.holder().ToHandle(&holder)) {
@ -2286,7 +2291,7 @@ SerializerForBackgroundCompilation::ProcessMapForNamedPropertyAccess(
name, SerializationPolicy::kSerializeIfNeeded); name, SerializationPolicy::kSerializeIfNeeded);
} }
PropertyAccessInfo const& access_info = broker()->GetPropertyAccessInfo( PropertyAccessInfo access_info = broker()->GetPropertyAccessInfo(
receiver_map, name, access_mode, dependencies(), receiver_map, name, access_mode, dependencies(),
SerializationPolicy::kSerializeIfNeeded); SerializationPolicy::kSerializeIfNeeded);
@ -2597,9 +2602,11 @@ void SerializerForBackgroundCompilation::ProcessConstantForInstanceOf(
if (!constructor.IsHeapObject()) return; if (!constructor.IsHeapObject()) return;
HeapObjectRef constructor_heap_object = constructor.AsHeapObject(); HeapObjectRef constructor_heap_object = constructor.AsHeapObject();
PropertyAccessInfo const& access_info = PropertyAccessInfo access_info = broker()->GetPropertyAccessInfo(
broker()->CreateAccessInfoForLoadingHasInstance( constructor_heap_object.map(),
constructor_heap_object.map(), dependencies()); NameRef(broker(), broker()->isolate()->factory()->has_instance_symbol()),
AccessMode::kLoad, dependencies(),
SerializationPolicy::kSerializeIfNeeded);
if (access_info.IsNotFound()) { if (access_info.IsNotFound()) {
ProcessConstantForOrdinaryHasInstance(constructor_heap_object, ProcessConstantForOrdinaryHasInstance(constructor_heap_object,