mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 13:38:11 +00:00
LibJS/JIT: Compile the DeleteById instruction
This commit is contained in:
parent
0104225d9b
commit
f5fcd4596c
6 changed files with 33 additions and 6 deletions
|
@ -624,4 +624,15 @@ ThrowCompletionOr<void> append(VM& vm, Value lhs, Value rhs, bool is_spread)
|
|||
return {};
|
||||
}
|
||||
|
||||
ThrowCompletionOr<Value> delete_by_id(Bytecode::Interpreter& interpreter, Value base, IdentifierTableIndex property)
|
||||
{
|
||||
auto& vm = interpreter.vm();
|
||||
|
||||
auto const& identifier = interpreter.current_executable().get_identifier(property);
|
||||
bool strict = vm.in_strict_mode();
|
||||
auto reference = Reference { base, identifier, {}, strict };
|
||||
|
||||
return TRY(reference.delete_(vm));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -39,5 +39,6 @@ Object* iterator_to_object(VM&, IteratorRecord);
|
|||
IteratorRecord object_to_iterator(VM&, Object&);
|
||||
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);
|
||||
|
||||
}
|
||||
|
|
|
@ -817,12 +817,8 @@ ThrowCompletionOr<void> PutPrivateById::execute_impl(Bytecode::Interpreter& inte
|
|||
|
||||
ThrowCompletionOr<void> DeleteById::execute_impl(Bytecode::Interpreter& interpreter) const
|
||||
{
|
||||
auto& vm = interpreter.vm();
|
||||
auto base_value = interpreter.accumulator();
|
||||
auto const& identifier = interpreter.current_executable().get_identifier(m_property);
|
||||
bool strict = vm.in_strict_mode();
|
||||
auto reference = Reference { base_value, identifier, {}, strict };
|
||||
interpreter.accumulator() = Value(TRY(reference.delete_(vm)));
|
||||
interpreter.accumulator() = TRY(Bytecode::delete_by_id(interpreter, base_value, m_property));
|
||||
return {};
|
||||
}
|
||||
|
||||
|
|
|
@ -723,6 +723,8 @@ public:
|
|||
ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
|
||||
DeprecatedString to_deprecated_string_impl(Bytecode::Executable const&) const;
|
||||
|
||||
IdentifierTableIndex property() const { return m_property; }
|
||||
|
||||
private:
|
||||
IdentifierTableIndex m_property;
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue