Commit 4679e4c0 authored by Jakob Gruber's avatar Jakob Gruber Committed by V8 LUCI CQ

[osr] Allocate feedback vector slots for JumpLoop

These will soon be used to store cached OSR code.

Bug: v8:12161
Change-Id: I49b6f1cd648e1fd033ac09b2e590bc185f5461e7
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3596165
Commit-Queue: Jakob Linke <jgruber@chromium.org>
Auto-Submit: Jakob Linke <jgruber@chromium.org>
Reviewed-by: 's avatarLeszek Swirski <leszeks@chromium.org>
Commit-Queue: Leszek Swirski <leszeks@chromium.org>
Cr-Commit-Position: refs/heads/main@{#80045}
parent 71ed79be
......@@ -665,7 +665,7 @@ void FeedbackMetadata::FeedbackMetadataVerify(Isolate* isolate) {
iter.Next();
FeedbackSlotKind kind = iter.kind();
CHECK_NE(FeedbackSlotKind::kInvalid, kind);
CHECK_GT(FeedbackSlotKind::kKindsNumber, kind);
CHECK_GT(kFeedbackSlotKindCount, kind);
}
}
}
......
......@@ -1274,8 +1274,10 @@ void FeedbackNexus::Print(std::ostream& os) {
case FeedbackSlotKind::kLiteral:
case FeedbackSlotKind::kTypeProfile:
break;
case FeedbackSlotKind::kJumpLoop:
os << "JumpLoop";
break;
case FeedbackSlotKind::kInvalid:
case FeedbackSlotKind::kKindsNumber:
UNREACHABLE();
}
}
......
......@@ -71,6 +71,7 @@ int FeedbackMetadata::GetSlotSize(FeedbackSlotKind kind) {
case FeedbackSlotKind::kBinaryOp:
case FeedbackSlotKind::kLiteral:
case FeedbackSlotKind::kTypeProfile:
case FeedbackSlotKind::kJumpLoop:
return 1;
case FeedbackSlotKind::kCall:
......@@ -93,10 +94,8 @@ int FeedbackMetadata::GetSlotSize(FeedbackSlotKind kind) {
return 2;
case FeedbackSlotKind::kInvalid:
case FeedbackSlotKind::kKindsNumber:
UNREACHABLE();
}
return 1;
}
Handle<FeedbackCell> ClosureFeedbackCellArray::GetFeedbackCell(int index) {
......
......@@ -192,10 +192,9 @@ const char* FeedbackMetadata::Kind2String(FeedbackSlotKind kind) {
return "InstanceOf";
case FeedbackSlotKind::kCloneObject:
return "CloneObject";
case FeedbackSlotKind::kKindsNumber:
break;
case FeedbackSlotKind::kJumpLoop:
return "JumpLoop";
}
UNREACHABLE();
}
bool FeedbackMetadata::HasTypeProfileSlot() const {
......@@ -282,6 +281,7 @@ Handle<FeedbackVector> FeedbackVector::New(
case FeedbackSlotKind::kLoadGlobalNotInsideTypeof:
case FeedbackSlotKind::kStoreGlobalSloppy:
case FeedbackSlotKind::kStoreGlobalStrict:
case FeedbackSlotKind::kJumpLoop:
vector->Set(slot, HeapObjectReference::ClearedValue(isolate),
SKIP_WRITE_BARRIER);
break;
......@@ -315,7 +315,6 @@ Handle<FeedbackVector> FeedbackVector::New(
break;
case FeedbackSlotKind::kInvalid:
case FeedbackSlotKind::kKindsNumber:
UNREACHABLE();
}
for (int j = 1; j < entry_size; j++) {
......@@ -550,22 +549,19 @@ void FeedbackNexus::ConfigureUninitialized() {
case FeedbackSlotKind::kStoreGlobalSloppy:
case FeedbackSlotKind::kStoreGlobalStrict:
case FeedbackSlotKind::kLoadGlobalNotInsideTypeof:
case FeedbackSlotKind::kLoadGlobalInsideTypeof: {
case FeedbackSlotKind::kLoadGlobalInsideTypeof:
SetFeedback(HeapObjectReference::ClearedValue(isolate),
SKIP_WRITE_BARRIER, UninitializedSentinel(),
SKIP_WRITE_BARRIER);
break;
}
case FeedbackSlotKind::kCloneObject:
case FeedbackSlotKind::kCall: {
case FeedbackSlotKind::kCall:
SetFeedback(UninitializedSentinel(), SKIP_WRITE_BARRIER, Smi::zero(),
SKIP_WRITE_BARRIER);
break;
}
case FeedbackSlotKind::kInstanceOf: {
case FeedbackSlotKind::kInstanceOf:
SetFeedback(UninitializedSentinel(), SKIP_WRITE_BARRIER);
break;
}
case FeedbackSlotKind::kSetNamedSloppy:
case FeedbackSlotKind::kSetNamedStrict:
case FeedbackSlotKind::kSetKeyedSloppy:
......@@ -576,11 +572,14 @@ void FeedbackNexus::ConfigureUninitialized() {
case FeedbackSlotKind::kLoadProperty:
case FeedbackSlotKind::kLoadKeyed:
case FeedbackSlotKind::kHasKeyed:
case FeedbackSlotKind::kDefineKeyedOwnPropertyInLiteral: {
case FeedbackSlotKind::kDefineKeyedOwnPropertyInLiteral:
SetFeedback(UninitializedSentinel(), SKIP_WRITE_BARRIER,
UninitializedSentinel(), SKIP_WRITE_BARRIER);
break;
}
case FeedbackSlotKind::kJumpLoop:
SetFeedback(HeapObjectReference::ClearedValue(isolate),
SKIP_WRITE_BARRIER);
break;
default:
UNREACHABLE();
}
......@@ -623,6 +622,7 @@ bool FeedbackNexus::Clear() {
case FeedbackSlotKind::kInstanceOf:
case FeedbackSlotKind::kDefineKeyedOwnPropertyInLiteral:
case FeedbackSlotKind::kCloneObject:
case FeedbackSlotKind::kJumpLoop:
if (!IsCleared()) {
ConfigureUninitialized();
feedback_updated = true;
......@@ -630,7 +630,6 @@ bool FeedbackNexus::Clear() {
break;
case FeedbackSlotKind::kInvalid:
case FeedbackSlotKind::kKindsNumber:
UNREACHABLE();
}
return feedback_updated;
......@@ -692,7 +691,8 @@ InlineCacheState FeedbackNexus::ic_state() const {
case FeedbackSlotKind::kStoreGlobalSloppy:
case FeedbackSlotKind::kStoreGlobalStrict:
case FeedbackSlotKind::kLoadGlobalNotInsideTypeof:
case FeedbackSlotKind::kLoadGlobalInsideTypeof: {
case FeedbackSlotKind::kLoadGlobalInsideTypeof:
case FeedbackSlotKind::kJumpLoop: {
if (feedback->IsSmi()) return InlineCacheState::MONOMORPHIC;
DCHECK(feedback->IsWeakOrCleared());
......@@ -834,7 +834,6 @@ InlineCacheState FeedbackNexus::ic_state() const {
}
case FeedbackSlotKind::kInvalid:
case FeedbackSlotKind::kKindsNumber:
UNREACHABLE();
}
return InlineCacheState::UNINITIALIZED;
......
......@@ -61,10 +61,14 @@ enum class FeedbackSlotKind : uint8_t {
kForIn,
kInstanceOf,
kCloneObject,
kJumpLoop,
kKindsNumber // Last value indicating number of kinds.
kLast = kJumpLoop // Always update this if the list above changes.
};
static constexpr int kFeedbackSlotKindCount =
static_cast<int>(FeedbackSlotKind::kLast) + 1;
using MapAndHandler = std::pair<Handle<Map>, MaybeObjectHandle>;
using MapAndFeedback = std::pair<Handle<Map>, MaybeObjectHandle>;
......@@ -470,6 +474,10 @@ class V8_EXPORT_PRIVATE FeedbackVectorSpec {
return AddSlot(FeedbackSlotKind::kCloneObject);
}
FeedbackSlot AddJumpLoopSlot() {
return AddSlot(FeedbackSlotKind::kJumpLoop);
}
#ifdef OBJECT_PRINT
// For gdb debugging.
void Print();
......@@ -581,8 +589,7 @@ class FeedbackMetadata : public HeapObject {
inline int length() const;
static const int kFeedbackSlotKindBits = 5;
STATIC_ASSERT(static_cast<int>(FeedbackSlotKind::kKindsNumber) <
(1 << kFeedbackSlotKindBits));
STATIC_ASSERT(kFeedbackSlotKindCount <= (1 << kFeedbackSlotKindBits));
void SetKind(FeedbackSlot slot, FeedbackSlotKind kind);
......@@ -619,7 +626,6 @@ class FeedbackMetadataIterator {
// Returns slot kind of the last slot returned by Next().
FeedbackSlotKind kind() const {
DCHECK_NE(FeedbackSlotKind::kInvalid, slot_kind_);
DCHECK_NE(FeedbackSlotKind::kKindsNumber, slot_kind_);
return slot_kind_;
}
......
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