mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 09:02:43 +00:00 
			
		
		
		
	LibJS: Add a debug_position helper to the Bytecode Interpreter
This also changes argument_list_evaluation's dbgln to use it.
This commit is contained in:
		
							parent
							
								
									b86f1c2fe7
								
							
						
					
					
						commit
						8c4717fc6e
					
				
					 2 changed files with 5 additions and 2 deletions
				
			
		|  | @ -68,6 +68,10 @@ public: | ||||||
|     Executable const& current_executable() { return *m_current_executable; } |     Executable const& current_executable() { return *m_current_executable; } | ||||||
|     BasicBlock const& current_block() const { return *m_current_block; } |     BasicBlock const& current_block() const { return *m_current_block; } | ||||||
|     size_t pc() const { return m_pc ? m_pc->offset() : 0; } |     size_t pc() const { return m_pc ? m_pc->offset() : 0; } | ||||||
|  |     String debug_position() | ||||||
|  |     { | ||||||
|  |         return String::formatted("{}:{:2}:{:4x}", m_current_executable->name, m_current_block->name(), pc()); | ||||||
|  |     } | ||||||
| 
 | 
 | ||||||
|     enum class OptimizationLevel { |     enum class OptimizationLevel { | ||||||
|         None, |         None, | ||||||
|  |  | ||||||
|  | @ -577,8 +577,7 @@ static MarkedVector<Value> argument_list_evaluation(Bytecode::Interpreter& inter | ||||||
|     auto arguments = interpreter.accumulator(); |     auto arguments = interpreter.accumulator(); | ||||||
| 
 | 
 | ||||||
|     if (!(arguments.is_object() && is<Array>(arguments.as_object()))) { |     if (!(arguments.is_object() && is<Array>(arguments.as_object()))) { | ||||||
|         dbgln("Call arguments are not an array, but: {}", arguments.to_string_without_side_effects()); |         dbgln("[{}] Call arguments are not an array, but: {}", interpreter.debug_position(), arguments.to_string_without_side_effects()); | ||||||
|         dbgln("PC: {}[{:4x}]", interpreter.current_block().name(), interpreter.pc()); |  | ||||||
|         interpreter.current_executable().dump(); |         interpreter.current_executable().dump(); | ||||||
|         VERIFY_NOT_REACHED(); |         VERIFY_NOT_REACHED(); | ||||||
|     } |     } | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Hendiadyoin1
						Hendiadyoin1