summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibJS/Bytecode/Executable.h
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2021-10-24 13:30:49 +0200
committerAndreas Kling <kling@serenityos.org>2021-10-24 17:18:05 +0200
commitda77e2aa4f993557174a09dbaa3a1f639db8ddec (patch)
treeb5c6a8287a949b159114feb22b46a52e3a03ec99 /Userland/Libraries/LibJS/Bytecode/Executable.h
parentb41954182ae7d7b6c3282f1cb2bdea0de0d073b2 (diff)
downloadserenity-da77e2aa4f993557174a09dbaa3a1f639db8ddec.zip
LibJS: Add Bytecode::Executable::dump()
Let's have a helper for producing a consistent executable dump instead of repeating the logic in multiple places.
Diffstat (limited to 'Userland/Libraries/LibJS/Bytecode/Executable.h')
-rw-r--r--Userland/Libraries/LibJS/Bytecode/Executable.h25
1 files changed, 25 insertions, 0 deletions
diff --git a/Userland/Libraries/LibJS/Bytecode/Executable.h b/Userland/Libraries/LibJS/Bytecode/Executable.h
new file mode 100644
index 0000000000..7b20e8004d
--- /dev/null
+++ b/Userland/Libraries/LibJS/Bytecode/Executable.h
@@ -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;
+};
+
+}