feat: 生成器基础支持(YIELD 帧快照挂起/恢复 + GeneratorPrototype next/return/throw)

- 新增 YIELD/SUSPEND_BODY opcode;function* 识别与 yield emit
- GeneratorState 全量快照 VM 执行上下文(regs/pc/bytecode/spill/save/try/cell 栈段/迭代器)
- 调用时参数初始化(默认值/解构副作用与异常在 g() 时刻生效)
- %GeneratorPrototype%/%GeneratorFunction.prototype% 内建对象与 next/return/throw
- session GC trace 生成器状态 JsValues;闭包捕获分析补 yield/赋值目标扫描
This commit is contained in:
爱特每羊队
2026-08-09 18:02:08 +08:00
parent 7c2e9ec1ff
commit 6f80c12ac9
26 changed files with 1265 additions and 107 deletions
+3
View File
@@ -50,6 +50,8 @@ pub struct IRFunction {
pub is_class_constructor: bool,
pub is_derived_constructor: bool,
pub needs_home_object: bool,
/// 是否为生成器函数体(`function*`)。
pub is_generator: bool,
pub captured_this_const_idx: u16,
pub function_name: Option<String>,
/// 函数 `length` 属性值:第一个带默认值/解构默认的形参之前的形参数(rest 不计)。
@@ -80,6 +82,7 @@ impl IRFunction {
is_class_constructor: false,
is_derived_constructor: false,
needs_home_object: false,
is_generator: false,
captured_this_const_idx: 0,
function_name: None,
function_length: 0,