Executable.h 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. /*
  2. * Copyright (c) 2021-2023, Andreas Kling <kling@serenityos.org>
  3. *
  4. * SPDX-License-Identifier: BSD-2-Clause
  5. */
  6. #pragma once
  7. #include <AK/DeprecatedFlyString.h>
  8. #include <AK/NonnullOwnPtr.h>
  9. #include <AK/WeakPtr.h>
  10. #include <LibJS/Bytecode/BasicBlock.h>
  11. #include <LibJS/Bytecode/IdentifierTable.h>
  12. #include <LibJS/Bytecode/StringTable.h>
  13. namespace JS::Bytecode {
  14. struct PropertyLookupCache {
  15. WeakPtr<Shape> shape;
  16. Optional<u32> property_offset;
  17. u64 unique_shape_serial_number { 0 };
  18. };
  19. struct GlobalVariableCache : public PropertyLookupCache {
  20. u64 environment_serial_number { 0 };
  21. };
  22. struct Executable {
  23. DeprecatedFlyString name;
  24. Vector<PropertyLookupCache> property_lookup_caches;
  25. Vector<GlobalVariableCache> global_variable_caches;
  26. Vector<NonnullOwnPtr<BasicBlock>> basic_blocks;
  27. NonnullOwnPtr<StringTable> string_table;
  28. NonnullOwnPtr<IdentifierTable> identifier_table;
  29. size_t number_of_registers { 0 };
  30. bool is_strict_mode { false };
  31. DeprecatedString const& get_string(StringTableIndex index) const { return string_table->get(index); }
  32. DeprecatedFlyString const& get_identifier(IdentifierTableIndex index) const { return identifier_table->get(index); }
  33. void dump() const;
  34. };
  35. }