[maglev] Support DeleteProperty

Bug: v8:7700
Change-Id: If911ff32d42c7c907da88d52192bb839bf459d5b
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3803028
Auto-Submit: Victor Gomes <victorgomes@chromium.org>
Commit-Queue: Leszek Swirski <leszeks@chromium.org>
Reviewed-by: Leszek Swirski <leszeks@chromium.org>
Cr-Commit-Position: refs/heads/main@{#82128}
This commit is contained in:
Victor Gomes 2022-08-01 15:37:29 +02:00 committed by V8 LUCI CQ
parent bcd0fa556a
commit 7252b02332
4 changed files with 65 additions and 2 deletions

View File

@ -1448,8 +1448,22 @@ void MaglevGraphBuilder::VisitLogicalNot() {
} }
MAGLEV_UNIMPLEMENTED_BYTECODE(TypeOf) MAGLEV_UNIMPLEMENTED_BYTECODE(TypeOf)
MAGLEV_UNIMPLEMENTED_BYTECODE(DeletePropertyStrict)
MAGLEV_UNIMPLEMENTED_BYTECODE(DeletePropertySloppy) void MaglevGraphBuilder::VisitDeletePropertyStrict() {
ValueNode* object = LoadRegisterTagged(0);
ValueNode* key = GetAccumulatorTagged();
ValueNode* context = GetContext();
SetAccumulator(AddNewNode<DeleteProperty>({context, object, key},
LanguageMode::kStrict));
}
void MaglevGraphBuilder::VisitDeletePropertySloppy() {
ValueNode* object = LoadRegisterTagged(0);
ValueNode* key = GetAccumulatorTagged();
ValueNode* context = GetContext();
SetAccumulator(AddNewNode<DeleteProperty>({context, object, key},
LanguageMode::kSloppy));
}
void MaglevGraphBuilder::VisitGetSuperConstructor() { void MaglevGraphBuilder::VisitGetSuperConstructor() {
ValueNode* active_function = GetAccumulatorTagged(); ValueNode* active_function = GetAccumulatorTagged();

View File

@ -164,6 +164,7 @@ 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::kDeleteProperty:
case Opcode::kHasProperty: case Opcode::kHasProperty:
case Opcode::kLoadNamedFromSuperGeneric: case Opcode::kLoadNamedFromSuperGeneric:
case Opcode::kSetNamedGeneric: case Opcode::kSetNamedGeneric:

View File

@ -738,6 +738,29 @@ void Constant::PrintParams(std::ostream& os,
os << "(" << object_ << ")"; os << "(" << object_ << ")";
} }
void DeleteProperty::AllocateVreg(MaglevVregAllocationState* vreg_state) {
using D = CallInterfaceDescriptorFor<Builtin::kDeleteProperty>::type;
UseFixed(context(), kContextRegister);
UseFixed(object(), D::GetRegisterParameter(D::kObject));
UseFixed(key(), D::GetRegisterParameter(D::kKey));
DefineAsFixed(vreg_state, this, kReturnRegister0);
}
void DeleteProperty::GenerateCode(MaglevCodeGenState* code_gen_state,
const ProcessingState& state) {
using D = CallInterfaceDescriptorFor<Builtin::kDeleteProperty>::type;
DCHECK_EQ(ToRegister(context()), kContextRegister);
DCHECK_EQ(ToRegister(object()), D::GetRegisterParameter(D::kObject));
DCHECK_EQ(ToRegister(key()), D::GetRegisterParameter(D::kKey));
__ Move(D::GetRegisterParameter(D::kLanguageMode),
Smi::FromInt(static_cast<int>(mode())));
__ CallBuiltin(Builtin::kDeleteProperty);
code_gen_state->DefineLazyDeoptPoint(lazy_deopt_info());
}
void DeleteProperty::PrintParams(std::ostream& os,
MaglevGraphLabeller* graph_labeller) const {
os << "(" << LanguageMode2String(mode()) << ")";
}
void HasProperty::AllocateVreg(MaglevVregAllocationState* vreg_state) { void HasProperty::AllocateVreg(MaglevVregAllocationState* vreg_state) {
using D = CallInterfaceDescriptorFor<Builtin::kKeyedHasIC>::type; using D = CallInterfaceDescriptorFor<Builtin::kKeyedHasIC>::type;
UseFixed(context(), kContextRegister); UseFixed(context(), kContextRegister);

View File

@ -129,6 +129,7 @@ class CompactInterpreterFrameState;
V(CreateClosure) \ V(CreateClosure) \
V(FastCreateClosure) \ V(FastCreateClosure) \
V(CreateRegExpLiteral) \ V(CreateRegExpLiteral) \
V(DeleteProperty) \
V(HasProperty) \ V(HasProperty) \
V(InitialValue) \ V(InitialValue) \
V(LoadTaggedField) \ V(LoadTaggedField) \
@ -1700,6 +1701,30 @@ class ToNumberOrNumeric : public FixedInputValueNodeT<2, ToNumberOrNumeric> {
const Object::Conversion mode_; const Object::Conversion mode_;
}; };
class DeleteProperty : public FixedInputValueNodeT<3, DeleteProperty> {
using Base = FixedInputValueNodeT<3, DeleteProperty>;
public:
explicit DeleteProperty(uint64_t bitfield, LanguageMode mode)
: Base(bitfield), mode_(mode) {}
// The implementation currently calls runtime.
static constexpr OpProperties kProperties = OpProperties::JSCall();
Input& context() { return Node::input(0); }
Input& object() { return Node::input(1); }
Input& key() { return Node::input(2); }
LanguageMode mode() const { return mode_; }
void AllocateVreg(MaglevVregAllocationState*);
void GenerateCode(MaglevCodeGenState*, const ProcessingState&);
void PrintParams(std::ostream&, MaglevGraphLabeller*) const;
private:
const LanguageMode mode_;
};
class HasProperty : public FixedInputValueNodeT<3, HasProperty> { class HasProperty : public FixedInputValueNodeT<3, HasProperty> {
using Base = FixedInputValueNodeT<3, HasProperty>; using Base = FixedInputValueNodeT<3, HasProperty>;