mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 05:07:35 +00:00
LibJS/JIT: Let Compiler keep per-BasicBlock state internally
Compiler now has a BasicBlockData struct for each BasicBlock. The struct contains all the stuff that we previously stored with the Bytecode::BasicBlock.
This commit is contained in:
parent
8a24d00b1a
commit
022974a43a
3 changed files with 42 additions and 19 deletions
|
@ -125,6 +125,26 @@ private:
|
|||
{
|
||||
}
|
||||
|
||||
Assembler::Label& label_for(Bytecode::BasicBlock const& block)
|
||||
{
|
||||
return block_data_for(block).label;
|
||||
}
|
||||
|
||||
struct BasicBlockData {
|
||||
size_t start_offset { 0 };
|
||||
Assembler::Label label;
|
||||
Vector<size_t> absolute_references_to_here;
|
||||
};
|
||||
|
||||
BasicBlockData& block_data_for(Bytecode::BasicBlock const& block)
|
||||
{
|
||||
return *m_basic_block_data.ensure(&block, [] {
|
||||
return make<BasicBlockData>();
|
||||
});
|
||||
}
|
||||
|
||||
HashMap<Bytecode::BasicBlock const*, NonnullOwnPtr<BasicBlockData>> m_basic_block_data;
|
||||
|
||||
Vector<u8> m_output;
|
||||
Assembler m_assembler { m_output };
|
||||
Bytecode::Executable& m_bytecode_executable;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue