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() { ...@@ -649,9 +649,11 @@ void MaglevGraphBuilder::VisitLdaGlobal() {
static const int kSlotOperandIndex = 1; static const int kSlotOperandIndex = 1;
compiler::NameRef name = GetRefOperand<Name>(kNameOperandIndex); compiler::NameRef name = GetRefOperand<Name>(kNameOperandIndex);
FeedbackSlot slot = GetSlotOperand(kSlotOperandIndex);
compiler::FeedbackSource feedback_source{feedback(), slot};
const compiler::ProcessedFeedback& access_feedback = const compiler::ProcessedFeedback& access_feedback =
broker()->GetFeedbackForGlobalAccess(compiler::FeedbackSource( broker()->GetFeedbackForGlobalAccess(feedback_source);
feedback(), GetSlotOperand(kSlotOperandIndex)));
if (access_feedback.IsInsufficient()) { if (access_feedback.IsInsufficient()) {
EmitUnconditionalDeopt(); EmitUnconditionalDeopt();
...@@ -667,7 +669,7 @@ void MaglevGraphBuilder::VisitLdaGlobal() { ...@@ -667,7 +669,7 @@ void MaglevGraphBuilder::VisitLdaGlobal() {
// TODO(leszeks): Handle the IsScriptContextSlot case. // TODO(leszeks): Handle the IsScriptContextSlot case.
ValueNode* context = GetContext(); ValueNode* context = GetContext();
SetAccumulator(AddNewNode<LoadGlobal>({context}, name)); SetAccumulator(AddNewNode<LoadGlobal>({context}, name, feedback_source));
} }
} }
MAGLEV_UNIMPLEMENTED_BYTECODE(LdaGlobalInsideTypeof) MAGLEV_UNIMPLEMENTED_BYTECODE(LdaGlobalInsideTypeof)
......
...@@ -520,22 +520,16 @@ void LoadGlobal::AllocateVreg(MaglevVregAllocationState* vreg_state, ...@@ -520,22 +520,16 @@ void LoadGlobal::AllocateVreg(MaglevVregAllocationState* vreg_state,
void LoadGlobal::GenerateCode(MaglevCodeGenState* code_gen_state, void LoadGlobal::GenerateCode(MaglevCodeGenState* code_gen_state,
const ProcessingState& state) { const ProcessingState& state) {
// TODO(leszeks): Port the nice Sparkplug CallBuiltin helper. // TODO(leszeks): Port the nice Sparkplug CallBuiltin helper.
using D = CallInterfaceDescriptorFor<Builtin::kLoadGlobalIC>::type;
DCHECK_EQ(ToRegister(context()), kContextRegister); DCHECK_EQ(ToRegister(context()), kContextRegister);
// TODO(jgruber): Detect properly. __ Move(D::GetRegisterParameter(D::kName), name().object());
const int ic_kind = __ Move(D::GetRegisterParameter(D::kSlot),
static_cast<int>(FeedbackSlotKind::kLoadGlobalNotInsideTypeof); TaggedIndex::FromIntptr(feedback().index()));
__ Move(D::GetRegisterParameter(D::kVector), feedback().vector);
__ Move(LoadGlobalNoFeedbackDescriptor::GetRegisterParameter(
LoadGlobalNoFeedbackDescriptor::kName),
name().object());
__ Move(LoadGlobalNoFeedbackDescriptor::GetRegisterParameter(
LoadGlobalNoFeedbackDescriptor::kICKind),
Immediate(Smi::FromInt(ic_kind)));
// TODO(jgruber): Implement full LoadGlobal handling. __ CallBuiltin(Builtin::kLoadGlobalIC);
__ CallBuiltin(Builtin::kLoadGlobalIC_NoFeedback);
code_gen_state->DefineLazyDeoptPoint(lazy_deopt_info()); code_gen_state->DefineLazyDeoptPoint(lazy_deopt_info());
} }
void LoadGlobal::PrintParams(std::ostream& os, void LoadGlobal::PrintParams(std::ostream& os,
......
...@@ -1731,14 +1731,17 @@ class LoadGlobal : public FixedInputValueNodeT<1, LoadGlobal> { ...@@ -1731,14 +1731,17 @@ class LoadGlobal : public FixedInputValueNodeT<1, LoadGlobal> {
using Base = FixedInputValueNodeT<1, LoadGlobal>; using Base = FixedInputValueNodeT<1, LoadGlobal>;
public: public:
explicit LoadGlobal(uint32_t bitfield, const compiler::NameRef& name) explicit LoadGlobal(uint32_t bitfield, const compiler::NameRef& name,
: Base(bitfield), name_(name) {} const compiler::FeedbackSource& feedback)
: Base(bitfield), name_(name), feedback_(feedback) {}
// The implementation currently calls runtime. // The implementation currently calls runtime.
static constexpr OpProperties kProperties = OpProperties::JSCall(); static constexpr OpProperties kProperties = OpProperties::JSCall();
Input& context() { return input(0); }
const compiler::NameRef& name() const { return name_; } const compiler::NameRef& name() const { return name_; }
compiler::FeedbackSource feedback() const { return feedback_; }
Input& context() { return input(0); }
void AllocateVreg(MaglevVregAllocationState*, const ProcessingState&); void AllocateVreg(MaglevVregAllocationState*, const ProcessingState&);
void GenerateCode(MaglevCodeGenState*, const ProcessingState&); void GenerateCode(MaglevCodeGenState*, const ProcessingState&);
...@@ -1746,6 +1749,7 @@ class LoadGlobal : public FixedInputValueNodeT<1, LoadGlobal> { ...@@ -1746,6 +1749,7 @@ class LoadGlobal : public FixedInputValueNodeT<1, LoadGlobal> {
private: private:
const compiler::NameRef name_; const compiler::NameRef name_;
const compiler::FeedbackSource feedback_;
}; };
class LoadNamedGeneric : public FixedInputValueNodeT<2, LoadNamedGeneric> { 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