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
commit 0776404e03
Notes: sideshowbarker 2024-07-17 06:54:15 +09:00
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 {};
}