1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 08:48:11 +00:00

LibJS/Bytecode: Make primitive bigints be constants

Instead of emitting a NewBigInt instruction to construct a primitive
bigint from a parsed literal, we now instantiate the BigInt on the heap
during codegen.
This commit is contained in:
Andreas Kling 2024-03-03 11:40:00 +01:00
parent 46d209c55b
commit 5813df21c8
4 changed files with 4 additions and 40 deletions

View file

@ -239,26 +239,6 @@ private:
Operand m_excluded_names[];
};
class NewBigInt final : public Instruction {
public:
NewBigInt(Operand dst, Crypto::SignedBigInteger bigint)
: Instruction(Type::NewBigInt, sizeof(*this))
, m_dst(dst)
, m_bigint(move(bigint))
{
}
ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
ByteString to_byte_string_impl(Bytecode::Executable const&) const;
Operand dst() const { return m_dst; }
Crypto::SignedBigInteger const& bigint() const { return m_bigint; }
private:
Operand m_dst;
Crypto::SignedBigInteger m_bigint;
};
// NOTE: This instruction is variable-width depending on the number of elements!
class NewArray final : public Instruction {
public: