Skip to content

Commit 72e5a26

Browse files
Lord-McSweeneyLord-McSweeney
authored andcommitted
avm2: Use type information from NewActivation in optimizer
1 parent 990d1e0 commit 72e5a26

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

core/src/avm2/activation.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -597,6 +597,11 @@ impl<'a, 'gc> Activation<'a, 'gc> {
597597
.map(|scope| scope.values())
598598
}
599599

600+
pub fn activation_class(&mut self) -> ClassObject<'gc> {
601+
self.activation_class
602+
.expect("Expected to be running bytecode method")
603+
}
604+
600605
pub fn avm2(&mut self) -> &mut Avm2<'gc> {
601606
self.context.avm2
602607
}
@@ -1734,10 +1739,7 @@ impl<'a, 'gc> Activation<'a, 'gc> {
17341739
}
17351740

17361741
fn op_new_activation(&mut self) -> Result<FrameControl<'gc>, Error<'gc>> {
1737-
let instance = self
1738-
.activation_class
1739-
.expect("Activation class should exist for bytecode")
1740-
.construct(self, &[])?;
1742+
let instance = self.activation_class().construct(self, &[])?;
17411743

17421744
self.push_stack(instance);
17431745

core/src/avm2/optimizer/optimize.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1734,8 +1734,9 @@ fn abstract_interpret_ops<'gc>(
17341734
stack.pop(activation)?;
17351735
}
17361736
Op::NewActivation => {
1737-
// Avoid handling for now
1738-
stack.push_any(activation)?;
1737+
let activation_class = activation.activation_class();
1738+
1739+
stack.push_class_not_null(activation, activation_class.inner_class_definition())?;
17391740
}
17401741
Op::Nop => {}
17411742
Op::DebugFile { .. }

0 commit comments

Comments
 (0)