mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-29 20:29:18 +00:00
LibJS/Bytecode: Rename GetVariable => GetBinding
This commit is contained in:
parent
b7c04f999a
commit
6ca94bd0b1
Notes:
sideshowbarker
2024-07-16 22:34:39 +09:00
Author: https://github.com/awesomekling
Commit: 6ca94bd0b1
Pull-request: https://github.com/SerenityOS/serenity/pull/24324
5 changed files with 12 additions and 12 deletions
|
@ -397,7 +397,7 @@ Bytecode::CodeGenerationErrorOr<Optional<ScopedOperand>> Identifier::generate_by
|
|||
if (is_global()) {
|
||||
generator.emit<Bytecode::Op::GetGlobal>(dst, generator.intern_identifier(m_string), generator.next_global_variable_cache());
|
||||
} else {
|
||||
generator.emit<Bytecode::Op::GetVariable>(dst, generator.intern_identifier(m_string));
|
||||
generator.emit<Bytecode::Op::GetBinding>(dst, generator.intern_identifier(m_string));
|
||||
}
|
||||
return dst;
|
||||
}
|
||||
|
@ -520,7 +520,7 @@ Bytecode::CodeGenerationErrorOr<Optional<ScopedOperand>> AssignmentExpression::g
|
|||
generator.emit<Bytecode::Op::ResolveSuperBase>(*base);
|
||||
}
|
||||
} else if (is<Identifier>(*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<Optional<ScopedOperand>> FunctionDeclaration::ge
|
|||
Bytecode::Generator::SourceLocationScope scope(generator, *this);
|
||||
auto index = generator.intern_identifier(name());
|
||||
auto value = generator.allocate_register();
|
||||
generator.emit<Bytecode::Op::GetVariable>(value, index);
|
||||
generator.emit<Bytecode::Op::GetBinding>(value, index);
|
||||
generator.emit<Bytecode::Op::SetVariableBinding>(index, value);
|
||||
}
|
||||
return Optional<ScopedOperand> {};
|
||||
|
|
|
@ -133,7 +133,7 @@ CodeGenerationErrorOr<void> Generator::emit_function_declaration_instantiation(E
|
|||
if (id.is_local()) {
|
||||
emit<Op::Mov>(initial_value, local(id.local_variable_index()));
|
||||
} else {
|
||||
emit<Op::GetVariable>(initial_value, intern_identifier(id.string()));
|
||||
emit<Op::GetBinding>(initial_value, intern_identifier(id.string()));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -63,7 +63,7 @@
|
|||
O(GetObjectFromIteratorRecord) \
|
||||
O(GetObjectPropertyIterator) \
|
||||
O(GetPrivateById) \
|
||||
O(GetVariable) \
|
||||
O(GetBinding) \
|
||||
O(GreaterThan) \
|
||||
O(GreaterThanEquals) \
|
||||
O(HasPrivateId) \
|
||||
|
|
|
@ -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<void> ConcatString::execute_impl(Bytecode::Interpreter& interp
|
|||
return {};
|
||||
}
|
||||
|
||||
ThrowCompletionOr<void> GetVariable::execute_impl(Bytecode::Interpreter& interpreter) const
|
||||
ThrowCompletionOr<void> 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));
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue