[maglev] Add a generic StoreNamed node
Bug: v8:7700 Change-Id: I44b5fd2172522034bfe9566ab314dc93e05b2e80 Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3610425 Commit-Queue: Victor Gomes <victorgomes@chromium.org> Auto-Submit: Leszek Swirski <leszeks@chromium.org> Reviewed-by: Victor Gomes <victorgomes@chromium.org> Cr-Commit-Position: refs/heads/main@{#80225}
This commit is contained in:
parent
10a8e20fd9
commit
750b5f37fb
@ -607,8 +607,11 @@ void MaglevGraphBuilder::VisitSetNamedProperty() {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO(victorgomes): Generic store.
|
// Create a generic store in the fallthrough.
|
||||||
MAGLEV_UNIMPLEMENTED(VisitSetNamedProperty);
|
ValueNode* context = GetContext();
|
||||||
|
ValueNode* value = GetAccumulatorTagged();
|
||||||
|
SetAccumulator(AddNewNode<SetNamedGeneric>({context, object, value}, name,
|
||||||
|
feedback_source));
|
||||||
}
|
}
|
||||||
|
|
||||||
MAGLEV_UNIMPLEMENTED_BYTECODE(DefineNamedOwnProperty)
|
MAGLEV_UNIMPLEMENTED_BYTECODE(DefineNamedOwnProperty)
|
||||||
|
@ -128,6 +128,12 @@ class MaglevGraphVerifier {
|
|||||||
CheckValueInputIs(node, 0, ValueRepresentation::kTagged);
|
CheckValueInputIs(node, 0, ValueRepresentation::kTagged);
|
||||||
CheckValueInputIs(node, 1, ValueRepresentation::kTagged);
|
CheckValueInputIs(node, 1, ValueRepresentation::kTagged);
|
||||||
break;
|
break;
|
||||||
|
case Opcode::kSetNamedGeneric:
|
||||||
|
DCHECK_EQ(node->input_count(), 3);
|
||||||
|
CheckValueInputIs(node, 0, ValueRepresentation::kTagged);
|
||||||
|
CheckValueInputIs(node, 1, ValueRepresentation::kTagged);
|
||||||
|
CheckValueInputIs(node, 2, ValueRepresentation::kTagged);
|
||||||
|
break;
|
||||||
case Opcode::kInt32AddWithOverflow:
|
case Opcode::kInt32AddWithOverflow:
|
||||||
DCHECK_EQ(node->input_count(), 2);
|
DCHECK_EQ(node->input_count(), 2);
|
||||||
CheckValueInputIs(node, 0, ValueRepresentation::kInt32);
|
CheckValueInputIs(node, 0, ValueRepresentation::kInt32);
|
||||||
|
@ -621,6 +621,31 @@ void LoadNamedGeneric::PrintParams(std::ostream& os,
|
|||||||
os << "(" << name_ << ")";
|
os << "(" << name_ << ")";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SetNamedGeneric::AllocateVreg(MaglevVregAllocationState* vreg_state,
|
||||||
|
const ProcessingState& state) {
|
||||||
|
using D = StoreWithVectorDescriptor;
|
||||||
|
UseFixed(context(), kContextRegister);
|
||||||
|
UseFixed(object_input(), D::GetRegisterParameter(D::kReceiver));
|
||||||
|
UseFixed(value_input(), D::GetRegisterParameter(D::kValue));
|
||||||
|
DefineAsFixed(vreg_state, this, kReturnRegister0);
|
||||||
|
}
|
||||||
|
void SetNamedGeneric::GenerateCode(MaglevCodeGenState* code_gen_state,
|
||||||
|
const ProcessingState& state) {
|
||||||
|
using D = StoreWithVectorDescriptor;
|
||||||
|
DCHECK_EQ(ToRegister(context()), kContextRegister);
|
||||||
|
DCHECK_EQ(ToRegister(object_input()), D::GetRegisterParameter(D::kReceiver));
|
||||||
|
DCHECK_EQ(ToRegister(value_input()), D::GetRegisterParameter(D::kValue));
|
||||||
|
__ Move(D::GetRegisterParameter(D::kName), name().object());
|
||||||
|
__ Move(D::GetRegisterParameter(D::kSlot),
|
||||||
|
Smi::FromInt(feedback().slot.ToInt()));
|
||||||
|
__ Move(D::GetRegisterParameter(D::kVector), feedback().vector);
|
||||||
|
__ CallBuiltin(Builtin::kStoreIC);
|
||||||
|
}
|
||||||
|
void SetNamedGeneric::PrintParams(std::ostream& os,
|
||||||
|
MaglevGraphLabeller* graph_labeller) const {
|
||||||
|
os << "(" << name_ << ")";
|
||||||
|
}
|
||||||
|
|
||||||
void GapMove::AllocateVreg(MaglevVregAllocationState* vreg_state,
|
void GapMove::AllocateVreg(MaglevVregAllocationState* vreg_state,
|
||||||
const ProcessingState& state) {
|
const ProcessingState& state) {
|
||||||
UNREACHABLE();
|
UNREACHABLE();
|
||||||
|
@ -73,6 +73,7 @@ class CompactInterpreterFrameState;
|
|||||||
V(LoadDoubleField) \
|
V(LoadDoubleField) \
|
||||||
V(LoadGlobal) \
|
V(LoadGlobal) \
|
||||||
V(LoadNamedGeneric) \
|
V(LoadNamedGeneric) \
|
||||||
|
V(SetNamedGeneric) \
|
||||||
V(Phi) \
|
V(Phi) \
|
||||||
V(RegisterInput) \
|
V(RegisterInput) \
|
||||||
V(RootConstant) \
|
V(RootConstant) \
|
||||||
@ -1393,6 +1394,36 @@ class LoadNamedGeneric : public FixedInputValueNodeT<2, LoadNamedGeneric> {
|
|||||||
const compiler::FeedbackSource feedback_;
|
const compiler::FeedbackSource feedback_;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class SetNamedGeneric : public FixedInputValueNodeT<3, SetNamedGeneric> {
|
||||||
|
using Base = FixedInputValueNodeT<3, SetNamedGeneric>;
|
||||||
|
|
||||||
|
public:
|
||||||
|
explicit SetNamedGeneric(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;
|
||||||
|
static constexpr int kValueIndex = 2;
|
||||||
|
Input& context() { return input(kContextIndex); }
|
||||||
|
Input& object_input() { return input(kObjectIndex); }
|
||||||
|
Input& value_input() { return input(kValueIndex); }
|
||||||
|
|
||||||
|
void AllocateVreg(MaglevVregAllocationState*, const ProcessingState&);
|
||||||
|
void GenerateCode(MaglevCodeGenState*, const ProcessingState&);
|
||||||
|
void PrintParams(std::ostream&, MaglevGraphLabeller*) const;
|
||||||
|
|
||||||
|
private:
|
||||||
|
const compiler::NameRef name_;
|
||||||
|
const compiler::FeedbackSource feedback_;
|
||||||
|
};
|
||||||
|
|
||||||
class GapMove : public FixedInputNodeT<0, GapMove> {
|
class GapMove : public FixedInputNodeT<0, GapMove> {
|
||||||
using Base = FixedInputNodeT<0, GapMove>;
|
using Base = FixedInputNodeT<0, GapMove>;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user