2024-05-07 19:36:56 +00:00
|
|
|
/*
|
2024-10-04 11:19:50 +00:00
|
|
|
* Copyright (c) 2024, Andreas Kling <andreas@ladybird.org>
|
2024-05-07 19:36:56 +00:00
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <LibJS/Bytecode/Generator.h>
|
|
|
|
#include <LibJS/Bytecode/ScopedOperand.h>
|
|
|
|
|
|
|
|
namespace JS::Bytecode {
|
|
|
|
|
|
|
|
ScopedOperandImpl::~ScopedOperandImpl()
|
|
|
|
{
|
2024-05-31 18:41:29 +00:00
|
|
|
if (!m_generator.is_finished() && m_operand.is_register() && m_operand.as_register().index() >= Register::reserved_register_count)
|
2024-05-07 19:36:56 +00:00
|
|
|
m_generator.free_register(m_operand.as_register());
|
|
|
|
}
|
|
|
|
|
|
|
|
Register Operand::as_register() const
|
|
|
|
{
|
|
|
|
return Register { m_index };
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|