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 {
}
FeedbackVectorSlotKind TypeFeedbackVector::GetKind(
FeedbackVectorSlot slot) const {
DCHECK(!is_empty());
return metadata()->GetKind(slot);
}
// static
int TypeFeedbackVector::GetIndex(FeedbackVectorSlot slot) {
return kReservedIndexCount + slot.ToInt();
......@@ -153,6 +147,21 @@ Symbol* TypeFeedbackVector::RawUninitializedSentinel(Isolate* isolate) {
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()); }
......
......@@ -154,6 +154,11 @@ const char* TypeFeedbackMetadata::Kind2String(FeedbackVectorSlotKind kind) {
return "?";
}
FeedbackVectorSlotKind TypeFeedbackVector::GetKind(
FeedbackVectorSlot slot) const {
DCHECK(!is_empty());
return metadata()->GetKind(slot);
}
// static
Handle<TypeFeedbackVector> TypeFeedbackVector::New(
......
......@@ -209,7 +209,7 @@ class TypeFeedbackVector : public FixedArray {
WriteBarrierMode mode = UPDATE_WRITE_BARRIER);
// Returns slot kind for given slot.
inline FeedbackVectorSlotKind GetKind(FeedbackVectorSlot slot) const;
FeedbackVectorSlotKind GetKind(FeedbackVectorSlot slot) const;
static Handle<TypeFeedbackVector> New(Isolate* isolate,
Handle<TypeFeedbackMetadata> metadata);
......@@ -292,15 +292,9 @@ class TypeFeedbackMetadataIterator {
slot_(FeedbackVectorSlot(0)),
slot_kind_(FeedbackVectorSlotKind::INVALID) {}
bool HasNext() const { return slot_.ToInt() < metadata()->slot_count(); }
inline bool HasNext() const;
FeedbackVectorSlot Next() {
DCHECK(HasNext());
FeedbackVectorSlot slot = slot_;
slot_kind_ = metadata()->GetKind(slot);
slot_ = FeedbackVectorSlot(slot_.ToInt() + entry_size());
return slot;
}
inline FeedbackVectorSlot Next();
// Returns slot kind of the last slot returned by Next().
FeedbackVectorSlotKind kind() const {
......@@ -310,7 +304,7 @@ class TypeFeedbackMetadataIterator {
}
// Returns entry size of the last slot returned by Next().
int entry_size() const { return TypeFeedbackMetadata::GetSlotSize(kind()); }
inline int entry_size() const;
private:
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