mirror of
https://github.com/RGBCube/serenity
synced 2025-05-16 17:55:06 +00:00
LibJS/Bytecode: Make primitive strings be constants
Instead of emitting a NewString instruction to construct a primitive string from a parsed literal, we now instantiate the PrimitiveString on the heap during codegen.
This commit is contained in:
parent
fd694e8672
commit
46d209c55b
8 changed files with 27 additions and 52 deletions
|
@ -15,16 +15,18 @@
|
|||
|
||||
namespace JS::Bytecode {
|
||||
|
||||
Generator::Generator()
|
||||
: m_string_table(make<StringTable>())
|
||||
Generator::Generator(VM& vm)
|
||||
: m_vm(vm)
|
||||
, m_string_table(make<StringTable>())
|
||||
, m_identifier_table(make<IdentifierTable>())
|
||||
, m_regex_table(make<RegexTable>())
|
||||
, m_constants(vm.heap())
|
||||
{
|
||||
}
|
||||
|
||||
CodeGenerationErrorOr<NonnullGCPtr<Executable>> Generator::generate(VM& vm, ASTNode const& node, ReadonlySpan<FunctionParameter> parameters, FunctionKind enclosing_function_kind)
|
||||
{
|
||||
Generator generator;
|
||||
Generator generator(vm);
|
||||
|
||||
for (auto const& parameter : parameters) {
|
||||
if (auto const* identifier = parameter.binding.get_pointer<NonnullRefPtr<Identifier const>>();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue