| 
									
										
										
										
											2021-10-24 13:30:49 +02:00
										 |  |  | /*
 | 
					
						
							| 
									
										
										
										
											2023-07-08 17:43:26 +02:00
										 |  |  |  * Copyright (c) 2021-2023, Andreas Kling <kling@serenityos.org> | 
					
						
							| 
									
										
										
										
											2021-10-24 13:30:49 +02:00
										 |  |  |  * | 
					
						
							|  |  |  |  * SPDX-License-Identifier: BSD-2-Clause | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #pragma once
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-01-08 19:23:00 -05:00
										 |  |  | #include <AK/DeprecatedFlyString.h>
 | 
					
						
							| 
									
										
										
										
											2023-03-06 17:39:59 +01:00
										 |  |  | #include <AK/NonnullOwnPtr.h>
 | 
					
						
							| 
									
										
										
										
											2023-07-08 17:43:26 +02:00
										 |  |  | #include <AK/WeakPtr.h>
 | 
					
						
							| 
									
										
										
										
											2021-10-24 13:30:49 +02:00
										 |  |  | #include <LibJS/Bytecode/BasicBlock.h>
 | 
					
						
							| 
									
										
										
										
											2021-10-24 15:34:30 +02:00
										 |  |  | #include <LibJS/Bytecode/IdentifierTable.h>
 | 
					
						
							| 
									
										
										
										
											2023-07-13 10:49:07 +02:00
										 |  |  | #include <LibJS/Bytecode/RegexTable.h>
 | 
					
						
							| 
									
										
										
										
											2021-10-24 13:30:49 +02:00
										 |  |  | #include <LibJS/Bytecode/StringTable.h>
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | namespace JS::Bytecode { | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-07-08 17:43:26 +02:00
										 |  |  | struct PropertyLookupCache { | 
					
						
							|  |  |  |     WeakPtr<Shape> shape; | 
					
						
							|  |  |  |     Optional<u32> property_offset; | 
					
						
							| 
									
										
										
										
											2023-07-10 20:45:31 +02:00
										 |  |  |     u64 unique_shape_serial_number { 0 }; | 
					
						
							| 
									
										
										
										
											2023-07-08 17:43:26 +02:00
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-07-12 04:06:59 +02:00
										 |  |  | struct GlobalVariableCache : public PropertyLookupCache { | 
					
						
							|  |  |  |     u64 environment_serial_number { 0 }; | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-10-24 13:30:49 +02:00
										 |  |  | struct Executable { | 
					
						
							| 
									
										
										
										
											2023-01-08 19:23:00 -05:00
										 |  |  |     DeprecatedFlyString name; | 
					
						
							| 
									
										
										
										
											2023-07-08 17:43:26 +02:00
										 |  |  |     Vector<PropertyLookupCache> property_lookup_caches; | 
					
						
							| 
									
										
										
										
											2023-07-12 04:06:59 +02:00
										 |  |  |     Vector<GlobalVariableCache> global_variable_caches; | 
					
						
							| 
									
										
										
										
											2023-03-06 17:16:25 +01:00
										 |  |  |     Vector<NonnullOwnPtr<BasicBlock>> basic_blocks; | 
					
						
							| 
									
										
										
										
											2021-10-24 13:30:49 +02:00
										 |  |  |     NonnullOwnPtr<StringTable> string_table; | 
					
						
							| 
									
										
										
										
											2021-10-24 15:34:30 +02:00
										 |  |  |     NonnullOwnPtr<IdentifierTable> identifier_table; | 
					
						
							| 
									
										
										
										
											2023-07-13 10:49:07 +02:00
										 |  |  |     NonnullOwnPtr<RegexTable> regex_table; | 
					
						
							| 
									
										
										
										
											2021-10-24 13:30:49 +02:00
										 |  |  |     size_t number_of_registers { 0 }; | 
					
						
							| 
									
										
										
										
											2022-07-17 18:56:36 +01:00
										 |  |  |     bool is_strict_mode { false }; | 
					
						
							| 
									
										
										
										
											2021-10-24 13:30:49 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-12-04 18:02:33 +00:00
										 |  |  |     DeprecatedString const& get_string(StringTableIndex index) const { return string_table->get(index); } | 
					
						
							| 
									
										
										
										
											2023-01-08 19:23:00 -05:00
										 |  |  |     DeprecatedFlyString const& get_identifier(IdentifierTableIndex index) const { return identifier_table->get(index); } | 
					
						
							| 
									
										
										
										
											2021-10-24 13:30:49 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |     void dump() const; | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | } |