[ic] Fix printing GlobalIC handlers

Change-Id: I585d23ed5367c20838aa856b68c1ef7d776c18c0
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/4078985
Reviewed-by: Igor Sheludko <ishell@chromium.org>
Commit-Queue: Marja Hölttä <marja@chromium.org>
Cr-Commit-Position: refs/heads/main@{#84738}
This commit is contained in:
Marja Hölttä 2022-12-08 16:56:36 +01:00 committed by V8 LUCI CQ
parent 42ef178c3d
commit 7bcac055b5
2 changed files with 34 additions and 7 deletions

View File

@ -1259,29 +1259,45 @@ void FeedbackVector::FeedbackSlotPrint(std::ostream& os, FeedbackSlot slot) {
}
void FeedbackNexus::Print(std::ostream& os) {
switch (kind()) {
auto slot_kind = kind();
switch (slot_kind) {
case FeedbackSlotKind::kCall:
case FeedbackSlotKind::kCloneObject:
case FeedbackSlotKind::kDefineKeyedOwn:
case FeedbackSlotKind::kHasKeyed:
case FeedbackSlotKind::kInstanceOf:
case FeedbackSlotKind::kDefineKeyedOwnPropertyInLiteral:
case FeedbackSlotKind::kStoreGlobalSloppy:
case FeedbackSlotKind::kStoreGlobalStrict:
case FeedbackSlotKind::kStoreInArrayLiteral:
case FeedbackSlotKind::kDefineNamedOwn: {
os << InlineCacheState2String(ic_state());
break;
}
case FeedbackSlotKind::kLoadGlobalInsideTypeof:
case FeedbackSlotKind::kLoadGlobalNotInsideTypeof: {
case FeedbackSlotKind::kLoadGlobalNotInsideTypeof:
case FeedbackSlotKind::kStoreGlobalSloppy:
case FeedbackSlotKind::kStoreGlobalStrict: {
os << InlineCacheState2String(ic_state());
if (ic_state() == InlineCacheState::MONOMORPHIC) {
os << "\n ";
if (GetFeedback().GetHeapObjectOrSmi().IsPropertyCell()) {
if (GetFeedback().IsCleared()) {
// Handler mode: feedback is the cleared value, extra is the handler.
if (IsLoadGlobalICKind(slot_kind)) {
LoadHandler::PrintHandler(GetFeedbackExtra().GetHeapObjectOrSmi(),
os);
} else {
StoreHandler::PrintHandler(GetFeedbackExtra().GetHeapObjectOrSmi(),
os);
}
} else if (GetFeedback().GetHeapObjectOrSmi().IsPropertyCell()) {
os << Brief(GetFeedback());
} else {
LoadHandler::PrintHandler(GetFeedback().GetHeapObjectOrSmi(), os);
// Lexical variable mode: the variable location is encoded in the SMI.
int handler = GetFeedback().GetHeapObjectOrSmi().ToSmi().value();
os << (IsLoadGlobalICKind(slot_kind) ? "Load" : "Store");
os << "Handler(Lexical variable mode)(context ix = "
<< FeedbackNexus::ContextIndexBits::decode(handler)
<< ", slot ix = " << FeedbackNexus::SlotIndexBits::decode(handler)
<< ")";
}
}
break;

View File

@ -3365,7 +3365,9 @@ void AccessorAssembler::LoadGlobalIC_TryPropertyCellCase(
BIND(&if_property_cell);
{
// Load value or try handler case if the weak reference is cleared.
// This branch also handles the "handler mode": the weak reference is
// cleared, the feedback extra is the handler. In that case we jump to
// try_handler. (See FeedbackNexus::ConfigureHandlerMode.)
CSA_DCHECK(this, IsWeakOrCleared(maybe_weak_ref));
TNode<PropertyCell> property_cell =
CAST(GetHeapObjectAssumeWeak(maybe_weak_ref, try_handler));
@ -3377,6 +3379,9 @@ void AccessorAssembler::LoadGlobalIC_TryPropertyCellCase(
BIND(&if_lexical_var);
{
// This branch handles the "lexical variable mode": the feedback is a SMI
// encoding the variable location. (See
// FeedbackNexus::ConfigureLexicalVarMode.)
Comment("Load lexical variable");
TNode<IntPtrT> lexical_handler = SmiUntag(CAST(maybe_weak_ref));
TNode<IntPtrT> context_index =
@ -3805,6 +3810,9 @@ void AccessorAssembler::StoreGlobalIC(const StoreICParameters* pp) {
{
Label try_handler(this), miss(this, Label::kDeferred);
// This branch also handles the "handler mode": the weak reference is
// cleared, the feedback extra is the handler. In that case we jump to
// try_handler. (See FeedbackNexus::ConfigureHandlerMode.)
CSA_DCHECK(this, IsWeakOrCleared(maybe_weak_ref));
TNode<PropertyCell> property_cell =
CAST(GetHeapObjectAssumeWeak(maybe_weak_ref, &try_handler));
@ -3841,6 +3849,9 @@ void AccessorAssembler::StoreGlobalIC(const StoreICParameters* pp) {
BIND(&if_lexical_var);
{
// This branch handles the "lexical variable mode": the feedback is a SMI
// encoding the variable location. (See
// FeedbackNexus::ConfigureLexicalVarMode.)
Comment("Store lexical variable");
TNode<IntPtrT> lexical_handler = SmiUntag(CAST(maybe_weak_ref));
TNode<IntPtrT> context_index =