mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 16:02:45 +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
				
			
		|  | @ -136,26 +136,6 @@ JS_ENUMERATE_COMMON_BINARY_OPS_WITH_FAST_PATH(JS_DECLARE_COMMON_BINARY_OP) | |||
| JS_ENUMERATE_COMMON_UNARY_OPS(JS_DECLARE_COMMON_UNARY_OP) | ||||
| #undef JS_DECLARE_COMMON_UNARY_OP | ||||
| 
 | ||||
| class NewString final : public Instruction { | ||||
| public: | ||||
|     NewString(Operand dst, StringTableIndex string) | ||||
|         : Instruction(Type::NewString, sizeof(*this)) | ||||
|         , m_dst(dst) | ||||
|         , m_string(string) | ||||
|     { | ||||
|     } | ||||
| 
 | ||||
|     ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const; | ||||
|     ByteString to_byte_string_impl(Bytecode::Executable const&) const; | ||||
| 
 | ||||
|     Operand dst() const { return m_dst; } | ||||
|     StringTableIndex index() const { return m_string; } | ||||
| 
 | ||||
| private: | ||||
|     Operand m_dst; | ||||
|     StringTableIndex m_string; | ||||
| }; | ||||
| 
 | ||||
| class NewObject final : public Instruction { | ||||
| public: | ||||
|     explicit NewObject(Operand dst) | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Andreas Kling
						Andreas Kling