1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 07:28:11 +00:00

LibJS/JIT: Compile the DeleteByValue instruction

This commit is contained in:
Jakub Berkop 2023-10-29 21:20:25 +01:00 committed by Andreas Kling
parent f5fcd4596c
commit 0776404e03
6 changed files with 33 additions and 10 deletions

View file

@ -1108,16 +1108,10 @@ ThrowCompletionOr<void> PutByValueWithThis::execute_impl(Bytecode::Interpreter&
ThrowCompletionOr<void> DeleteByValue::execute_impl(Bytecode::Interpreter& interpreter) const
{
auto& vm = interpreter.vm();
// NOTE: Get the property key from the accumulator before side effects have a chance to overwrite it.
auto property_key_value = interpreter.accumulator();
auto base_value = interpreter.reg(m_base);
auto property_key = TRY(property_key_value.to_property_key(vm));
bool strict = vm.in_strict_mode();
auto reference = Reference { base_value, property_key, {}, strict };
interpreter.accumulator() = Value(TRY(reference.delete_(vm)));
auto property_key_value = interpreter.accumulator();
interpreter.accumulator() = TRY(delete_by_value(interpreter, base_value, property_key_value));
return {};
}