mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-09-11 13:36:13 +03:00
LibJS/Bytecode: Rename TypeofVariable => TypeofBinding
This commit is contained in:
parent
9d21d88374
commit
4302e07346
Notes:
sideshowbarker
2024-07-17 02:06:40 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/LadybirdBrowser/ladybird/commit/4302e07346 Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/165
@ -362,7 +362,7 @@ Bytecode::CodeGenerationErrorOr<Optional<ScopedOperand>> UnaryExpression::genera
|
||||
if (is<Identifier>(*m_lhs)) {
|
||||
auto& identifier = static_cast<Identifier const&>(*m_lhs);
|
||||
if (!identifier.is_local()) {
|
||||
generator.emit<Bytecode::Op::TypeofVariable>(dst, generator.intern_identifier(identifier.string()));
|
||||
generator.emit<Bytecode::Op::TypeofBinding>(dst, generator.intern_identifier(identifier.string()));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -389,7 +389,7 @@ inline ThrowCompletionOr<void> throw_if_needed_for_call(Interpreter& interpreter
|
||||
return {};
|
||||
}
|
||||
|
||||
inline ThrowCompletionOr<Value> typeof_variable(VM& vm, DeprecatedFlyString const& string)
|
||||
inline ThrowCompletionOr<Value> typeof_binding(VM& vm, DeprecatedFlyString const& string)
|
||||
{
|
||||
// 1. Let val be the result of evaluating UnaryExpression.
|
||||
auto reference = TRY(vm.resolve_binding(string));
|
||||
|
@ -138,7 +138,7 @@
|
||||
O(ThrowIfNullish) \
|
||||
O(ThrowIfTDZ) \
|
||||
O(Typeof) \
|
||||
O(TypeofVariable) \
|
||||
O(TypeofBinding) \
|
||||
O(UnaryMinus) \
|
||||
O(UnaryPlus) \
|
||||
O(UnsignedRightShift) \
|
||||
|
@ -663,7 +663,7 @@ FLATTEN_ON_CLANG void Interpreter::run_bytecode(size_t entry_point)
|
||||
HANDLE_INSTRUCTION(ThrowIfNullish);
|
||||
HANDLE_INSTRUCTION(ThrowIfTDZ);
|
||||
HANDLE_INSTRUCTION(Typeof);
|
||||
HANDLE_INSTRUCTION(TypeofVariable);
|
||||
HANDLE_INSTRUCTION(TypeofBinding);
|
||||
HANDLE_INSTRUCTION(UnaryMinus);
|
||||
HANDLE_INSTRUCTION(UnaryPlus);
|
||||
HANDLE_INSTRUCTION(UnsignedRightShift);
|
||||
@ -1973,10 +1973,10 @@ ThrowCompletionOr<void> NewClass::execute_impl(Bytecode::Interpreter& interprete
|
||||
}
|
||||
|
||||
// 13.5.3.1 Runtime Semantics: Evaluation, https://tc39.es/ecma262/#sec-typeof-operator-runtime-semantics-evaluation
|
||||
ThrowCompletionOr<void> TypeofVariable::execute_impl(Bytecode::Interpreter& interpreter) const
|
||||
ThrowCompletionOr<void> TypeofBinding::execute_impl(Bytecode::Interpreter& interpreter) const
|
||||
{
|
||||
auto& vm = interpreter.vm();
|
||||
interpreter.set(dst(), TRY(typeof_variable(vm, interpreter.current_executable().get_identifier(m_identifier))));
|
||||
interpreter.set(dst(), TRY(typeof_binding(vm, interpreter.current_executable().get_identifier(m_identifier))));
|
||||
return {};
|
||||
}
|
||||
|
||||
@ -2679,9 +2679,9 @@ ByteString GetImportMeta::to_byte_string_impl(Bytecode::Executable const& execut
|
||||
return ByteString::formatted("GetImportMeta {}", format_operand("dst"sv, m_dst, executable));
|
||||
}
|
||||
|
||||
ByteString TypeofVariable::to_byte_string_impl(Bytecode::Executable const& executable) const
|
||||
ByteString TypeofBinding::to_byte_string_impl(Bytecode::Executable const& executable) const
|
||||
{
|
||||
return ByteString::formatted("TypeofVariable {}, {}",
|
||||
return ByteString::formatted("TypeofBinding {}, {}",
|
||||
format_operand("dst"sv, m_dst, executable),
|
||||
executable.identifier_table->get(m_identifier));
|
||||
}
|
||||
|
@ -2623,10 +2623,10 @@ private:
|
||||
Operand m_dst;
|
||||
};
|
||||
|
||||
class TypeofVariable final : public Instruction {
|
||||
class TypeofBinding final : public Instruction {
|
||||
public:
|
||||
TypeofVariable(Operand dst, IdentifierTableIndex identifier)
|
||||
: Instruction(Type::TypeofVariable)
|
||||
TypeofBinding(Operand dst, IdentifierTableIndex identifier)
|
||||
: Instruction(Type::TypeofBinding)
|
||||
, m_dst(dst)
|
||||
, m_identifier(identifier)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user