Commit 3910f6df authored by mstarzinger's avatar mstarzinger Committed by Commit bot

Make type-feedback-vector.h be self-contained.

This allows the header in question to be included without including any
other header files. This is step towards factory.h being self-contained.

R=clemensh@chromium.org

Review-Url: https://codereview.chromium.org/2043723002
Cr-Commit-Position: refs/heads/master@{#36752}
parent 37394eb3
...@@ -78,12 +78,6 @@ TypeFeedbackMetadata* TypeFeedbackVector::metadata() const { ...@@ -78,12 +78,6 @@ TypeFeedbackMetadata* TypeFeedbackVector::metadata() const {
} }
FeedbackVectorSlotKind TypeFeedbackVector::GetKind(
FeedbackVectorSlot slot) const {
DCHECK(!is_empty());
return metadata()->GetKind(slot);
}
// static // static
int TypeFeedbackVector::GetIndex(FeedbackVectorSlot slot) { int TypeFeedbackVector::GetIndex(FeedbackVectorSlot slot) {
return kReservedIndexCount + slot.ToInt(); return kReservedIndexCount + slot.ToInt();
...@@ -153,6 +147,21 @@ Symbol* TypeFeedbackVector::RawUninitializedSentinel(Isolate* isolate) { ...@@ -153,6 +147,21 @@ Symbol* TypeFeedbackVector::RawUninitializedSentinel(Isolate* isolate) {
return isolate->heap()->uninitialized_symbol(); return isolate->heap()->uninitialized_symbol();
} }
bool TypeFeedbackMetadataIterator::HasNext() const {
return slot_.ToInt() < metadata()->slot_count();
}
FeedbackVectorSlot TypeFeedbackMetadataIterator::Next() {
DCHECK(HasNext());
FeedbackVectorSlot slot = slot_;
slot_kind_ = metadata()->GetKind(slot);
slot_ = FeedbackVectorSlot(slot_.ToInt() + entry_size());
return slot;
}
int TypeFeedbackMetadataIterator::entry_size() const {
return TypeFeedbackMetadata::GetSlotSize(kind());
}
Object* FeedbackNexus::GetFeedback() const { return vector()->Get(slot()); } Object* FeedbackNexus::GetFeedback() const { return vector()->Get(slot()); }
......
...@@ -154,6 +154,11 @@ const char* TypeFeedbackMetadata::Kind2String(FeedbackVectorSlotKind kind) { ...@@ -154,6 +154,11 @@ const char* TypeFeedbackMetadata::Kind2String(FeedbackVectorSlotKind kind) {
return "?"; return "?";
} }
FeedbackVectorSlotKind TypeFeedbackVector::GetKind(
FeedbackVectorSlot slot) const {
DCHECK(!is_empty());
return metadata()->GetKind(slot);
}
// static // static
Handle<TypeFeedbackVector> TypeFeedbackVector::New( Handle<TypeFeedbackVector> TypeFeedbackVector::New(
......
...@@ -209,7 +209,7 @@ class TypeFeedbackVector : public FixedArray { ...@@ -209,7 +209,7 @@ class TypeFeedbackVector : public FixedArray {
WriteBarrierMode mode = UPDATE_WRITE_BARRIER); WriteBarrierMode mode = UPDATE_WRITE_BARRIER);
// Returns slot kind for given slot. // Returns slot kind for given slot.
inline FeedbackVectorSlotKind GetKind(FeedbackVectorSlot slot) const; FeedbackVectorSlotKind GetKind(FeedbackVectorSlot slot) const;
static Handle<TypeFeedbackVector> New(Isolate* isolate, static Handle<TypeFeedbackVector> New(Isolate* isolate,
Handle<TypeFeedbackMetadata> metadata); Handle<TypeFeedbackMetadata> metadata);
...@@ -292,15 +292,9 @@ class TypeFeedbackMetadataIterator { ...@@ -292,15 +292,9 @@ class TypeFeedbackMetadataIterator {
slot_(FeedbackVectorSlot(0)), slot_(FeedbackVectorSlot(0)),
slot_kind_(FeedbackVectorSlotKind::INVALID) {} slot_kind_(FeedbackVectorSlotKind::INVALID) {}
bool HasNext() const { return slot_.ToInt() < metadata()->slot_count(); } inline bool HasNext() const;
FeedbackVectorSlot Next() { inline FeedbackVectorSlot Next();
DCHECK(HasNext());
FeedbackVectorSlot slot = slot_;
slot_kind_ = metadata()->GetKind(slot);
slot_ = FeedbackVectorSlot(slot_.ToInt() + entry_size());
return slot;
}
// Returns slot kind of the last slot returned by Next(). // Returns slot kind of the last slot returned by Next().
FeedbackVectorSlotKind kind() const { FeedbackVectorSlotKind kind() const {
...@@ -310,7 +304,7 @@ class TypeFeedbackMetadataIterator { ...@@ -310,7 +304,7 @@ class TypeFeedbackMetadataIterator {
} }
// Returns entry size of the last slot returned by Next(). // Returns entry size of the last slot returned by Next().
int entry_size() const { return TypeFeedbackMetadata::GetSlotSize(kind()); } inline int entry_size() const;
private: private:
TypeFeedbackMetadata* metadata() const { TypeFeedbackMetadata* metadata() const {
......
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