diff --git a/boa_engine/src/bytecompiler/jump_control.rs b/boa_engine/src/bytecompiler/jump_control.rs new file mode 100644 index 00000000000..7dc30b38bc0 --- /dev/null +++ b/boa_engine/src/bytecompiler/jump_control.rs @@ -0,0 +1,389 @@ +//! `JumpControlInfo` tracks relevant jump information used during compilation. +//! +//! Primarily, jump control tracks information related to the compilation of [iteration +//! statements][iteration spec], [switch statements][switch spec], [try statements][try spec], +//! and [labelled statements][labelled spec]. +//! +//! [iteration spec]: https://tc39.es/ecma262/#sec-iteration-statements +//! [switch spec]: https://tc39.es/ecma262/#sec-switch-statement +//! [try spec]: https://tc39.es/ecma262/#sec-try-statement +//! [labelled spec]: https://tc39.es/ecma262/#sec-labelled-statements + +use crate::{ + bytecompiler::{ByteCompiler, Label}, + vm::Opcode, +}; +use bitflags::bitflags; +use boa_interner::Sym; +use std::mem::size_of; + +/// Boa's `ByteCompiler` jump information tracking struct. +#[derive(Debug, Clone)] +pub(crate) struct JumpControlInfo { + label: Option, + start_address: u32, + decl_envs: u32, + flags: JumpControlInfoFlags, + breaks: Vec