Commit 6acbbfbe authored by Sathya Gunasekaran's avatar Sathya Gunasekaran Committed by Commit Bot

[turbofan] Split DependentCode::kFieldOwner group

This patch will allow turboprop to selectively turn off const based
optimizations.

Change-Id: Icd0ec29968287a428cbf38857191900dbf3fda36
Bug: v8:9684, v8:10431
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2149429
Commit-Queue: Sathya Gunasekaran  <gsathya@chromium.org>
Reviewed-by: 's avatarGeorg Neis <neis@chromium.org>
Reviewed-by: 's avatarIgor Sheludko <ishell@chromium.org>
Cr-Commit-Position: refs/heads/master@{#67355}
parent 7712da4d
......@@ -176,7 +176,7 @@ class FieldRepresentationDependency final : public CompilationDependency {
void Install(const MaybeObjectHandle& code) const override {
SLOW_DCHECK(IsValid());
DependentCode::InstallDependency(owner_.isolate(), code, owner_.object(),
DependentCode::kFieldOwnerGroup);
DependentCode::kFieldRepresentationGroup);
}
private:
......@@ -206,7 +206,7 @@ class FieldTypeDependency final : public CompilationDependency {
void Install(const MaybeObjectHandle& code) const override {
SLOW_DCHECK(IsValid());
DependentCode::InstallDependency(owner_.isolate(), code, owner_.object(),
DependentCode::kFieldOwnerGroup);
DependentCode::kFieldTypeGroup);
}
private:
......@@ -234,7 +234,7 @@ class FieldConstnessDependency final : public CompilationDependency {
void Install(const MaybeObjectHandle& code) const override {
SLOW_DCHECK(IsValid());
DependentCode::InstallDependency(owner_.isolate(), code, owner_.object(),
DependentCode::kFieldOwnerGroup);
DependentCode::kFieldConstGroup);
}
private:
......
......@@ -1026,8 +1026,12 @@ const char* DependentCode::DependencyGroupName(DependencyGroup group) {
return "prototype-check";
case kPropertyCellChangedGroup:
return "property-cell-changed";
case kFieldOwnerGroup:
return "field-owner";
case kFieldConstGroup:
return "field-const";
case kFieldTypeGroup:
return "field-type";
case kFieldRepresentationGroup:
return "field-representation";
case kInitialMapChangedGroup:
return "initial-map-changed";
case kAllocationSiteTenuringChangedGroup:
......
......@@ -651,7 +651,9 @@ class DependentCode : public WeakFixedArray {
kPropertyCellChangedGroup,
// Group of code that omit run-time checks for field(s) introduced by
// this map, i.e. for the field type.
kFieldOwnerGroup,
kFieldTypeGroup,
kFieldConstGroup,
kFieldRepresentationGroup,
// Group of code that omit run-time type checks for initial maps of
// constructors.
kInitialMapChangedGroup,
......@@ -719,8 +721,8 @@ class DependentCode : public WeakFixedArray {
inline int flags();
inline void set_flags(int flags);
using GroupField = base::BitField<int, 0, 3>;
using CountField = base::BitField<int, 3, 27>;
using GroupField = base::BitField<int, 0, 5>;
using CountField = base::BitField<int, 5, 27>;
STATIC_ASSERT(kGroupCount <= GroupField::kMax + 1);
OBJECT_CONSTRUCTORS(DependentCode, WeakFixedArray);
......
......@@ -63,6 +63,15 @@ bool FieldType::NowIs(FieldType other) const {
return *this == other;
}
bool FieldType::Equals(FieldType other) const {
if (IsAny() && other.IsAny()) return true;
if (IsNone() && other.IsNone()) return true;
if (IsClass() && other.IsClass()) {
return *this == other;
}
return false;
}
bool FieldType::NowIs(Handle<FieldType> other) const { return NowIs(*other); }
void FieldType::PrintTo(std::ostream& os) const {
......
......@@ -41,6 +41,7 @@ class FieldType : public Object {
bool NowIs(FieldType other) const;
bool NowIs(Handle<FieldType> other) const;
V8_EXPORT_PRIVATE bool Equals(FieldType other) const;
V8_EXPORT_PRIVATE void PrintTo(std::ostream& os) const;
private:
......
......@@ -797,8 +797,21 @@ void Map::GeneralizeField(Isolate* isolate, Handle<Map> map,
MaybeObjectHandle wrapped_type(WrapFieldType(isolate, new_field_type));
field_owner->UpdateFieldType(isolate, modify_index, name, new_constness,
new_representation, wrapped_type);
field_owner->dependent_code().DeoptimizeDependentCodeGroup(
DependentCode::kFieldOwnerGroup);
if (new_constness != old_constness) {
field_owner->dependent_code().DeoptimizeDependentCodeGroup(
DependentCode::kFieldConstGroup);
}
if (!new_field_type->Equals(*old_field_type)) {
field_owner->dependent_code().DeoptimizeDependentCodeGroup(
DependentCode::kFieldTypeGroup);
}
if (!new_representation.Equals(old_representation)) {
field_owner->dependent_code().DeoptimizeDependentCodeGroup(
DependentCode::kFieldRepresentationGroup);
}
if (FLAG_trace_generalization) {
map->PrintGeneralization(
......
This diff is collapsed.
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