Commit 11915125 authored by Clemens Hammacher's avatar Clemens Hammacher Committed by Commit Bot

[iwyu] Fix transitions.h

Move some methods to transitions-inl.h to avoid using methods defined
in other inl headers.

R=verwaest@chromium.org

Bug: v8:7965
Change-Id: I0f5a97ffa4c5faad1687c1586ef2dbf5193939bb
Reviewed-on: https://chromium-review.googlesource.com/c/1303299
Commit-Queue: Clemens Hammacher <clemensh@chromium.org>
Reviewed-by: 's avatarToon Verwaest <verwaest@chromium.org>
Cr-Commit-Position: refs/heads/master@{#57080}
parent 0d9ed950
...@@ -98,6 +98,17 @@ PropertyDetails TransitionsAccessor::GetTargetDetails(Name* name, Map* target) { ...@@ -98,6 +98,17 @@ PropertyDetails TransitionsAccessor::GetTargetDetails(Name* name, Map* target) {
return descriptors->GetDetails(descriptor); return descriptors->GetDetails(descriptor);
} }
// static
PropertyDetails TransitionsAccessor::GetSimpleTargetDetails(Map* transition) {
return transition->GetLastDescriptorDetails();
}
// static
Name* TransitionsAccessor::GetSimpleTransitionKey(Map* transition) {
int descriptor = transition->LastAdded();
return transition->instance_descriptors()->GetKey(descriptor);
}
// static // static
Map* TransitionsAccessor::GetTargetFromRaw(MaybeObject raw) { Map* TransitionsAccessor::GetTargetFromRaw(MaybeObject raw) {
return Map::cast(raw->GetHeapObjectAssumeWeak()); return Map::cast(raw->GetHeapObjectAssumeWeak());
...@@ -146,6 +157,15 @@ bool TransitionArray::GetTargetIfExists(int transition_number, Isolate* isolate, ...@@ -146,6 +157,15 @@ bool TransitionArray::GetTargetIfExists(int transition_number, Isolate* isolate,
return true; return true;
} }
int TransitionArray::SearchNameForTesting(Name* name,
int* out_insertion_index) {
return SearchName(name, out_insertion_index);
}
int TransitionArray::SearchSpecial(Symbol* symbol, int* out_insertion_index) {
return SearchName(symbol, out_insertion_index);
}
int TransitionArray::SearchName(Name* name, int* out_insertion_index) { int TransitionArray::SearchName(Name* name, int* out_insertion_index) {
DCHECK(name->IsUniqueName()); DCHECK(name->IsUniqueName());
return internal::Search<ALL_ENTRIES>(this, name, number_of_entries(), return internal::Search<ALL_ENTRIES>(this, name, number_of_entries(),
...@@ -200,6 +220,14 @@ void TransitionArray::Set(int transition_number, Name* key, ...@@ -200,6 +220,14 @@ void TransitionArray::Set(int transition_number, Name* key,
WeakFixedArray::Set(ToTargetIndex(transition_number), target); WeakFixedArray::Set(ToTargetIndex(transition_number), target);
} }
Name* TransitionArray::GetSortedKey(int transition_number) {
return GetKey(transition_number);
}
int TransitionArray::number_of_entries() const {
return number_of_transitions();
}
int TransitionArray::Capacity() { int TransitionArray::Capacity() {
if (length() <= kFirstIndex) return 0; if (length() <= kFirstIndex) return 0;
return (length() - kFirstIndex) / kEntrySize; return (length() - kFirstIndex) / kEntrySize;
......
...@@ -145,14 +145,9 @@ class TransitionsAccessor { ...@@ -145,14 +145,9 @@ class TransitionsAccessor {
friend class MarkCompactCollector; // For HasSimpleTransitionTo. friend class MarkCompactCollector; // For HasSimpleTransitionTo.
friend class TransitionArray; friend class TransitionArray;
static inline PropertyDetails GetSimpleTargetDetails(Map* transition) { static inline PropertyDetails GetSimpleTargetDetails(Map* transition);
return transition->GetLastDescriptorDetails();
}
static inline Name* GetSimpleTransitionKey(Map* transition) { static inline Name* GetSimpleTransitionKey(Map* transition);
int descriptor = transition->LastAdded();
return transition->instance_descriptors()->GetKey(descriptor);
}
static inline Map* GetTargetFromRaw(MaybeObject raw); static inline Map* GetTargetFromRaw(MaybeObject raw);
...@@ -224,12 +219,11 @@ class TransitionArray : public WeakFixedArray { ...@@ -224,12 +219,11 @@ class TransitionArray : public WeakFixedArray {
Map** target); Map** target);
// Required for templatized Search interface. // Required for templatized Search interface.
static const int kNotFound = -1; static constexpr int kNotFound = -1;
Name* GetSortedKey(int transition_number) {
return GetKey(transition_number); inline Name* GetSortedKey(int transition_number);
}
int GetSortedKeyIndex(int transition_number) { return transition_number; } int GetSortedKeyIndex(int transition_number) { return transition_number; }
inline int number_of_entries() const { return number_of_transitions(); } inline int number_of_entries() const;
#ifdef DEBUG #ifdef DEBUG
bool IsSortedNoDuplicates(int valid_entries = -1); bool IsSortedNoDuplicates(int valid_entries = -1);
#endif #endif
...@@ -261,9 +255,7 @@ class TransitionArray : public WeakFixedArray { ...@@ -261,9 +255,7 @@ class TransitionArray : public WeakFixedArray {
} }
inline int SearchNameForTesting(Name* name, inline int SearchNameForTesting(Name* name,
int* out_insertion_index = nullptr) { int* out_insertion_index = nullptr);
return SearchName(name, out_insertion_index);
}
private: private:
friend class Factory; friend class Factory;
...@@ -303,9 +295,7 @@ class TransitionArray : public WeakFixedArray { ...@@ -303,9 +295,7 @@ class TransitionArray : public WeakFixedArray {
// Search a non-property transition (like elements kind, observe or frozen // Search a non-property transition (like elements kind, observe or frozen
// transitions). // transitions).
inline int SearchSpecial(Symbol* symbol, int* out_insertion_index = nullptr) { inline int SearchSpecial(Symbol* symbol, int* out_insertion_index = nullptr);
return SearchName(symbol, out_insertion_index);
}
// Search a first transition for a given property name. // Search a first transition for a given property name.
inline int SearchName(Name* name, int* out_insertion_index = nullptr); inline int SearchName(Name* name, int* out_insertion_index = nullptr);
int SearchDetails(int transition, PropertyKind kind, int SearchDetails(int transition, PropertyKind kind,
......
...@@ -28,8 +28,6 @@ OUT_DIR = os.path.join(V8_DIR, 'check-header-includes') ...@@ -28,8 +28,6 @@ OUT_DIR = os.path.join(V8_DIR, 'check-header-includes')
AUTO_EXCLUDE = [ AUTO_EXCLUDE = [
# flag-definitions.h needs a mode set for being included. # flag-definitions.h needs a mode set for being included.
'src/flag-definitions.h', 'src/flag-definitions.h',
# blacklist of headers we need to fix (https://crbug.com/v8/7965).
'src/transitions.h',
] ]
AUTO_EXCLUDE_PATTERNS = [ AUTO_EXCLUDE_PATTERNS = [
'src/base/atomicops_internals_.*', 'src/base/atomicops_internals_.*',
......
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