1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 15:48:12 +00:00

LibJS: Make Executable ref-counted and let instruction iterator co-own it

This ensures that the instruction stream pointed at by the instruction
iterator remains valid as long as the iterator exists.
This commit is contained in:
Andreas Kling 2023-10-03 08:18:10 +02:00
parent b1ee5c8738
commit c14db6ab12
9 changed files with 61 additions and 26 deletions

View file

@ -31,7 +31,21 @@ struct SourceRecord {
u32 source_end_offset {};
};
struct Executable {
class Executable final : public RefCounted<Executable> {
public:
Executable(
NonnullOwnPtr<IdentifierTable>,
NonnullOwnPtr<StringTable>,
NonnullOwnPtr<RegexTable>,
NonnullRefPtr<SourceCode const>,
size_t number_of_property_lookup_caches,
size_t number_of_global_variable_caches,
size_t number_of_registers,
Vector<NonnullOwnPtr<BasicBlock>>,
bool is_strict_mode);
~Executable();
DeprecatedFlyString name;
Vector<PropertyLookupCache> property_lookup_caches;
Vector<GlobalVariableCache> global_variable_caches;