mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-25 18:58:56 +00:00
LibJS: Remove VM::execute_ast_node()
This commit is contained in:
parent
6fb1d9e516
commit
8bcaf68023
Notes:
sideshowbarker
2024-07-16 23:57:20 +09:00
Author: https://github.com/kalenikaliaksandr
Commit: 8bcaf68023
Pull-request: https://github.com/SerenityOS/serenity/pull/24290
2 changed files with 0 additions and 26 deletions
|
@ -219,28 +219,6 @@ void VM::gather_roots(HashMap<Cell*, HeapRoot>& roots)
|
||||||
roots.set(job, HeapRoot { .type = HeapRoot::Type::VM });
|
roots.set(job, HeapRoot { .type = HeapRoot::Type::VM });
|
||||||
}
|
}
|
||||||
|
|
||||||
ThrowCompletionOr<Value> VM::execute_ast_node(ASTNode const& node)
|
|
||||||
{
|
|
||||||
// FIXME: This function should be gone once we will emit bytecode for everything before executing instructions.
|
|
||||||
|
|
||||||
auto executable = TRY(Bytecode::compile(*this, node, FunctionKind::Normal, ""sv));
|
|
||||||
auto& running_execution_context = this->running_execution_context();
|
|
||||||
|
|
||||||
// Registers have to be saved and restored because executable for compiled ASTNode does not have its own execution context
|
|
||||||
auto saved_registers = running_execution_context.registers;
|
|
||||||
for (size_t i = 0; i < saved_registers.size(); ++i)
|
|
||||||
running_execution_context.registers[i] = {};
|
|
||||||
|
|
||||||
auto result_or_error = bytecode_interpreter().run_executable(*executable, {});
|
|
||||||
|
|
||||||
for (size_t i = 0; i < saved_registers.size(); ++i)
|
|
||||||
running_execution_context.registers[i] = saved_registers[i];
|
|
||||||
|
|
||||||
if (result_or_error.value.is_error())
|
|
||||||
return result_or_error.value.release_error();
|
|
||||||
return result_or_error.return_register_value;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 9.1.2.1 GetIdentifierReference ( env, name, strict ), https://tc39.es/ecma262/#sec-getidentifierreference
|
// 9.1.2.1 GetIdentifierReference ( env, name, strict ), https://tc39.es/ecma262/#sec-getidentifierreference
|
||||||
ThrowCompletionOr<Reference> VM::get_identifier_reference(Environment* environment, DeprecatedFlyString name, bool strict, size_t hops)
|
ThrowCompletionOr<Reference> VM::get_identifier_reference(Environment* environment, DeprecatedFlyString name, bool strict, size_t hops)
|
||||||
{
|
{
|
||||||
|
|
|
@ -258,10 +258,6 @@ public:
|
||||||
Function<ThrowCompletionOr<void>(Object&)> host_ensure_can_add_private_element;
|
Function<ThrowCompletionOr<void>(Object&)> host_ensure_can_add_private_element;
|
||||||
Function<ThrowCompletionOr<HandledByHost>(ArrayBuffer&, size_t)> host_resize_array_buffer;
|
Function<ThrowCompletionOr<HandledByHost>(ArrayBuffer&, size_t)> host_resize_array_buffer;
|
||||||
|
|
||||||
// Execute a specific AST node either in AST or BC interpreter, depending on which one is enabled by default.
|
|
||||||
// NOTE: This is meant as a temporary stopgap until everything is bytecode.
|
|
||||||
ThrowCompletionOr<Value> execute_ast_node(ASTNode const&);
|
|
||||||
|
|
||||||
Vector<StackTraceElement> stack_trace() const;
|
Vector<StackTraceElement> stack_trace() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue