Commit 6d640b9b authored by Georg Neis's avatar Georg Neis Committed by Commit Bot

[turbofan] Remove MapsParameterInfo

This was a pair of a set of maps and their common instance type (if
any), but the instance type field was only used in a printing function.
Removing the whole class in favor of ZoneHandleSet<Map> means we avoid
looking at the heap to determine the common instance type. Eventually
we can use the broker to do this if we need to.

Bug: v8:7790
Change-Id: If0cadf9b17e3b9e77cffc4f0b69e2585aff7c85c
Reviewed-on: https://chromium-review.googlesource.com/c/1481214Reviewed-by: 's avatarMaya Lekova <mslekova@chromium.org>
Reviewed-by: 's avatarJaroslav Sevcik <jarin@chromium.org>
Commit-Queue: Jaroslav Sevcik <jarin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#59834}
parent 3bd88999
...@@ -1547,7 +1547,7 @@ void EffectControlLinearizer::LowerCheckMaps(Node* node, Node* frame_state) { ...@@ -1547,7 +1547,7 @@ void EffectControlLinearizer::LowerCheckMaps(Node* node, Node* frame_state) {
} }
Node* EffectControlLinearizer::LowerCompareMaps(Node* node) { Node* EffectControlLinearizer::LowerCompareMaps(Node* node) {
ZoneHandleSet<Map> const& maps = CompareMapsParametersOf(node->op()).maps(); ZoneHandleSet<Map> const& maps = CompareMapsParametersOf(node->op());
size_t const map_count = maps.size(); size_t const map_count = maps.size();
Node* value = node->InputAt(0); Node* value = node->InputAt(0);
......
...@@ -754,7 +754,7 @@ void ReduceNode(const Operator* op, EscapeAnalysisTracker::Scope* current, ...@@ -754,7 +754,7 @@ void ReduceNode(const Operator* op, EscapeAnalysisTracker::Scope* current,
current->Get(map_field).To(&object_map)) { current->Get(map_field).To(&object_map)) {
if (object_map) { if (object_map) {
current->SetReplacement(LowerCompareMapsWithoutLoad( current->SetReplacement(LowerCompareMapsWithoutLoad(
object_map, CompareMapsParametersOf(op).maps(), jsgraph)); object_map, CompareMapsParametersOf(op), jsgraph));
break; break;
} else { } else {
// If the variable has no value, we have not reached the fixed-point // If the variable has no value, we have not reached the fixed-point
......
...@@ -114,22 +114,21 @@ Reduction JSHeapCopyReducer::Reduce(Node* node) { ...@@ -114,22 +114,21 @@ Reduction JSHeapCopyReducer::Reduce(Node* node) {
break; break;
} }
case IrOpcode::kMapGuard: { case IrOpcode::kMapGuard: {
ZoneHandleSet<Map> const maps = MapGuardMapsOf(node->op()).maps(); ZoneHandleSet<Map> const& maps = MapGuardMapsOf(node->op());
for (Handle<Map> map : maps) { for (Handle<Map> map : maps) {
MapRef(broker(), map); MapRef(broker(), map);
} }
break; break;
} }
case IrOpcode::kCheckMaps: { case IrOpcode::kCheckMaps: {
ZoneHandleSet<Map> const maps = CheckMapsParametersOf(node->op()).maps(); ZoneHandleSet<Map> const& maps = CheckMapsParametersOf(node->op()).maps();
for (Handle<Map> map : maps) { for (Handle<Map> map : maps) {
MapRef(broker(), map); MapRef(broker(), map);
} }
break; break;
} }
case IrOpcode::kCompareMaps: { case IrOpcode::kCompareMaps: {
ZoneHandleSet<Map> const maps = ZoneHandleSet<Map> const& maps = CompareMapsParametersOf(node->op());
CompareMapsParametersOf(node->op()).maps();
for (Handle<Map> map : maps) { for (Handle<Map> map : maps) {
MapRef(broker(), map); MapRef(broker(), map);
} }
......
...@@ -627,7 +627,7 @@ void LoadElimination::AbstractStateForEffectNodes::Set( ...@@ -627,7 +627,7 @@ void LoadElimination::AbstractStateForEffectNodes::Set(
} }
Reduction LoadElimination::ReduceMapGuard(Node* node) { Reduction LoadElimination::ReduceMapGuard(Node* node) {
ZoneHandleSet<Map> const maps = MapGuardMapsOf(node->op()).maps(); ZoneHandleSet<Map> const& maps = MapGuardMapsOf(node->op());
Node* const object = NodeProperties::GetValueInput(node, 0); Node* const object = NodeProperties::GetValueInput(node, 0);
Node* const effect = NodeProperties::GetEffectInput(node); Node* const effect = NodeProperties::GetEffectInput(node);
AbstractState const* state = node_states_.Get(effect); AbstractState const* state = node_states_.Get(effect);
...@@ -642,7 +642,7 @@ Reduction LoadElimination::ReduceMapGuard(Node* node) { ...@@ -642,7 +642,7 @@ Reduction LoadElimination::ReduceMapGuard(Node* node) {
} }
Reduction LoadElimination::ReduceCheckMaps(Node* node) { Reduction LoadElimination::ReduceCheckMaps(Node* node) {
ZoneHandleSet<Map> const maps = CheckMapsParametersOf(node->op()).maps(); ZoneHandleSet<Map> const& maps = CheckMapsParametersOf(node->op()).maps();
Node* const object = NodeProperties::GetValueInput(node, 0); Node* const object = NodeProperties::GetValueInput(node, 0);
Node* const effect = NodeProperties::GetEffectInput(node); Node* const effect = NodeProperties::GetEffectInput(node);
AbstractState const* state = node_states_.Get(effect); AbstractState const* state = node_states_.Get(effect);
...@@ -657,7 +657,7 @@ Reduction LoadElimination::ReduceCheckMaps(Node* node) { ...@@ -657,7 +657,7 @@ Reduction LoadElimination::ReduceCheckMaps(Node* node) {
} }
Reduction LoadElimination::ReduceCompareMaps(Node* node) { Reduction LoadElimination::ReduceCompareMaps(Node* node) {
ZoneHandleSet<Map> const maps = CompareMapsParametersOf(node->op()).maps(); ZoneHandleSet<Map> const& maps = CompareMapsParametersOf(node->op());
Node* const object = NodeProperties::GetValueInput(node, 0); Node* const object = NodeProperties::GetValueInput(node, 0);
Node* const effect = NodeProperties::GetEffectInput(node); Node* const effect = NodeProperties::GetEffectInput(node);
AbstractState const* state = node_states_.Get(effect); AbstractState const* state = node_states_.Get(effect);
......
...@@ -391,7 +391,7 @@ NodeProperties::InferReceiverMapsResult NodeProperties::InferReceiverMaps( ...@@ -391,7 +391,7 @@ NodeProperties::InferReceiverMapsResult NodeProperties::InferReceiverMaps(
case IrOpcode::kMapGuard: { case IrOpcode::kMapGuard: {
Node* const object = GetValueInput(effect, 0); Node* const object = GetValueInput(effect, 0);
if (IsSame(receiver, object)) { if (IsSame(receiver, object)) {
*maps_return = MapGuardMapsOf(effect->op()).maps(); *maps_return = MapGuardMapsOf(effect->op());
return result; return result;
} }
break; break;
......
...@@ -223,40 +223,6 @@ std::ostream& operator<<(std::ostream& os, CheckMapsFlags flags) { ...@@ -223,40 +223,6 @@ std::ostream& operator<<(std::ostream& os, CheckMapsFlags flags) {
return os; return os;
} }
MapsParameterInfo::MapsParameterInfo(ZoneHandleSet<Map> const& maps)
: maps_(maps), instance_type_(Nothing<InstanceType>()) {
DCHECK_LT(0, maps.size());
instance_type_ = Just(maps.at(0)->instance_type());
for (size_t i = 1; i < maps.size(); ++i) {
if (instance_type_.FromJust() != maps.at(i)->instance_type()) {
instance_type_ = Nothing<InstanceType>();
break;
}
}
}
std::ostream& operator<<(std::ostream& os, MapsParameterInfo const& p) {
ZoneHandleSet<Map> const& maps = p.maps();
InstanceType instance_type;
if (p.instance_type().To(&instance_type)) {
os << ", " << instance_type;
}
for (size_t i = 0; i < maps.size(); ++i) {
os << ", " << Brief(*maps[i]);
}
return os;
}
bool operator==(MapsParameterInfo const& lhs, MapsParameterInfo const& rhs) {
return lhs.maps() == rhs.maps();
}
bool operator!=(MapsParameterInfo const& lhs, MapsParameterInfo const& rhs) {
return !(lhs == rhs);
}
size_t hash_value(MapsParameterInfo const& p) { return hash_value(p.maps()); }
bool operator==(CheckMapsParameters const& lhs, bool operator==(CheckMapsParameters const& lhs,
CheckMapsParameters const& rhs) { CheckMapsParameters const& rhs) {
return lhs.flags() == rhs.flags() && lhs.maps() == rhs.maps() && return lhs.flags() == rhs.flags() && lhs.maps() == rhs.maps() &&
...@@ -268,7 +234,7 @@ size_t hash_value(CheckMapsParameters const& p) { ...@@ -268,7 +234,7 @@ size_t hash_value(CheckMapsParameters const& p) {
} }
std::ostream& operator<<(std::ostream& os, CheckMapsParameters const& p) { std::ostream& operator<<(std::ostream& os, CheckMapsParameters const& p) {
os << p.flags() << p.maps_info(); os << p.flags() << p.maps();
if (p.feedback().IsValid()) { if (p.feedback().IsValid()) {
os << "; " << p.feedback(); os << "; " << p.feedback();
} }
...@@ -280,14 +246,14 @@ CheckMapsParameters const& CheckMapsParametersOf(Operator const* op) { ...@@ -280,14 +246,14 @@ CheckMapsParameters const& CheckMapsParametersOf(Operator const* op) {
return OpParameter<CheckMapsParameters>(op); return OpParameter<CheckMapsParameters>(op);
} }
MapsParameterInfo const& CompareMapsParametersOf(Operator const* op) { ZoneHandleSet<Map> const& CompareMapsParametersOf(Operator const* op) {
DCHECK_EQ(IrOpcode::kCompareMaps, op->opcode()); DCHECK_EQ(IrOpcode::kCompareMaps, op->opcode());
return OpParameter<MapsParameterInfo>(op); return OpParameter<ZoneHandleSet<Map>>(op);
} }
MapsParameterInfo const& MapGuardMapsOf(Operator const* op) { ZoneHandleSet<Map> const& MapGuardMapsOf(Operator const* op) {
DCHECK_EQ(IrOpcode::kMapGuard, op->opcode()); DCHECK_EQ(IrOpcode::kMapGuard, op->opcode());
return OpParameter<MapsParameterInfo>(op); return OpParameter<ZoneHandleSet<Map>>(op);
} }
size_t hash_value(CheckTaggedInputMode mode) { size_t hash_value(CheckTaggedInputMode mode) {
...@@ -1417,21 +1383,23 @@ const Operator* SimplifiedOperatorBuilder::CheckMaps( ...@@ -1417,21 +1383,23 @@ const Operator* SimplifiedOperatorBuilder::CheckMaps(
} }
const Operator* SimplifiedOperatorBuilder::MapGuard(ZoneHandleSet<Map> maps) { const Operator* SimplifiedOperatorBuilder::MapGuard(ZoneHandleSet<Map> maps) {
return new (zone()) Operator1<MapsParameterInfo>( // -- DCHECK_LT(0, maps.size());
IrOpcode::kMapGuard, Operator::kEliminatable, // opcode return new (zone()) Operator1<ZoneHandleSet<Map>>( // --
"MapGuard", // name IrOpcode::kMapGuard, Operator::kEliminatable, // opcode
1, 1, 1, 0, 1, 0, // counts "MapGuard", // name
MapsParameterInfo(maps)); // parameter 1, 1, 1, 0, 1, 0, // counts
maps); // parameter
} }
const Operator* SimplifiedOperatorBuilder::CompareMaps( const Operator* SimplifiedOperatorBuilder::CompareMaps(
ZoneHandleSet<Map> maps) { ZoneHandleSet<Map> maps) {
return new (zone()) Operator1<MapsParameterInfo>( // -- DCHECK_LT(0, maps.size());
IrOpcode::kCompareMaps, // opcode return new (zone()) Operator1<ZoneHandleSet<Map>>( // --
Operator::kEliminatable, // flags IrOpcode::kCompareMaps, // opcode
"CompareMaps", // name Operator::kEliminatable, // flags
1, 1, 1, 1, 1, 0, // counts "CompareMaps", // name
MapsParameterInfo(maps)); // parameter 1, 1, 1, 1, 1, 0, // counts
maps); // parameter
} }
const Operator* SimplifiedOperatorBuilder::ConvertReceiver( const Operator* SimplifiedOperatorBuilder::ConvertReceiver(
......
...@@ -327,25 +327,6 @@ DEFINE_OPERATORS_FOR_FLAGS(CheckMapsFlags) ...@@ -327,25 +327,6 @@ DEFINE_OPERATORS_FOR_FLAGS(CheckMapsFlags)
std::ostream& operator<<(std::ostream&, CheckMapsFlags); std::ostream& operator<<(std::ostream&, CheckMapsFlags);
class MapsParameterInfo {
public:
explicit MapsParameterInfo(ZoneHandleSet<Map> const& maps);
Maybe<InstanceType> instance_type() const { return instance_type_; }
ZoneHandleSet<Map> const& maps() const { return maps_; }
private:
ZoneHandleSet<Map> const maps_;
Maybe<InstanceType> instance_type_;
};
std::ostream& operator<<(std::ostream&, MapsParameterInfo const&);
bool operator==(MapsParameterInfo const&, MapsParameterInfo const&);
bool operator!=(MapsParameterInfo const&, MapsParameterInfo const&);
size_t hash_value(MapsParameterInfo const&);
// A descriptor for map checks. The {feedback} parameter is optional. // A descriptor for map checks. The {feedback} parameter is optional.
// If {feedback} references a valid CallIC slot and this MapCheck fails, // If {feedback} references a valid CallIC slot and this MapCheck fails,
// then speculation on that CallIC slot will be disabled. // then speculation on that CallIC slot will be disabled.
...@@ -353,16 +334,15 @@ class CheckMapsParameters final { ...@@ -353,16 +334,15 @@ class CheckMapsParameters final {
public: public:
CheckMapsParameters(CheckMapsFlags flags, ZoneHandleSet<Map> const& maps, CheckMapsParameters(CheckMapsFlags flags, ZoneHandleSet<Map> const& maps,
const VectorSlotPair& feedback) const VectorSlotPair& feedback)
: flags_(flags), maps_info_(maps), feedback_(feedback) {} : flags_(flags), maps_(maps), feedback_(feedback) {}
CheckMapsFlags flags() const { return flags_; } CheckMapsFlags flags() const { return flags_; }
ZoneHandleSet<Map> const& maps() const { return maps_info_.maps(); } ZoneHandleSet<Map> const& maps() const { return maps_; }
MapsParameterInfo const& maps_info() const { return maps_info_; }
VectorSlotPair const& feedback() const { return feedback_; } VectorSlotPair const& feedback() const { return feedback_; }
private: private:
CheckMapsFlags const flags_; CheckMapsFlags const flags_;
MapsParameterInfo const maps_info_; ZoneHandleSet<Map> const maps_;
VectorSlotPair const feedback_; VectorSlotPair const feedback_;
}; };
...@@ -375,10 +355,10 @@ std::ostream& operator<<(std::ostream&, CheckMapsParameters const&); ...@@ -375,10 +355,10 @@ std::ostream& operator<<(std::ostream&, CheckMapsParameters const&);
CheckMapsParameters const& CheckMapsParametersOf(Operator const*) CheckMapsParameters const& CheckMapsParametersOf(Operator const*)
V8_WARN_UNUSED_RESULT; V8_WARN_UNUSED_RESULT;
MapsParameterInfo const& MapGuardMapsOf(Operator const*) V8_WARN_UNUSED_RESULT; ZoneHandleSet<Map> const& MapGuardMapsOf(Operator const*) V8_WARN_UNUSED_RESULT;
// Parameters for CompareMaps operator. // Parameters for CompareMaps operator.
MapsParameterInfo const& CompareMapsParametersOf(Operator const*) ZoneHandleSet<Map> const& CompareMapsParametersOf(Operator const*)
V8_WARN_UNUSED_RESULT; V8_WARN_UNUSED_RESULT;
// A descriptor for growing elements backing stores. // A descriptor for growing elements backing stores.
......
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