mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 18:27:35 +00:00
LibJS/JIT: Compile the DeleteByValueWithThis instruction
This commit is contained in:
parent
0776404e03
commit
6a7b9b85a4
6 changed files with 35 additions and 8 deletions
|
@ -646,4 +646,15 @@ ThrowCompletionOr<Value> delete_by_value(Bytecode::Interpreter& interpreter, Val
|
|||
return Value(TRY(reference.delete_(vm)));
|
||||
}
|
||||
|
||||
ThrowCompletionOr<Value> delete_by_value_with_this(Bytecode::Interpreter& interpreter, Value base, Value property_key_value, Value this_value)
|
||||
{
|
||||
auto& vm = interpreter.vm();
|
||||
|
||||
auto property_key = TRY(property_key_value.to_property_key(vm));
|
||||
bool strict = vm.in_strict_mode();
|
||||
auto reference = Reference { base, property_key, this_value, strict };
|
||||
|
||||
return Value(TRY(reference.delete_(vm)));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -41,5 +41,6 @@ ThrowCompletionOr<NonnullGCPtr<Array>> iterator_to_array(VM&, Value iterator);
|
|||
ThrowCompletionOr<void> append(VM& vm, Value lhs, Value rhs, bool is_spread);
|
||||
ThrowCompletionOr<Value> delete_by_id(Bytecode::Interpreter&, Value base, IdentifierTableIndex identifier);
|
||||
ThrowCompletionOr<Value> delete_by_value(Bytecode::Interpreter&, Value base, Value property_key_value);
|
||||
ThrowCompletionOr<Value> delete_by_value_with_this(Bytecode::Interpreter&, Value base, Value property_key_value, Value this_value);
|
||||
|
||||
}
|
||||
|
|
|
@ -1117,16 +1117,12 @@ ThrowCompletionOr<void> DeleteByValue::execute_impl(Bytecode::Interpreter& inter
|
|||
|
||||
ThrowCompletionOr<void> DeleteByValueWithThis::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, interpreter.reg(m_this_value), strict };
|
||||
interpreter.accumulator() = Value(TRY(reference.delete_(vm)));
|
||||
auto this_value = interpreter.reg(m_this_value);
|
||||
interpreter.accumulator() = TRY(delete_by_value_with_this(interpreter, base_value, property_key_value, this_value));
|
||||
|
||||
return {};
|
||||
}
|
||||
|
||||
|
|
|
@ -850,6 +850,9 @@ public:
|
|||
{
|
||||
}
|
||||
|
||||
Register base() const { return m_base; }
|
||||
Register this_value() const { return m_this_value; }
|
||||
|
||||
ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
|
||||
DeprecatedString to_deprecated_string_impl(Bytecode::Executable const&) const;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue