mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-29 12:19:54 +00:00
Everywhere: Hoist the Libraries folder to the top-level
This commit is contained in:
parent
950e819ee7
commit
93712b24bf
Notes:
github-actions[bot]
2024-11-10 11:51:52 +00:00
Author: https://github.com/trflynn89
Commit: 93712b24bf
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/2256
Reviewed-by: https://github.com/sideshowbarker
4547 changed files with 104 additions and 113 deletions
48
Libraries/LibJS/Bytecode/Operand.h
Normal file
48
Libraries/LibJS/Bytecode/Operand.h
Normal file
|
@ -0,0 +1,48 @@
|
|||
/*
|
||||
* Copyright (c) 2024, Andreas Kling <andreas@ladybird.org>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <AK/Types.h>
|
||||
#include <LibJS/Forward.h>
|
||||
|
||||
namespace JS::Bytecode {
|
||||
|
||||
class Operand {
|
||||
public:
|
||||
enum class Type {
|
||||
Register,
|
||||
Local,
|
||||
Constant,
|
||||
};
|
||||
|
||||
[[nodiscard]] bool operator==(Operand const&) const = default;
|
||||
|
||||
explicit Operand(Type type, u32 index)
|
||||
: m_type(type)
|
||||
, m_index(index)
|
||||
{
|
||||
}
|
||||
|
||||
explicit Operand(Register);
|
||||
|
||||
[[nodiscard]] bool is_register() const { return m_type == Type::Register; }
|
||||
[[nodiscard]] bool is_local() const { return m_type == Type::Local; }
|
||||
[[nodiscard]] bool is_constant() const { return m_type == Type::Constant; }
|
||||
|
||||
[[nodiscard]] Type type() const { return m_type; }
|
||||
[[nodiscard]] u32 index() const { return m_index; }
|
||||
|
||||
[[nodiscard]] Register as_register() const;
|
||||
|
||||
void offset_index_by(u32 offset) { m_index += offset; }
|
||||
|
||||
private:
|
||||
Type m_type {};
|
||||
u32 m_index { 0 };
|
||||
};
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue