mirror of
https://github.com/RGBCube/serenity
synced 2025-05-25 22:45:06 +00:00
LibJS/Bytecode: Make ClassDeclaration not clobber the accumulator
2 new passes on test262. :^)
This commit is contained in:
parent
e87d84f883
commit
7430dee5cf
1 changed files with 5 additions and 0 deletions
|
@ -2303,8 +2303,13 @@ Bytecode::CodeGenerationErrorOr<void> SwitchStatement::generate_labelled_evaluat
|
|||
|
||||
Bytecode::CodeGenerationErrorOr<void> ClassDeclaration::generate_bytecode(Bytecode::Generator& generator) const
|
||||
{
|
||||
auto accumulator_backup_reg = generator.allocate_register();
|
||||
generator.emit<Bytecode::Op::Store>(accumulator_backup_reg);
|
||||
|
||||
TRY(m_class_expression->generate_bytecode(generator));
|
||||
generator.emit<Bytecode::Op::SetVariable>(generator.intern_identifier(m_class_expression.ptr()->name()), Bytecode::Op::SetVariable::InitializationMode::Initialize);
|
||||
|
||||
generator.emit<Bytecode::Op::Load>(accumulator_backup_reg);
|
||||
return {};
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue