(&mut self, vm: &VirtualMachine, instr_idx: usize, cache_base: usize)
| 9066 | } |
| 9067 | |
| 9068 | fn specialize_contains_op(&mut self, vm: &VirtualMachine, instr_idx: usize, cache_base: usize) { |
| 9069 | if !matches!( |
| 9070 | self.code.instructions.read_op(instr_idx), |
| 9071 | Instruction::ContainsOp { .. } |
| 9072 | ) { |
| 9073 | return; |
| 9074 | } |
| 9075 | let haystack = self.top_value(); // b = TOS = haystack |
| 9076 | let new_op = if haystack.downcast_ref_if_exact::<PyDict>(vm).is_some() { |
| 9077 | Some(Instruction::ContainsOpDict) |
| 9078 | } else if haystack.downcast_ref_if_exact::<PySet>(vm).is_some() |
| 9079 | || haystack.downcast_ref_if_exact::<PyFrozenSet>(vm).is_some() |
| 9080 | { |
| 9081 | Some(Instruction::ContainsOpSet) |
| 9082 | } else { |
| 9083 | None |
| 9084 | }; |
| 9085 | |
| 9086 | self.commit_specialization(instr_idx, cache_base, new_op); |
| 9087 | } |
| 9088 | |
| 9089 | fn specialize_unpack_sequence( |
| 9090 | &mut self, |
no test coverage detected