[maglev] Pass field representation to LoadPolymorphicTaggedField

So we can statically find the returning type in case of a Smi.

Bug: v8:7700
Change-Id: I67f8d1c1c96fef8dc4e246953d9face2c04a9923
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/4198152
Reviewed-by: Toon Verwaest <verwaest@chromium.org>
Commit-Queue: Victor Gomes <victorgomes@chromium.org>
Cr-Commit-Position: refs/heads/main@{#85523}
This commit is contained in:
Victor Gomes 2023-01-27 14:44:35 +01:00 committed by V8 LUCI CQ
parent 721cd23b3d
commit ea6c05d2c3
2 changed files with 21 additions and 3 deletions

View File

@ -1397,6 +1397,18 @@ NodeType StaticTypeForNode(ValueNode* node) {
}
return NodeType::kHeapObjectWithKnownMap;
}
case Opcode::kLoadPolymorphicTaggedField: {
Representation field_representation =
node->Cast<LoadPolymorphicTaggedField>()->field_representation();
switch (field_representation.kind()) {
case Representation::kSmi:
return NodeType::kSmi;
case Representation::kHeapObject:
return NodeType::kAnyHeapObject;
default:
return NodeType::kUnknown;
}
}
case Opcode::kToNumberOrNumeric:
if (node->Cast<ToNumberOrNumeric>()->mode() ==
Object::Conversion::kToNumber) {
@ -2140,7 +2152,7 @@ bool MaglevGraphBuilder::TryBuildNamedAccess(
{lookup_start_object}, std::move(access_infos)));
} else {
SetAccumulator(AddNewNode<LoadPolymorphicTaggedField>(
{lookup_start_object}, std::move(access_infos)));
{lookup_start_object}, field_repr, std::move(access_infos)));
}
return true;

View File

@ -4044,8 +4044,11 @@ class LoadPolymorphicTaggedField
public:
explicit LoadPolymorphicTaggedField(
uint64_t bitfield, ZoneVector<compiler::PropertyAccessInfo>&& access_info)
: Base(bitfield), access_infos_(access_info) {}
uint64_t bitfield, Representation field_representation,
ZoneVector<compiler::PropertyAccessInfo>&& access_info)
: Base(bitfield),
field_representation_(field_representation),
access_infos_(access_info) {}
static constexpr OpProperties kProperties = OpProperties::Reading() |
OpProperties::EagerDeopt() |
@ -4056,12 +4059,15 @@ class LoadPolymorphicTaggedField
static constexpr int kObjectIndex = 0;
Input& object_input() { return input(kObjectIndex); }
Representation field_representation() const { return field_representation_; }
int MaxCallStackArgs() const { return 0; }
void SetValueLocationConstraints();
void GenerateCode(MaglevAssembler*, const ProcessingState&);
void PrintParams(std::ostream&, MaglevGraphLabeller*) const {}
private:
Representation field_representation_;
ZoneVector<compiler::PropertyAccessInfo> access_infos_;
};