Executable.h 802 B

123456789101112131415161718192021222324252627282930
  1. /*
  2. * Copyright (c) 2021, Andreas Kling <kling@serenityos.org>
  3. *
  4. * SPDX-License-Identifier: BSD-2-Clause
  5. */
  6. #pragma once
  7. #include <AK/FlyString.h>
  8. #include <AK/NonnullOwnPtrVector.h>
  9. #include <LibJS/Bytecode/BasicBlock.h>
  10. #include <LibJS/Bytecode/IdentifierTable.h>
  11. #include <LibJS/Bytecode/StringTable.h>
  12. namespace JS::Bytecode {
  13. struct Executable {
  14. FlyString name;
  15. NonnullOwnPtrVector<BasicBlock> basic_blocks;
  16. NonnullOwnPtr<StringTable> string_table;
  17. NonnullOwnPtr<IdentifierTable> identifier_table;
  18. size_t number_of_registers { 0 };
  19. String const& get_string(StringTableIndex index) const { return string_table->get(index); }
  20. FlyString const& get_identifier(IdentifierTableIndex index) const { return identifier_table->get(index); }
  21. void dump() const;
  22. };
  23. }