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

LibJS: Add Bytecode::Executable::dump()

Let's have a helper for producing a consistent executable dump instead
of repeating the logic in multiple places.
This commit is contained in:
Andreas Kling 2021-10-24 13:30:49 +02:00
parent b41954182a
commit da77e2aa4f
5 changed files with 56 additions and 30 deletions

View file

@ -0,0 +1,25 @@
/*
* Copyright (c) 2021, Andreas Kling <kling@serenityos.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include <AK/NonnullOwnPtrVector.h>
#include <LibJS/Bytecode/BasicBlock.h>
#include <LibJS/Bytecode/StringTable.h>
namespace JS::Bytecode {
struct Executable {
NonnullOwnPtrVector<BasicBlock> basic_blocks;
NonnullOwnPtr<StringTable> string_table;
size_t number_of_registers { 0 };
String const& get_string(StringTableIndex index) const { return string_table->get(index); }
void dump() const;
};
}