From a1797a351debc2b4f1af89d9b2c02fa139eb72c6 Mon Sep 17 00:00:00 2001 From: Adrian Wielgosik Date: Mon, 22 May 2023 20:35:09 +0200 Subject: [PATCH] avm2: Avoid a function call on every push() --- core/src/avm2.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/core/src/avm2.rs b/core/src/avm2.rs index 74ee9d647..f82044f23 100644 --- a/core/src/avm2.rs +++ b/core/src/avm2.rs @@ -503,8 +503,11 @@ impl<'gc> Avm2<'gc> { } let mut value = value.into(); if let Value::Object(o) = value { - if let Some(prim) = o.as_primitive() { - value = *prim; + // 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; + } } }