diff --git a/boa_engine/src/bytecompiler/declarations.rs b/boa_engine/src/bytecompiler/declarations.rs index 295654a634d..0afd0ac2a58 100644 --- a/boa_engine/src/bytecompiler/declarations.rs +++ b/boa_engine/src/bytecompiler/declarations.rs @@ -750,9 +750,7 @@ impl ByteCompiler<'_, '_> { else { // b. Let fo be InstantiateFunctionObject of f with arguments lexEnv and privateEnv. let index = self.push_function_to_constants(code); - if r#async && generator { - self.emit_with_varying_operand(Opcode::GetGeneratorAsync, index); - } else if generator { + if generator { self.emit_with_varying_operand(Opcode::GetGenerator, index); } else { self.emit( diff --git a/boa_engine/src/bytecompiler/mod.rs b/boa_engine/src/bytecompiler/mod.rs index 58364f6d5ec..e187655e927 100644 --- a/boa_engine/src/bytecompiler/mod.rs +++ b/boa_engine/src/bytecompiler/mod.rs @@ -1253,17 +1253,11 @@ impl<'ctx, 'host> ByteCompiler<'ctx, 'host> { use_expr: bool, ) { let name = function.name; - let (generator, r#async, arrow) = ( - function.kind.is_generator(), - function.kind.is_async(), - function.kind.is_arrow(), - ); + let (generator, arrow) = (function.kind.is_generator(), function.kind.is_arrow()); let index = self.function(function); - if r#async && generator { - self.emit_with_varying_operand(Opcode::GetGeneratorAsync, index); - } else if generator { + if generator { self.emit_with_varying_operand(Opcode::GetGenerator, index); } else if arrow { self.emit(Opcode::GetArrowFunction, &[Operand::Varying(index)]); @@ -1331,9 +1325,7 @@ impl<'ctx, 'host> ByteCompiler<'ctx, 'host> { let index = self.push_function_to_constants(code); - if r#async && generator { - self.emit_with_varying_operand(Opcode::GetGeneratorAsync, index); - } else if generator { + if generator { self.emit_with_varying_operand(Opcode::GetGenerator, index); } else if arrow { self.emit(Opcode::GetArrowFunction, &[Operand::Varying(index)]); @@ -1387,9 +1379,7 @@ impl<'ctx, 'host> ByteCompiler<'ctx, 'host> { let index = self.push_function_to_constants(code); - if r#async && generator { - self.emit_with_varying_operand(Opcode::GetGeneratorAsync, index); - } else if generator { + if generator { self.emit_with_varying_operand(Opcode::GetGenerator, index); } else if arrow { self.emit(Opcode::GetArrowFunction, &[Operand::Varying(index)]); diff --git a/boa_engine/src/vm/code_block.rs b/boa_engine/src/vm/code_block.rs index 0b9a1e8fbe5..d0e27676137 100644 --- a/boa_engine/src/vm/code_block.rs +++ b/boa_engine/src/vm/code_block.rs @@ -463,9 +463,7 @@ impl CodeBlock { self.constant_function(index).length ) } - Instruction::GetArrowFunction { index } - | Instruction::GetGenerator { index } - | Instruction::GetGeneratorAsync { index } => { + Instruction::GetArrowFunction { index } | Instruction::GetGenerator { index } => { let index = index.value() as usize; format!( "{index:04}: '{}' (length: {})", @@ -716,7 +714,8 @@ impl CodeBlock { | Instruction::Reserved55 | Instruction::Reserved56 | Instruction::Reserved57 - | Instruction::Reserved58 => unreachable!("Reserved opcodes are unrechable"), + | Instruction::Reserved58 + | Instruction::Reserved59 => unreachable!("Reserved opcodes are unrechable"), } } } diff --git a/boa_engine/src/vm/flowgraph/mod.rs b/boa_engine/src/vm/flowgraph/mod.rs index 4d7d4d2cd5a..e732dce3b37 100644 --- a/boa_engine/src/vm/flowgraph/mod.rs +++ b/boa_engine/src/vm/flowgraph/mod.rs @@ -246,7 +246,7 @@ impl CodeBlock { graph.add_node(previous_pc, NodeShape::None, label.into(), Color::None); graph.add_edge(previous_pc, pc, None, Color::None, EdgeStyle::Line); } - Instruction::GetGenerator { .. } | Instruction::GetGeneratorAsync { .. } => { + Instruction::GetGenerator { .. } => { graph.add_node(previous_pc, NodeShape::None, label.into(), Color::None); graph.add_edge(previous_pc, pc, None, Color::None, EdgeStyle::Line); } @@ -521,7 +521,8 @@ impl CodeBlock { | Instruction::Reserved55 | Instruction::Reserved56 | Instruction::Reserved57 - | Instruction::Reserved58 => unreachable!("Reserved opcodes are unrechable"), + | Instruction::Reserved58 + | Instruction::Reserved59 => unreachable!("Reserved opcodes are unrechable"), } } diff --git a/boa_engine/src/vm/opcode/get/generator.rs b/boa_engine/src/vm/opcode/get/generator.rs index 3abbfa7992d..54ef24492b3 100644 --- a/boa_engine/src/vm/opcode/get/generator.rs +++ b/boa_engine/src/vm/opcode/get/generator.rs @@ -40,41 +40,3 @@ impl Operation for GetGenerator { Self::operation(context, index) } } - -/// `GetGeneratorAsync` implements the Opcode Operation for `Opcode::GetGeneratorAsync` -/// -/// Operation: -/// - Get async generator function from the pre-compiled inner functions. -#[derive(Debug, Clone, Copy)] -pub(crate) struct GetGeneratorAsync; - -impl GetGeneratorAsync { - #[allow(clippy::unnecessary_wraps)] - fn operation(context: &mut Context<'_>, index: usize) -> JsResult { - let code = context.vm.frame().code_block().constant_function(index); - let function = create_generator_function_object(code, None, context); - context.vm.push(function); - Ok(CompletionType::Normal) - } -} - -impl Operation for GetGeneratorAsync { - const NAME: &'static str = "GetGeneratorAsync"; - const INSTRUCTION: &'static str = "INST - GetGeneratorAsync"; - const COST: u8 = 3; - - fn execute(context: &mut Context<'_>) -> JsResult { - let index = context.vm.read::() as usize; - Self::operation(context, index) - } - - fn execute_with_u16_operands(context: &mut Context<'_>) -> JsResult { - let index = context.vm.read::() as usize; - Self::operation(context, index) - } - - fn execute_with_u32_operands(context: &mut Context<'_>) -> JsResult { - let index = context.vm.read::() as usize; - Self::operation(context, index) - } -} diff --git a/boa_engine/src/vm/opcode/mod.rs b/boa_engine/src/vm/opcode/mod.rs index 61ff262486d..97a26127986 100644 --- a/boa_engine/src/vm/opcode/mod.rs +++ b/boa_engine/src/vm/opcode/mod.rs @@ -1690,13 +1690,6 @@ generate_opcodes! { /// Stack: **=>** func GetGenerator { index: VaryingOperand }, - /// Get async generator function from the pre-compiled inner functions. - /// - /// Operands: index: `VaryingOperand`, - /// - /// Stack: **=>** func - GetGeneratorAsync { index: VaryingOperand }, - /// Call a function named "eval". /// /// Operands: argument_count: `VaryingOperand` @@ -2211,6 +2204,8 @@ generate_opcodes! { Reserved57 => Reserved, /// Reserved [`Opcode`]. Reserved58 => Reserved, + /// Reserved [`Opcode`]. + Reserved59 => Reserved, } /// Specific opcodes for bindings.