1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 21:27:35 +00:00

LibJS/Bytecode: Generate bytecode for deleting super properties

This commit is contained in:
Timothy Flynn 2023-07-06 17:10:40 -04:00 committed by Andreas Kling
parent 0d50e5eeee
commit 23daf5097b
5 changed files with 97 additions and 0 deletions

View file

@ -740,6 +740,25 @@ private:
IdentifierTableIndex m_property;
};
class DeleteByIdWithThis final : public Instruction {
public:
DeleteByIdWithThis(Register this_value, IdentifierTableIndex property)
: Instruction(Type::DeleteByIdWithThis)
, m_this_value(this_value)
, m_property(property)
{
}
ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
DeprecatedString to_deprecated_string_impl(Bytecode::Executable const&) const;
void replace_references_impl(BasicBlock const&, BasicBlock const&) { }
void replace_references_impl(Register, Register) { }
private:
Register m_this_value;
IdentifierTableIndex m_property;
};
class GetByValue final : public Instruction {
public:
explicit GetByValue(Register base)
@ -865,6 +884,29 @@ private:
Register m_base;
};
class DeleteByValueWithThis final : public Instruction {
public:
DeleteByValueWithThis(Register base, Register this_value)
: Instruction(Type::DeleteByValueWithThis)
, m_base(base)
, m_this_value(this_value)
{
}
ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
DeprecatedString to_deprecated_string_impl(Bytecode::Executable const&) const;
void replace_references_impl(BasicBlock const&, BasicBlock const&) { }
void replace_references_impl(Register from, Register to)
{
if (m_base == from)
m_base = to;
}
private:
Register m_base;
Register m_this_value;
};
class Jump : public Instruction {
public:
constexpr static bool IsTerminator = true;