1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-06-01 07:48:12 +00:00

LibJS: Remove usage of bytecode_interpreter_if_exists()

There is no need to check if bytecode interpreter exists after we
switched away from AST interpreter.
This commit is contained in:
Aliaksandr Kalenik 2023-08-11 17:23:56 +02:00 committed by Andreas Kling
parent 0abe2a5023
commit d978c762bc
5 changed files with 7 additions and 14 deletions

View file

@ -1627,7 +1627,7 @@ void ScopeNode::block_declaration_instantiation(VM& vm, Environment* environment
// NOTE: Due to the use of MUST with `create_immutable_binding` and `create_mutable_binding` below,
// an exception should not result from `for_each_bound_name`.
MUST(declaration.for_each_bound_identifier([&](auto const& identifier) {
if (vm.bytecode_interpreter_if_exists() && identifier.is_local()) {
if (identifier.is_local()) {
// NOTE: No need to create bindings for local variables as their values are not stored in an environment.
return;
}
@ -1644,7 +1644,7 @@ void ScopeNode::block_declaration_instantiation(VM& vm, Environment* environment
if (is<FunctionDeclaration>(declaration)) {
auto& function_declaration = static_cast<FunctionDeclaration const&>(declaration);
auto function = ECMAScriptFunctionObject::create(realm, function_declaration.name(), function_declaration.source_text(), function_declaration.body(), function_declaration.parameters(), function_declaration.function_length(), function_declaration.local_variables_names(), environment, private_environment, function_declaration.kind(), function_declaration.is_strict_mode(), function_declaration.might_need_arguments_object(), function_declaration.contains_direct_call_to_eval());
if (vm.bytecode_interpreter_if_exists() && function_declaration.name_identifier()->is_local()) {
if (function_declaration.name_identifier()->is_local()) {
vm.running_execution_context().local_variables[function_declaration.name_identifier()->local_variable_index()] = function;
} else {
VERIFY(is<DeclarativeEnvironment>(*environment));