Skip to content

Truly independent web browser

LibJS/JIT: Fold CheckObject of object constants

Andreas Kling265711768acd
diff --git a/Libraries/LibJS/JIT/Rust/src/passes/check_elimination.rs b/Libraries/LibJS/JIT/Rust/src/passes/check_elimination.rs
index 1e34488b9d7..b6f83d680d7 100644
--- a/Libraries/LibJS/JIT/Rust/src/passes/check_elimination.rs
+++ b/Libraries/LibJS/JIT/Rust/src/passes/check_elimination.rs
@@ -416,7 +416,10 @@ fn visit_node(
match node.op {
Op::CheckObject => {
let value = input(0);
- remove = removable && facts.is_object(value);
+ let is_object_constant = graph
+ .constant_value(value)
+ .is_some_and(|bits| crate::ir::value::tag(bits) == crate::ir::value::OBJECT_TAG);
+ remove = removable && (is_object_constant || facts.is_object(value));
facts.set_object(value);
}
Op::CheckShape { ref shapes } => {