Commit 1deba1a2 authored by Leszek Swirski's avatar Leszek Swirski Committed by V8 LUCI CQ

[maglev] Allow LoadNamedGeneric to collect feedback

Use the LoadIC builtin instead of LoadICNoFeedback.

Bug: v8:7700
Change-Id: Ia7833d7f0a7165dbbf1bbdbae55f44ce213c65ab
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3579104
Commit-Queue: Leszek Swirski <leszeks@chromium.org>
Auto-Submit: Leszek Swirski <leszeks@chromium.org>
Reviewed-by: 's avatarVictor Gomes <victorgomes@chromium.org>
Commit-Queue: Victor Gomes <victorgomes@chromium.org>
Cr-Commit-Position: refs/heads/main@{#79876}
parent 7b3ef3bc
......@@ -320,7 +320,8 @@ MAGLEV_UNIMPLEMENTED_BYTECODE(StaLookupSlot)
void MaglevGraphBuilder::VisitGetNamedProperty() {
// GetNamedProperty <object> <name_index> <slot>
ValueNode* object = LoadRegister(0);
FeedbackNexus nexus = feedback_nexus(2);
FeedbackSlot slot_index = GetSlotOperand(2);
FeedbackNexus nexus(feedback().object(), slot_index);
if (nexus.ic_state() == InlineCacheState::UNINITIALIZED) {
AddNewNode<EagerDeopt>({});
......@@ -345,7 +346,9 @@ void MaglevGraphBuilder::VisitGetNamedProperty() {
ValueNode* context = GetContext();
compiler::NameRef name = GetRefOperand<Name>(1);
SetAccumulatorToNewNode<LoadNamedGeneric>({context, object}, name);
SetAccumulatorToNewNode<LoadNamedGeneric>(
{context, object}, name,
compiler::FeedbackSource{feedback(), slot_index});
}
MAGLEV_UNIMPLEMENTED_BYTECODE(GetNamedPropertyFromSuper)
......
......@@ -585,21 +585,21 @@ void StoreField::PrintParams(std::ostream& os,
void LoadNamedGeneric::AllocateVreg(MaglevVregAllocationState* vreg_state,
const ProcessingState& state) {
using D = LoadNoFeedbackDescriptor;
using D = LoadWithVectorDescriptor;
UseFixed(context(), kContextRegister);
UseFixed(object_input(), D::GetRegisterParameter(D::kReceiver));
DefineAsFixed(vreg_state, this, kReturnRegister0);
}
void LoadNamedGeneric::GenerateCode(MaglevCodeGenState* code_gen_state,
const ProcessingState& state) {
using D = LoadNoFeedbackDescriptor;
const int ic_kind = static_cast<int>(FeedbackSlotKind::kLoadProperty);
using D = LoadWithVectorDescriptor;
DCHECK_EQ(ToRegister(context()), kContextRegister);
DCHECK_EQ(ToRegister(object_input()), D::GetRegisterParameter(D::kReceiver));
__ Move(D::GetRegisterParameter(D::kName), name().object());
__ Move(D::GetRegisterParameter(D::kICKind),
Immediate(Smi::FromInt(ic_kind)));
__ CallBuiltin(Builtin::kLoadIC_NoFeedback);
__ Move(D::GetRegisterParameter(D::kSlot),
Smi::FromInt(feedback().slot.ToInt()));
__ Move(D::GetRegisterParameter(D::kVector), feedback().vector);
__ CallBuiltin(Builtin::kLoadIC);
}
void LoadNamedGeneric::PrintParams(std::ostream& os,
MaglevGraphLabeller* graph_labeller) const {
......
......@@ -1163,13 +1163,15 @@ class LoadNamedGeneric : public FixedInputValueNodeT<2, LoadNamedGeneric> {
using Base = FixedInputValueNodeT<2, LoadNamedGeneric>;
public:
explicit LoadNamedGeneric(uint32_t bitfield, const compiler::NameRef& name)
: Base(bitfield), name_(name) {}
explicit LoadNamedGeneric(uint32_t bitfield, const compiler::NameRef& name,
const compiler::FeedbackSource& feedback)
: Base(bitfield), name_(name), feedback_(feedback) {}
// The implementation currently calls runtime.
static constexpr OpProperties kProperties = OpProperties::JSCall();
compiler::NameRef name() const { return name_; }
compiler::FeedbackSource feedback() const { return feedback_; }
static constexpr int kContextIndex = 0;
static constexpr int kObjectIndex = 1;
......@@ -1182,6 +1184,7 @@ class LoadNamedGeneric : public FixedInputValueNodeT<2, LoadNamedGeneric> {
private:
const compiler::NameRef name_;
const compiler::FeedbackSource feedback_;
};
class GapMove : public FixedInputNodeT<0, GapMove> {
......
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