avm2: Optimize unnecessary `Coerce` when it comes after `PushString`, `NewArray`, and `NewFunction`
This commit is contained in:
parent
f99c5621ee
commit
dd82126448
|
@ -760,7 +760,14 @@ fn optimize<'gc>(
|
|||
) && !GcCell::ptr_eq(
|
||||
class,
|
||||
activation.avm2().classes().void.inner_class_definition(),
|
||||
) && !GcCell::ptr_eq(
|
||||
) {
|
||||
previous_op = Some(op.clone());
|
||||
*op = Op::Nop;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
Op::PushString { .. } => {
|
||||
if GcCell::ptr_eq(
|
||||
class,
|
||||
activation.avm2().classes().string.inner_class_definition(),
|
||||
) {
|
||||
|
@ -769,6 +776,30 @@ fn optimize<'gc>(
|
|||
continue;
|
||||
}
|
||||
}
|
||||
Op::NewArray { .. } => {
|
||||
if GcCell::ptr_eq(
|
||||
class,
|
||||
activation.avm2().classes().array.inner_class_definition(),
|
||||
) {
|
||||
previous_op = Some(op.clone());
|
||||
*op = Op::Nop;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
Op::NewFunction { .. } => {
|
||||
if GcCell::ptr_eq(
|
||||
class,
|
||||
activation
|
||||
.avm2()
|
||||
.classes()
|
||||
.function
|
||||
.inner_class_definition(),
|
||||
) {
|
||||
previous_op = Some(op.clone());
|
||||
*op = Op::Nop;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
Op::Coerce {
|
||||
index: previous_name_index,
|
||||
} => {
|
||||
|
|
Loading…
Reference in New Issue