[maglev] Add generic GetKeyedProperty handling
Bug: v8:7700 Change-Id: I1f552587403bdec439c611d56d6bf4c54508a76f Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3702802 Reviewed-by: Igor Sheludko <ishell@chromium.org> Commit-Queue: Igor Sheludko <ishell@chromium.org> Auto-Submit: Leszek Swirski <leszeks@chromium.org> Cr-Commit-Position: refs/heads/main@{#81156}
This commit is contained in:
parent
c26dd2e32b
commit
194192b539
@ -4,6 +4,7 @@
|
||||
|
||||
#include "src/maglev/maglev-graph-builder.h"
|
||||
|
||||
#include "src/base/optional.h"
|
||||
#include "src/base/v8-fallthrough.h"
|
||||
#include "src/common/globals.h"
|
||||
#include "src/compiler/compilation-dependencies.h"
|
||||
@ -816,7 +817,33 @@ void MaglevGraphBuilder::VisitGetNamedProperty() {
|
||||
}
|
||||
|
||||
MAGLEV_UNIMPLEMENTED_BYTECODE(GetNamedPropertyFromSuper)
|
||||
MAGLEV_UNIMPLEMENTED_BYTECODE(GetKeyedProperty)
|
||||
|
||||
void MaglevGraphBuilder::VisitGetKeyedProperty() {
|
||||
// GetKeyedProperty <object> <slot>
|
||||
ValueNode* object = LoadRegisterTagged(0);
|
||||
ValueNode* key = GetAccumulatorTagged();
|
||||
FeedbackSlot slot = GetSlotOperand(1);
|
||||
compiler::FeedbackSource feedback_source{feedback(), slot};
|
||||
|
||||
const compiler::ProcessedFeedback& processed_feedback =
|
||||
broker()->GetFeedbackForPropertyAccess(
|
||||
feedback_source, compiler::AccessMode::kLoad, base::nullopt);
|
||||
|
||||
switch (processed_feedback.kind()) {
|
||||
case compiler::ProcessedFeedback::kInsufficient:
|
||||
EmitUnconditionalDeopt();
|
||||
return;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
// Create a generic store in the fallthrough.
|
||||
ValueNode* context = GetContext();
|
||||
SetAccumulator(
|
||||
AddNewNode<GetKeyedGeneric>({context, object, key}, feedback_source));
|
||||
}
|
||||
|
||||
MAGLEV_UNIMPLEMENTED_BYTECODE(LdaModuleVariable)
|
||||
MAGLEV_UNIMPLEMENTED_BYTECODE(StaModuleVariable)
|
||||
|
||||
|
@ -136,6 +136,7 @@ class MaglevGraphVerifier {
|
||||
break;
|
||||
case Opcode::kSetNamedGeneric:
|
||||
case Opcode::kDefineNamedOwnGeneric:
|
||||
case Opcode::kGetKeyedGeneric:
|
||||
DCHECK_EQ(node->input_count(), 3);
|
||||
CheckValueInputIs(node, 0, ValueRepresentation::kTagged);
|
||||
CheckValueInputIs(node, 1, ValueRepresentation::kTagged);
|
||||
|
@ -825,6 +825,27 @@ void DefineNamedOwnGeneric::PrintParams(
|
||||
os << "(" << name_ << ")";
|
||||
}
|
||||
|
||||
void GetKeyedGeneric::AllocateVreg(MaglevVregAllocationState* vreg_state,
|
||||
const ProcessingState& state) {
|
||||
using D = CallInterfaceDescriptorFor<Builtin::kKeyedLoadIC>::type;
|
||||
UseFixed(context(), kContextRegister);
|
||||
UseFixed(object_input(), D::GetRegisterParameter(D::kReceiver));
|
||||
UseFixed(key_input(), D::GetRegisterParameter(D::kName));
|
||||
DefineAsFixed(vreg_state, this, kReturnRegister0);
|
||||
}
|
||||
void GetKeyedGeneric::GenerateCode(MaglevCodeGenState* code_gen_state,
|
||||
const ProcessingState& state) {
|
||||
using D = CallInterfaceDescriptorFor<Builtin::kKeyedLoadIC>::type;
|
||||
DCHECK_EQ(ToRegister(context()), kContextRegister);
|
||||
DCHECK_EQ(ToRegister(object_input()), D::GetRegisterParameter(D::kReceiver));
|
||||
DCHECK_EQ(ToRegister(key_input()), D::GetRegisterParameter(D::kName));
|
||||
__ Move(D::GetRegisterParameter(D::kSlot),
|
||||
TaggedIndex::FromIntptr(feedback().slot.ToInt()));
|
||||
__ Move(D::GetRegisterParameter(D::kVector), feedback().vector);
|
||||
__ CallBuiltin(Builtin::kKeyedLoadIC);
|
||||
code_gen_state->DefineLazyDeoptPoint(lazy_deopt_info());
|
||||
}
|
||||
|
||||
void GapMove::AllocateVreg(MaglevVregAllocationState* vreg_state,
|
||||
const ProcessingState& state) {
|
||||
UNREACHABLE();
|
||||
|
@ -126,6 +126,7 @@ class CompactInterpreterFrameState;
|
||||
V(LoadNamedGeneric) \
|
||||
V(SetNamedGeneric) \
|
||||
V(DefineNamedOwnGeneric) \
|
||||
V(GetKeyedGeneric) \
|
||||
V(Phi) \
|
||||
V(RegisterInput) \
|
||||
V(CheckedSmiTag) \
|
||||
@ -1842,6 +1843,34 @@ class DefineNamedOwnGeneric
|
||||
const compiler::FeedbackSource feedback_;
|
||||
};
|
||||
|
||||
class GetKeyedGeneric : public FixedInputValueNodeT<3, GetKeyedGeneric> {
|
||||
using Base = FixedInputValueNodeT<3, GetKeyedGeneric>;
|
||||
|
||||
public:
|
||||
explicit GetKeyedGeneric(uint32_t bitfield,
|
||||
const compiler::FeedbackSource& feedback)
|
||||
: Base(bitfield), feedback_(feedback) {}
|
||||
|
||||
// The implementation currently calls runtime.
|
||||
static constexpr OpProperties kProperties = OpProperties::JSCall();
|
||||
|
||||
compiler::FeedbackSource feedback() const { return feedback_; }
|
||||
|
||||
static constexpr int kContextIndex = 0;
|
||||
static constexpr int kObjectIndex = 1;
|
||||
static constexpr int kKeyIndex = 2;
|
||||
Input& context() { return input(kContextIndex); }
|
||||
Input& object_input() { return input(kObjectIndex); }
|
||||
Input& key_input() { return input(kKeyIndex); }
|
||||
|
||||
void AllocateVreg(MaglevVregAllocationState*, const ProcessingState&);
|
||||
void GenerateCode(MaglevCodeGenState*, const ProcessingState&);
|
||||
void PrintParams(std::ostream&, MaglevGraphLabeller*) const {}
|
||||
|
||||
private:
|
||||
const compiler::FeedbackSource feedback_;
|
||||
};
|
||||
|
||||
class GapMove : public FixedInputNodeT<0, GapMove> {
|
||||
using Base = FixedInputNodeT<0, GapMove>;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user