summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibJS
diff options
context:
space:
mode:
authorHendiadyoin1 <leon.a@serenityos.org>2022-10-22 20:21:08 +0200
committerLinus Groh <mail@linusgroh.de>2022-12-03 15:25:05 +0000
commitfafe498238e06fa7e87cdcc9b8f88aa2d6e311c9 (patch)
tree9fde29c2aeb2d3c761890fde373116adae20baf8 /Userland/Libraries/LibJS
parentfd6e75fd01c68472b9b940f1e574a12e00d334b1 (diff)
downloadserenity-fafe498238e06fa7e87cdcc9b8f88aa2d6e311c9.zip
LibJS: Expose some internals of Instructions
These will be needed in the future to allow optimization passes to check against these
Diffstat (limited to 'Userland/Libraries/LibJS')
-rw-r--r--Userland/Libraries/LibJS/Bytecode/Op.h22
1 files changed, 22 insertions, 0 deletions
diff --git a/Userland/Libraries/LibJS/Bytecode/Op.h b/Userland/Libraries/LibJS/Bytecode/Op.h
index 2fd565655f..37e66d1041 100644
--- a/Userland/Libraries/LibJS/Bytecode/Op.h
+++ b/Userland/Libraries/LibJS/Bytecode/Op.h
@@ -74,6 +74,8 @@ public:
void replace_references_impl(BasicBlock const&, BasicBlock const&) { }
void replace_references_impl(Register, Register) { }
+ Register dst() const { return m_dst; }
+
private:
Register m_dst;
};
@@ -271,6 +273,20 @@ public:
return sizeof(*this) + sizeof(Register) * (m_element_count == 0 ? 0 : 2);
}
+ Register start() const
+ {
+ VERIFY(m_element_count);
+ return m_elements[0];
+ }
+
+ Register end() const
+ {
+ VERIFY(m_element_count);
+ return m_elements[1];
+ }
+
+ size_t element_count() const { return m_element_count; }
+
private:
size_t m_element_count { 0 };
Register m_elements[];
@@ -406,6 +422,8 @@ public:
void replace_references_impl(BasicBlock const&, BasicBlock const&) { }
void replace_references_impl(Register, Register) { }
+ IdentifierTableIndex identifier() const { return m_identifier; }
+
private:
IdentifierTableIndex m_identifier;
EnvironmentMode m_mode;
@@ -425,6 +443,8 @@ public:
void replace_references_impl(BasicBlock const&, BasicBlock const&) { }
void replace_references_impl(Register, Register) { }
+ IdentifierTableIndex identifier() const { return m_identifier; }
+
private:
IdentifierTableIndex m_identifier;
@@ -444,6 +464,8 @@ public:
void replace_references_impl(BasicBlock const&, BasicBlock const&) { }
void replace_references_impl(Register, Register) { }
+ IdentifierTableIndex identifier() const { return m_identifier; }
+
private:
IdentifierTableIndex m_identifier;
};