diff --git a/core/engine/src/bytecompiler/mod.rs b/core/engine/src/bytecompiler/mod.rs index db4607d1abd..8242b1f629c 100644 --- a/core/engine/src/bytecompiler/mod.rs +++ b/core/engine/src/bytecompiler/mod.rs @@ -988,10 +988,12 @@ impl<'ctx> ByteCompiler<'ctx> { let ic_index = self.ic.len() as u32; let name_index = self.get_or_insert_name(ident); - let Constant::String(ref name) = self.constants[name_index as usize].clone() else { + let Constant::String(name) = &self.constants[name_index as usize] else { unreachable!("there should be a string at index") }; - self.ic.push(InlineCache::new(name.clone())); + let is_length = *name == StaticJsStrings::LENGTH; + let name = name.clone(); + self.ic.push(InlineCache::new(name)); if let Some(receiver) = receiver { self.bytecode.emit_get_property_by_name_with_this( @@ -1000,7 +1002,7 @@ impl<'ctx> ByteCompiler<'ctx> { value.variable(), ic_index.into(), ); - } else if name == &StaticJsStrings::LENGTH { + } else if is_length { self.bytecode.emit_get_length_property( dst.variable(), value.variable(), @@ -1025,10 +1027,11 @@ impl<'ctx> ByteCompiler<'ctx> { let ic_index = self.ic.len() as u32; let name_index = self.get_or_insert_name(ident); - let Constant::String(ref name) = self.constants[name_index as usize].clone() else { + let Constant::String(name) = &self.constants[name_index as usize] else { unreachable!("there should be a string at index") }; - self.ic.push(InlineCache::new(name.clone())); + let name = name.clone(); + self.ic.push(InlineCache::new(name)); if let Some(receiver) = receiver { self.bytecode.emit_set_property_by_name_with_this(