avm2: Avoid a function call on every push()

This commit is contained in:
Adrian Wielgosik 2023-05-22 20:35:09 +02:00 committed by Nathan Adams
parent 9a1a21ef3a
commit a1797a351d
1 changed files with 5 additions and 2 deletions

View File

@ -503,10 +503,13 @@ impl<'gc> Avm2<'gc> {
}
let mut value = value.into();
if let Value::Object(o) = value {
// this is hot, so let's avoid a non-inlined call here
if let Object::PrimitiveObject(_) = o {
if let Some(prim) = o.as_primitive() {
value = *prim;
}
}
}
avm_debug!(self, "Stack push {}: {value:?}", self.stack.len());
self.stack.push(value);