From 6ca94bd0b14db0567828336a2caeb16a1007262d Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Tue, 14 May 2024 11:32:04 +0200 Subject: [PATCH] LibJS/Bytecode: Rename GetVariable => GetBinding --- Userland/Libraries/LibJS/Bytecode/ASTCodegen.cpp | 6 +++--- Userland/Libraries/LibJS/Bytecode/Generator.cpp | 2 +- Userland/Libraries/LibJS/Bytecode/Instruction.h | 2 +- Userland/Libraries/LibJS/Bytecode/Interpreter.cpp | 8 ++++---- Userland/Libraries/LibJS/Bytecode/Op.h | 6 +++--- 5 files changed, 12 insertions(+), 12 deletions(-) diff --git a/Userland/Libraries/LibJS/Bytecode/ASTCodegen.cpp b/Userland/Libraries/LibJS/Bytecode/ASTCodegen.cpp index 09d2ee68761..a468c9cf8c3 100644 --- a/Userland/Libraries/LibJS/Bytecode/ASTCodegen.cpp +++ b/Userland/Libraries/LibJS/Bytecode/ASTCodegen.cpp @@ -397,7 +397,7 @@ Bytecode::CodeGenerationErrorOr> Identifier::generate_by if (is_global()) { generator.emit(dst, generator.intern_identifier(m_string), generator.next_global_variable_cache()); } else { - generator.emit(dst, generator.intern_identifier(m_string)); + generator.emit(dst, generator.intern_identifier(m_string)); } return dst; } @@ -520,7 +520,7 @@ Bytecode::CodeGenerationErrorOr> AssignmentExpression::g generator.emit(*base); } } else if (is(*lhs)) { - // NOTE: For Identifiers, we cannot perform GetVariable and then write into the reference it retrieves, only SetVariable can do this. + // NOTE: For Identifiers, we cannot perform GetBinding and then write into the reference it retrieves, only SetVariable can do this. // FIXME: However, this breaks spec as we are doing variable lookup after evaluating the RHS. This is observable in an object environment, where we visibly perform HasOwnProperty and Get(@@unscopables) on the binded object. } else { (void)TRY(lhs->generate_bytecode(generator)); @@ -1150,7 +1150,7 @@ Bytecode::CodeGenerationErrorOr> FunctionDeclaration::ge Bytecode::Generator::SourceLocationScope scope(generator, *this); auto index = generator.intern_identifier(name()); auto value = generator.allocate_register(); - generator.emit(value, index); + generator.emit(value, index); generator.emit(index, value); } return Optional {}; diff --git a/Userland/Libraries/LibJS/Bytecode/Generator.cpp b/Userland/Libraries/LibJS/Bytecode/Generator.cpp index 5915404d4b3..3dafc51bc22 100644 --- a/Userland/Libraries/LibJS/Bytecode/Generator.cpp +++ b/Userland/Libraries/LibJS/Bytecode/Generator.cpp @@ -133,7 +133,7 @@ CodeGenerationErrorOr Generator::emit_function_declaration_instantiation(E if (id.is_local()) { emit(initial_value, local(id.local_variable_index())); } else { - emit(initial_value, intern_identifier(id.string())); + emit(initial_value, intern_identifier(id.string())); } } diff --git a/Userland/Libraries/LibJS/Bytecode/Instruction.h b/Userland/Libraries/LibJS/Bytecode/Instruction.h index e9af855b2a9..ec026b9c896 100644 --- a/Userland/Libraries/LibJS/Bytecode/Instruction.h +++ b/Userland/Libraries/LibJS/Bytecode/Instruction.h @@ -63,7 +63,7 @@ O(GetObjectFromIteratorRecord) \ O(GetObjectPropertyIterator) \ O(GetPrivateById) \ - O(GetVariable) \ + O(GetBinding) \ O(GreaterThan) \ O(GreaterThanEquals) \ O(HasPrivateId) \ diff --git a/Userland/Libraries/LibJS/Bytecode/Interpreter.cpp b/Userland/Libraries/LibJS/Bytecode/Interpreter.cpp index 03008d7d160..b046e127b30 100644 --- a/Userland/Libraries/LibJS/Bytecode/Interpreter.cpp +++ b/Userland/Libraries/LibJS/Bytecode/Interpreter.cpp @@ -577,7 +577,7 @@ FLATTEN_ON_CLANG void Interpreter::run_bytecode(size_t entry_point) HANDLE_INSTRUCTION(GetObjectFromIteratorRecord); HANDLE_INSTRUCTION(GetObjectPropertyIterator); HANDLE_INSTRUCTION(GetPrivateById); - HANDLE_INSTRUCTION(GetVariable); + HANDLE_INSTRUCTION(GetBinding); HANDLE_INSTRUCTION(GreaterThan); HANDLE_INSTRUCTION(GreaterThanEquals); HANDLE_INSTRUCTION(HasPrivateId); @@ -1237,7 +1237,7 @@ ThrowCompletionOr ConcatString::execute_impl(Bytecode::Interpreter& interp return {}; } -ThrowCompletionOr GetVariable::execute_impl(Bytecode::Interpreter& interpreter) const +ThrowCompletionOr GetBinding::execute_impl(Bytecode::Interpreter& interpreter) const { auto& vm = interpreter.vm(); auto& executable = interpreter.current_executable(); @@ -2122,9 +2122,9 @@ ByteString GetCalleeAndThisFromEnvironment::to_byte_string_impl(Bytecode::Execut executable.identifier_table->get(m_identifier)); } -ByteString GetVariable::to_byte_string_impl(Bytecode::Executable const& executable) const +ByteString GetBinding::to_byte_string_impl(Bytecode::Executable const& executable) const { - return ByteString::formatted("GetVariable {}, {}", + return ByteString::formatted("GetBinding {}, {}", format_operand("dst"sv, dst(), executable), executable.identifier_table->get(m_identifier)); } diff --git a/Userland/Libraries/LibJS/Bytecode/Op.h b/Userland/Libraries/LibJS/Bytecode/Op.h index 99e899beb8f..15be6e3f9a9 100644 --- a/Userland/Libraries/LibJS/Bytecode/Op.h +++ b/Userland/Libraries/LibJS/Bytecode/Op.h @@ -846,10 +846,10 @@ private: mutable EnvironmentCoordinate m_cache; }; -class GetVariable final : public Instruction { +class GetBinding final : public Instruction { public: - explicit GetVariable(Operand dst, IdentifierTableIndex identifier) - : Instruction(Type::GetVariable) + explicit GetBinding(Operand dst, IdentifierTableIndex identifier) + : Instruction(Type::GetBinding) , m_dst(dst) , m_identifier(identifier) {