1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 06:07:34 +00:00

LibJS: Implement bytecode generation for BigInts

This commit is contained in:
Gunnar Beutner 2021-06-08 07:59:25 +02:00 committed by Linus Groh
parent 0975e08285
commit 50ece3dd1b
5 changed files with 38 additions and 0 deletions

View file

@ -8,6 +8,7 @@
#pragma once
#include <AK/FlyString.h>
#include <LibCrypto/BigInt/SignedBigInteger.h>
#include <LibJS/Bytecode/Instruction.h>
#include <LibJS/Bytecode/Label.h>
#include <LibJS/Bytecode/Register.h>
@ -157,6 +158,23 @@ private:
Register m_dst;
};
class NewBigInt final : public Instruction {
public:
explicit NewBigInt(Register dst, Crypto::SignedBigInteger bigint)
: Instruction(Type::NewBigInt)
, m_dst(dst)
, m_bigint(move(bigint))
{
}
void execute(Bytecode::Interpreter&) const;
String to_string() const;
private:
Register m_dst;
Crypto::SignedBigInteger m_bigint;
};
class SetVariable final : public Instruction {
public:
SetVariable(FlyString identifier, Register src)