Commit 28fe6582 authored by Leszek Swirski's avatar Leszek Swirski Committed by V8 LUCI CQ

[maglev] Use the with-feedback LoadGlobalIC

Bug: v8:7700
Change-Id: If242def89e2ce1e7a8da3619fb514e457d83c5ff
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3702442Reviewed-by: 's avatarIgor Sheludko <ishell@chromium.org>
Commit-Queue: Leszek Swirski <leszeks@chromium.org>
Auto-Submit: Leszek Swirski <leszeks@chromium.org>
Cr-Commit-Position: refs/heads/main@{#81147}
parent 2974084a
......@@ -649,9 +649,11 @@ void MaglevGraphBuilder::VisitLdaGlobal() {
static const int kSlotOperandIndex = 1;
compiler::NameRef name = GetRefOperand<Name>(kNameOperandIndex);
FeedbackSlot slot = GetSlotOperand(kSlotOperandIndex);
compiler::FeedbackSource feedback_source{feedback(), slot};
const compiler::ProcessedFeedback& access_feedback =
broker()->GetFeedbackForGlobalAccess(compiler::FeedbackSource(
feedback(), GetSlotOperand(kSlotOperandIndex)));
broker()->GetFeedbackForGlobalAccess(feedback_source);
if (access_feedback.IsInsufficient()) {
EmitUnconditionalDeopt();
......@@ -667,7 +669,7 @@ void MaglevGraphBuilder::VisitLdaGlobal() {
// TODO(leszeks): Handle the IsScriptContextSlot case.
ValueNode* context = GetContext();
SetAccumulator(AddNewNode<LoadGlobal>({context}, name));
SetAccumulator(AddNewNode<LoadGlobal>({context}, name, feedback_source));
}
}
MAGLEV_UNIMPLEMENTED_BYTECODE(LdaGlobalInsideTypeof)
......
......@@ -520,22 +520,16 @@ void LoadGlobal::AllocateVreg(MaglevVregAllocationState* vreg_state,
void LoadGlobal::GenerateCode(MaglevCodeGenState* code_gen_state,
const ProcessingState& state) {
// TODO(leszeks): Port the nice Sparkplug CallBuiltin helper.
using D = CallInterfaceDescriptorFor<Builtin::kLoadGlobalIC>::type;
DCHECK_EQ(ToRegister(context()), kContextRegister);
// TODO(jgruber): Detect properly.
const int ic_kind =
static_cast<int>(FeedbackSlotKind::kLoadGlobalNotInsideTypeof);
__ Move(LoadGlobalNoFeedbackDescriptor::GetRegisterParameter(
LoadGlobalNoFeedbackDescriptor::kName),
name().object());
__ Move(LoadGlobalNoFeedbackDescriptor::GetRegisterParameter(
LoadGlobalNoFeedbackDescriptor::kICKind),
Immediate(Smi::FromInt(ic_kind)));
__ Move(D::GetRegisterParameter(D::kName), name().object());
__ Move(D::GetRegisterParameter(D::kSlot),
TaggedIndex::FromIntptr(feedback().index()));
__ Move(D::GetRegisterParameter(D::kVector), feedback().vector);
// TODO(jgruber): Implement full LoadGlobal handling.
__ CallBuiltin(Builtin::kLoadGlobalIC_NoFeedback);
__ CallBuiltin(Builtin::kLoadGlobalIC);
code_gen_state->DefineLazyDeoptPoint(lazy_deopt_info());
}
void LoadGlobal::PrintParams(std::ostream& os,
......
......@@ -1731,14 +1731,17 @@ class LoadGlobal : public FixedInputValueNodeT<1, LoadGlobal> {
using Base = FixedInputValueNodeT<1, LoadGlobal>;
public:
explicit LoadGlobal(uint32_t bitfield, const compiler::NameRef& name)
: Base(bitfield), name_(name) {}
explicit LoadGlobal(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();
Input& context() { return input(0); }
const compiler::NameRef& name() const { return name_; }
compiler::FeedbackSource feedback() const { return feedback_; }
Input& context() { return input(0); }
void AllocateVreg(MaglevVregAllocationState*, const ProcessingState&);
void GenerateCode(MaglevCodeGenState*, const ProcessingState&);
......@@ -1746,6 +1749,7 @@ class LoadGlobal : public FixedInputValueNodeT<1, LoadGlobal> {
private:
const compiler::NameRef name_;
const compiler::FeedbackSource feedback_;
};
class LoadNamedGeneric : public FixedInputValueNodeT<2, LoadNamedGeneric> {
......
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