Commit f2dcbf8d authored by Georg Neis's avatar Georg Neis Committed by Commit Bot

[turbofan] Remove redundant things from AccessInfoFactory

Bug: v8:7790
Change-Id: I92657d3aae6ba34b2aeeb6f000962707577811b6
Reviewed-on: https://chromium-review.googlesource.com/c/1478696Reviewed-by: 's avatarJaroslav Sevcik <jarin@chromium.org>
Reviewed-by: 's avatarMaya Lekova <mslekova@chromium.org>
Commit-Queue: Georg Neis <neis@chromium.org>
Cr-Commit-Position: refs/heads/master@{#59751}
parent adb7e37b
......@@ -251,15 +251,11 @@ Handle<Cell> PropertyAccessInfo::export_cell() const {
AccessInfoFactory::AccessInfoFactory(JSHeapBroker* broker,
CompilationDependencies* dependencies,
Handle<Context> native_context, Zone* zone)
Zone* zone)
: broker_(broker),
dependencies_(dependencies),
native_context_(native_context),
isolate_(native_context->GetIsolate()),
type_cache_(TypeCache::Get()),
zone_(zone) {
DCHECK(native_context->IsNativeContext());
}
zone_(zone) {}
bool AccessInfoFactory::ComputeElementAccessInfo(
Handle<Map> map, AccessMode access_mode,
......@@ -427,7 +423,8 @@ bool AccessInfoFactory::ComputeAccessorDescriptorAccessInfo(
if (!accessor->IsJSFunction()) {
CallOptimization optimization(isolate(), accessor);
if (!optimization.is_simple_api_call()) return false;
if (optimization.IsCrossContextLazyAccessorPair(*native_context_, *map)) {
if (optimization.IsCrossContextLazyAccessorPair(
*broker()->native_context().object(), *map)) {
return false;
}
......@@ -540,7 +537,7 @@ bool AccessInfoFactory::ComputePropertyAccessInfo(
// Perform the implicit ToObject for primitives here.
// Implemented according to ES6 section 7.3.2 GetV (V, P).
Handle<JSFunction> constructor;
if (Map::GetConstructorFunction(map, native_context())
if (Map::GetConstructorFunction(map, broker()->native_context().object())
.ToHandle(&constructor)) {
map = handle(constructor->initial_map(), isolate());
DCHECK(map->prototype()->IsJSObject());
......@@ -657,7 +654,7 @@ bool AccessInfoFactory::LookupSpecialFieldAccessor(
Handle<Map> map, Handle<Name> name, PropertyAccessInfo* access_info) const {
// Check for String::length field accessor.
if (map->IsStringMap()) {
if (Name::Equals(isolate(), name, factory()->length_string())) {
if (Name::Equals(isolate(), name, isolate()->factory()->length_string())) {
*access_info = PropertyAccessInfo::StringLength(MapHandles{map});
return true;
}
......@@ -669,7 +666,8 @@ bool AccessInfoFactory::LookupSpecialFieldAccessor(
Type field_type = Type::NonInternal();
MachineRepresentation field_representation = MachineRepresentation::kTagged;
if (map->IsJSArrayMap()) {
DCHECK(Name::Equals(isolate(), factory()->length_string(), name));
DCHECK(
Name::Equals(isolate(), isolate()->factory()->length_string(), name));
// The JSArray::length property is a smi in the range
// [0, FixedDoubleArray::kMaxLength] in case of fast double
// elements, a smi in the range [0, FixedArray::kMaxLength]
......@@ -752,7 +750,6 @@ bool AccessInfoFactory::LookupTransition(
return true;
}
Factory* AccessInfoFactory::factory() const { return isolate()->factory(); }
} // namespace compiler
} // namespace internal
......
......@@ -145,7 +145,7 @@ class PropertyAccessInfo final {
class AccessInfoFactory final {
public:
AccessInfoFactory(JSHeapBroker* broker, CompilationDependencies* dependencies,
Handle<Context> native_context, Zone* zone);
Zone* zone);
bool ComputeElementAccessInfo(Handle<Map> map, AccessMode access_mode,
ElementAccessInfo* access_info) const;
......@@ -182,15 +182,11 @@ class AccessInfoFactory final {
CompilationDependencies* dependencies() const { return dependencies_; }
JSHeapBroker* broker() const { return broker_; }
Factory* factory() const;
Isolate* isolate() const { return isolate_; }
Handle<Context> native_context() const { return native_context_; }
Isolate* isolate() const { return broker()->isolate(); }
Zone* zone() const { return zone_; }
JSHeapBroker* const broker_;
CompilationDependencies* const dependencies_;
Handle<Context> const native_context_;
Isolate* const isolate_;
TypeCache const* const type_cache_;
Zone* const zone_;
......
......@@ -7055,8 +7055,8 @@ Reduction JSCallReducer::ReduceRegExpPrototypeTest(Node* node) {
// Compute property access info for "exec" on {resolution}.
PropertyAccessInfo ai_exec;
AccessInfoFactory access_info_factory(
broker(), dependencies(), native_context().object(), graph()->zone());
AccessInfoFactory access_info_factory(broker(), dependencies(),
graph()->zone());
if (!access_info_factory.ComputePropertyAccessInfo(
MapHandles(regexp_maps.begin(), regexp_maps.end()),
factory()->exec_string(), AccessMode::kLoad, &ai_exec)) {
......
......@@ -405,8 +405,8 @@ Reduction JSNativeContextSpecialization::ReduceJSInstanceOf(Node* node) {
// Compute property access info for @@hasInstance on the constructor.
PropertyAccessInfo access_info;
AccessInfoFactory access_info_factory(
broker(), dependencies(), native_context().object(), graph()->zone());
AccessInfoFactory access_info_factory(broker(), dependencies(),
graph()->zone());
if (!access_info_factory.ComputePropertyAccessInfo(
receiver_map, factory()->has_instance_symbol(), AccessMode::kLoad,
&access_info)) {
......@@ -728,8 +728,8 @@ Reduction JSNativeContextSpecialization::ReduceJSResolvePromise(Node* node) {
// Compute property access info for "then" on {resolution}.
PropertyAccessInfo access_info;
AccessInfoFactory access_info_factory(
broker(), dependencies(), native_context().object(), graph()->zone());
AccessInfoFactory access_info_factory(broker(), dependencies(),
graph()->zone());
if (!access_info_factory.ComputePropertyAccessInfo(
MapHandles(resolution_maps.begin(), resolution_maps.end()),
factory()->then_string(), AccessMode::kLoad, &access_info)) {
......@@ -1133,8 +1133,8 @@ Reduction JSNativeContextSpecialization::ReduceNamedAccess(
}
// Compute property access infos for the receiver maps.
AccessInfoFactory access_info_factory(
broker(), dependencies(), native_context().object(), graph()->zone());
AccessInfoFactory access_info_factory(broker(), dependencies(),
graph()->zone());
ZoneVector<PropertyAccessInfo> access_infos(zone());
if (!access_info_factory.ComputePropertyAccessInfos(
receiver_maps, name, access_mode, &access_infos)) {
......@@ -1517,8 +1517,8 @@ Reduction JSNativeContextSpecialization::ReduceElementAccess(
}
// Compute element access infos for the receiver maps.
AccessInfoFactory access_info_factory(
broker(), dependencies(), native_context().object(), graph()->zone());
AccessInfoFactory access_info_factory(broker(), dependencies(),
graph()->zone());
ZoneVector<ElementAccessInfo> access_infos(zone());
if (!access_info_factory.ComputeElementAccessInfos(receiver_maps, access_mode,
&access_infos)) {
......@@ -2442,8 +2442,8 @@ Reduction JSNativeContextSpecialization::ReduceJSStoreDataPropertyInLiteral(
isolate());
PropertyAccessInfo access_info;
AccessInfoFactory access_info_factory(
broker(), dependencies(), native_context().object(), graph()->zone());
AccessInfoFactory access_info_factory(broker(), dependencies(),
graph()->zone());
if (!access_info_factory.ComputePropertyAccessInfo(
receiver_map, cached_name, AccessMode::kStoreInLiteral,
&access_info)) {
......
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