mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 11:48:10 +00:00
Revert "LibJS: Add bytecode instruction handles"
This reverts commit a01bd35c67
.
This broke simple programs like:
function sum(a, b) { return a + b; }
console.log(sum(1, 2));
This commit is contained in:
parent
a01bd35c67
commit
b8a5ea1f8d
8 changed files with 79 additions and 81 deletions
|
@ -10,6 +10,7 @@
|
|||
#include <LibJS/Bytecode/Generator.h>
|
||||
#include <LibJS/Bytecode/Instruction.h>
|
||||
#include <LibJS/Bytecode/Register.h>
|
||||
#include <LibJS/Forward.h>
|
||||
|
||||
namespace JS::Bytecode {
|
||||
|
||||
|
@ -27,9 +28,20 @@ OwnPtr<Block> Generator::generate(ASTNode const& node)
|
|||
Generator generator;
|
||||
node.generate_bytecode(generator);
|
||||
generator.m_block->set_register_count({}, generator.m_next_register);
|
||||
generator.m_block->seal();
|
||||
return move(generator.m_block);
|
||||
}
|
||||
|
||||
void Generator::grow(size_t additional_size)
|
||||
{
|
||||
m_block->grow(additional_size);
|
||||
}
|
||||
|
||||
void* Generator::next_slot()
|
||||
{
|
||||
return m_block->next_slot();
|
||||
}
|
||||
|
||||
Register Generator::allocate_register()
|
||||
{
|
||||
VERIFY(m_next_register != NumericLimits<u32>::max());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue