pub struct Interp {Show 40 fields
pub steps: u64,
pub max_steps: u64,
pub(crate) task_start: u64,
pub(crate) task_depth: u32,
pub(crate) microtask_step_cap: u64,
pub(crate) vm_stack: Vec<Value>,
pub(crate) window_pos: usize,
pub(crate) strict: bool,
pub(crate) implicit_globals: Vec<Rc<str>>,
pub(crate) arg_pool: Vec<Vec<Value>>,
pub(crate) scope_pool: Vec<Rc<RefCell<Scope>>>,
pub depth: u32,
pub max_depth: u32,
pub stack_limit: (usize, usize),
pub aborted: bool,
pub out: String,
pub(crate) host: &'static HostHooks,
pub(crate) host_state: Rc<dyn Any>,
pub microtasks: Rc<RefCell<VecDeque<Job>>>,
gen_replay: Option<GenReplay>,
pub macrotasks: Rc<RefCell<VecDeque<TimerTask>>>,
pub clock_skew: Rc<Cell<u64>>,
pub base_url: String,
pub global: Rc<RefCell<Scope>>,
pub modules: ModuleRegistry,
pub builtin_fn_cache: Rc<RefCell<BTreeMap<usize, Value>>>,
pub runtime_id: u64,
pub units_cache: Rc<RefCell<UnitsCache>>,
pub(crate) wm_index: Rc<RefCell<BTreeMap<usize, (Weak<RefCell<Obj>>, BTreeMap<usize, usize>)>>>,
pub(crate) global_lexicals: Rc<RefCell<BTreeSet<Rc<str>>>>,
pending_label: Option<Rc<str>>,
pending_new_target: Option<Value>,
pub(crate) forof_preset: Option<Value>,
pub(crate) join_stack: Vec<usize>,
new_target_stack: Vec<Value>,
pub(crate) derived_this_stack: Vec<Option<Value>>,
pub call_names: Vec<Value>,
pub(crate) active_param_names: Vec<Vec<Rc<str>>>,
pub(crate) eval_ctx_stack: Vec<EvalSyntaxCtx>,
pub(crate) private_brand_seq: Rc<Cell<u64>>,
}Expand description
1 回の評価セッションの実行器(ステップ予算等を保持)。
Fields§
§steps: u64§max_steps: u641 タスク(スクリプト・マイクロタスク・タイマー)あたりのステップ上限。無限ループ対策で、 超えたらそのタスクを打ち切る。
task_start: u64実行中のタスクが始まった時点の steps。
task_depth: u32別のタスクの内側か(同期 await がタスクを回している間は 1 以上)。
microtask_step_cap: u641 回の run_microtasks で使うステップの目安。超えたら次のタスクの切れ目で描画へ戻る。
vm_stack: Vec<Value>バイトコードの値スタック(bytecode.rs)。
window_pos: usizeグローバルの表の中の window の位置の覚え。
strict: boolいま実行している利用者のコードが strict モードか(関数の呼び出しごとに本体の strict へ切り替え、戻ると元に戻す)。
失敗した代入(PutValue)を TypeError にするかの判定に使う。
implicit_globals: Vec<Rc<str>>代入だけで作られたグローバル変数(delete で消せる)。
arg_pool: Vec<Vec<Value>>関数呼び出しの引数の Vec のプール(eval_arguments・recycle_args)。
scope_pool: Vec<Rc<RefCell<Scope>>>クロージャに捕捉されなかった関数呼び出しスコープの再利用プール。
depth: u32§max_depth: u32§stack_limit: (usize, usize)JS 呼び出しを打ち切る SP の下限と、そのスタックの上端(js_stack_window)。
別スレッドから使われて SP が範囲外になったら求め直す。
aborted: bool§out: String§host: &'static HostHooksホスト物(ObjKind::HostRef)の操作の表(2026-11-19 手順 7。js/host.rs)。
host_state: Rc<dyn Any>ホスト側の評価状態(InterpHostState 等)。ECMAScript の核は中身を知らない。
microtasks: Rc<RefCell<VecDeque<Job>>>Promise マイクロタスクキュー(ランタイムと共有)。
gen_replay: Option<GenReplay>generator 本体を replay 実行中の一時状態(None なら通常実行)。
macrotasks: Rc<RefCell<VecDeque<TimerTask>>>タイマーのキュー(ランタイムと共有)。
clock_skew: Rc<Cell<u64>>タイマー用の仮想時刻のずれ(ランタイムと共有)。
base_url: String現在ページの絶対URL(fetch/XHR の相対URL解決の基準。未設定なら空)。
global: Rc<RefCell<Scope>>グローバルスコープ(location/history などネイティブ側からの参照用)。
modules: ModuleRegistry登録済み ES モジュール(ランタイムと共有)。
builtin_fn_cache: Rc<RefCell<BTreeMap<usize, Value>>>組込みネイティブ関数のシングルトン値を取得する(関数ポインタアドレスでキャッシュ)。
runtime_id: u64実行環境の番号(JsRuntime::runtime_id の写し。作った SourceBuffer に付ける。2026-11-17)。
units_cache: Rc<RefCell<UnitsCache>>長い文字列の UTF-16 の単位の写し(charCodeAt の繰り返しが毎回全文を変換しないように)。
wm_index: Rc<RefCell<BTreeMap<usize, (Weak<RefCell<Obj>>, BTreeMap<usize, usize>)>>>WeakMap の索引(ランタイムと共有)。
global_lexicals: Rc<RefCell<BTreeSet<Rc<str>>>>トップレベルのレキシカル宣言(let/const/class/using)の名前の集合(ランタイムと共有)。
pending_label: Option<Rc<str>>Statement::Labeled がループ文を実行する直前にセットする、そのループ自身の
ラベル名(break label/continue label が「自分宛て」かどうかの判定に使う)。
ループの実行開始直後に take() で消費するため、ネストしたループ/ラベルには
影響しない(exec_stmt のシグネチャにラベル引数を追加する代わりの軽量な方式)。
pending_new_target: Option<Value>construct_object() が new 経由の呼び出し直前にセットする、その呼び出し先
コンストラクタ自身の値。call_value_inner の CallKind::User 実行開始時に
take() して new_target_stack へ push する(pending_label と同じ軽量な方式)。
forof_preset: Option<Value>バイトコードが評価済みの for-of の反復対象を、木走査の exec_for_in へ渡すための一時置き場(Op::IterInitOrExec)。
join_stack: Vec<usize>Array.prototype.join で今つないでいる配列(循環する配列を “” にするため。仕様外だが V8 と同じ)。
new_target_stack: Vec<Value>new.target(MetaProperty)の現在値のスタック。関数呼び出しごとに
(アロー関数を除き)push/pop する。空なら(モジュールトップレベル等)undefined。
derived_this_stack: Vec<Option<Value>>派生クラスコンストラクタ内の super() が返した置換後 this のスタック。
call_names: Vec<Value>呼び出し中の関数(外側から順)。例外の stack に at 名前 として積む
(2026-09-26。従来は Error: メッセージ の 1 行だけで、どこで起きたか分からなかった)。
【2026-10-24】名前の文字列は必要になったときに作る(呼び出しのたびの確保をやめた)。
active_param_names: Vec<Vec<Rc<str>>>引数デフォルト式評価中に direct eval から var 再宣言を禁止する仮引数名群。
eval_ctx_stack: Vec<EvalSyntaxCtx>direct eval 用の現在実行中関数/フィールド初期化子/staticブロックの静的構文コンテキストスタック。
private_brand_seq: Rc<Cell<u64>>クラスプライベートブランド ID 採番器(JsRuntime と共有)。
Implementations§
Source§impl Interp
impl Interp
Sourcepub(crate) fn host_keys_of(&self, kind: &ObjKind) -> HostKeys
pub(crate) fn host_keys_of(&self, kind: &ObjKind) -> HostKeys
自身の列挙可能なプロパティの所在(Object.keys など)。ホスト物と、ECMAScript の内部の物(Iter・GenReturn)を見分ける。
Source§impl Interp
impl Interp
Sourcefn load_slot(
&mut self,
name: &Rc<str>,
slot: &Slot,
scope: &Rc<RefCell<Scope>>,
) -> Result<Value, Value>
fn load_slot( &mut self, name: &Rc<str>, slot: &Slot, scope: &Rc<RefCell<Scope>>, ) -> Result<Value, Value>
変数を読む。覚えた場所があれば名前の検索なしで読む。
fn load_slot_miss( &mut self, name: &Rc<str>, slot: &Slot, scope: &Rc<RefCell<Scope>>, ) -> Result<Value, Value>
Sourcefn store_slot(
&mut self,
target: &Expression,
v: Value,
slot: &Slot,
scope: &Rc<RefCell<Scope>>,
this: &Value,
) -> Result<(), Value>
fn store_slot( &mut self, target: &Expression, v: Value, slot: &Slot, scope: &Rc<RefCell<Scope>>, this: &Value, ) -> Result<(), Value>
name = v。覚えた場所があれば名前の検索なしで書く。
Sourcepub(crate) fn run_code(
&mut self,
code: &Code,
scope: &Rc<RefCell<Scope>>,
this: &Value,
) -> Result<Value, Value>
pub(crate) fn run_code( &mut self, code: &Code, scope: &Rc<RefCell<Scope>>, this: &Value, ) -> Result<Value, Value>
code を実行して関数の戻り値を返す。
fn run_code_inner( &mut self, code: &Code, call_scope: &Rc<RefCell<Scope>>, block_scopes: &mut Vec<Rc<RefCell<Scope>>>, this: &Value, ) -> Result<Value, Value>
fn try_prop_entry( &self, b: &Obj, name: &str, entry: &PropSlotEntry, cur_proto: Option<ObjRef>, ) -> Option<Value>
fn get_prop_fast( &self, obj: &Value, name: &str, slot: &PropSlot, ) -> Option<Value>
Sourcefn builtin_proto_data(&self, ctor: &str, name: &str) -> Option<Value>
fn builtin_proto_data(&self, ctor: &str, name: &str) -> Option<Value>
組込みの原型(Array.prototype 等)の自前のデータプロパティ。アクセサや無い名前は None(遅い経路へ)。
fn learn_prop_slot(&self, obj: &Value, name: &str, slot: &PropSlot)
fn op_typeof_ident( &mut self, code: &Code, name_idx: u32, slot_idx: u32, scope: &Rc<RefCell<Scope>>, ) -> Result<Value, Value>
fn op_binary_slow( &mut self, op: &BinaryOp, l: Value, r: Value, ) -> Result<Value, Value>
fn op_member( &mut self, code: &Code, name: u32, object: *const Expression, slot: u32, ) -> Result<(), Value>
fn op_index(&mut self) -> Result<(), Value>
fn op_method( &mut self, code: &Code, name: u32, object: *const Expression, slot: u32, ) -> Result<(), Value>
fn op_method_index(&mut self) -> Result<(), Value>
Sourcefn try_inline_native(
&mut self,
fn_ptr: NativeFn,
at: usize,
argc: usize,
) -> bool
fn try_inline_native( &mut self, fn_ptr: NativeFn, at: usize, argc: usize, ) -> bool
ホットビルトインを vm_stack 上で直接実行する(成功時 true、フォールバック時 false)。
fn op_call(&mut self, argc: u32, callee: *const Expression) -> Result<(), Value>
fn op_call_with_args(&mut self, callee: *const Expression) -> Result<(), Value>
Sourcefn op_decl_var(
&mut self,
code: &Code,
pat: *const Pattern,
slot: u32,
scope: &Rc<RefCell<Scope>>,
) -> Result<(), Value>
fn op_decl_var( &mut self, code: &Code, pat: *const Pattern, slot: u32, scope: &Rc<RefCell<Scope>>, ) -> Result<(), Value>
変換の対象は単純な名前だけで、巻き上げ済みなので関数のスコープに必ずある。
fn op_store( &mut self, code: &Code, target: *const Expression, slot: u32, scope: &Rc<RefCell<Scope>>, this: &Value, ) -> Result<(), Value>
Sourcefn op_add_assign_ident(
&mut self,
code: &Code,
target: *const Expression,
slot: u32,
scope: &Rc<RefCell<Scope>>,
this: &Value,
) -> Result<(), Value>
fn op_add_assign_ident( &mut self, code: &Code, target: *const Expression, slot: u32, scope: &Rc<RefCell<Scope>>, this: &Value, ) -> Result<(), Value>
name += value。スタックの [今の値, 右辺] を取り、結果を残す。
【2026-11-05】文字列を伸ばすループ(s += x)が毎回 s 全体を写して新しい文字列を作り、長さの 2 乗の
写しになっていた(QEMU の YouTube で memcpy の最大の呼び出し元が二項演算)。右辺を評価した後で、変数が持つ文字列を
参照しているのが変数と読み出した値の 2 つだけなら、読み出した方を手放して変数の文字列の末尾に足す。
fn op_store_member(&mut self, code: &Code, name: u32) -> Result<(), Value>
fn op_store_index(&mut self) -> Result<(), Value>
fn op_update( &mut self, code: &Code, name: u32, target: *const Expression, delta: f64, prefix: bool, slot: u32, scope: &Rc<RefCell<Scope>>, this: &Value, ) -> Result<(), Value>
fn op_update_member( &mut self, code: &Code, name: u32, object: *const Expression, delta: f64, prefix: bool, slot: u32, ) -> Result<(), Value>
fn op_update_index(&mut self, delta: f64, prefix: bool) -> Result<(), Value>
fn op_delete_member(&mut self, code: &Code, name: u32) -> Result<(), Value>
fn op_delete_index(&mut self) -> Result<(), Value>
fn op_array(&mut self, len: u32)
fn op_init_prop(&mut self, code: &Code, name: u32)
fn op_init_prop_computed(&mut self) -> Result<(), Value>
fn op_spread_object(&mut self) -> Result<(), Value>
fn op_array_spread(&mut self) -> Result<(), Value>
fn op_new(&mut self, argc: u32) -> Result<(), Value>
fn op_template( &mut self, quasis: *const Vec<String>, len: u32, ) -> Result<(), Value>
fn op_iter_init(&mut self, of: bool) -> Result<(), Value>
fn pop_next_iter_item( &mut self, is_lexical: bool, call_scope: &Rc<RefCell<Scope>>, block_scopes: &mut Vec<Rc<RefCell<Scope>>>, ) -> Option<Value>
Sourcefn throw_deferred_iter_err(&mut self) -> Result<(), Value>
fn throw_deferred_iter_err(&mut self) -> Result<(), Value>
要素が尽きた反復の配列に、途中の例外(_iterr)が残っていれば投げる(for-of が最後まで回ったときだけ呼ぶ)。
fn op_iter_next( &mut self, code: &Code, name_idx: u32, slot_idx: u32, is_lexical: bool, call_scope: &Rc<RefCell<Scope>>, block_scopes: &mut Vec<Rc<RefCell<Scope>>>, ) -> bool
Source§impl Interp
impl Interp
Sourcepub(crate) fn mark_task_start(&mut self)
pub(crate) fn mark_task_start(&mut self)
新しいタスクの開始を記録する(JS の実行中や同期 await の内側では何もしない)。
【2026-11-01】ステップ上限は評価全体の累積で、重いページでは正常なタスクが実行の途中で
打ち切られていた。Polymer の _stampTemplate が途中で切られると host スタックが積まれたまま
残り、以後の部品がすべて壊れる(YouTube の視聴ページの len=112)。実ブラウザは実行中の
タスクを殺さないので、上限は無限ループ対策としてタスクごとにかける。
Sourcefn tick_abort_tab_kill(&mut self) -> bool
fn tick_abort_tab_kill(&mut self) -> bool
【2026-11-18 TODO R2 (d)】このタブだけを止める合図が来た。ステップの上限と同じく aborted を立てて
今のスクリプトを打ち切る(try/catch では捕まらない)。タブはアプリのスレッドが描画から戻った所で閉じる。
Sourcefn cooperative_slice(&self) -> bool
fn cooperative_slice(&self) -> bool
32,768 ステップごとに協調的タイムスライスを実行し、他スレッド(USB/NET/GPU提示)へ CPU を譲渡する(TODO A3)。 戻り値: このタブだけを止める合図が来ていれば true(TODO R2 (d)、2026-11-18)。
Sourcefn prof_sample(&self)
fn prof_sample(&self)
【一時診断】65536 ステップごとに実行中の関数(いちばん内側)を数え、20 秒ごとに多い順に出す(TODO B0: BotGuard の初期化の重い所)。
fn tick_abort(&mut self) -> bool
fn log_progress(&self, what: &str)
Source§impl Interp
impl Interp
Sourcepub(crate) fn note_thrown_value(&self, v: &Value)
pub(crate) fn note_thrown_value(&self, v: &Value)
【2026-11-04 診断】JS の throw 文で投げた値を note_engine_error と同じ表へ記録する(TODO B0)。
利用者のコードを呼ばないよう、Error なら自身の name/message、それ以外は型だけを見る。
Sourcepub fn type_error(&self, msg: impl Into<String>) -> Value
pub fn type_error(&self, msg: impl Into<String>) -> Value
it.error()と同じだがError.prototypeではなくTypeError.prototypeへ
proto を繋ぐ(name文字列を"TypeError"へ書き換えるだけでは
instanceof TypeErrorが満たされない、new Node()等が投げる
“Illegal constructor” 例外で発覚したバグの修正用に新設。
2026-07-18 発見・実装)。
Sourcepub fn reference_error(&self, msg: impl Into<String>) -> Value
pub fn reference_error(&self, msg: impl Into<String>) -> Value
ReferenceError(未宣言の変数など)。
Sourcepub fn syntax_error(&self, msg: impl Into<String>) -> Value
pub fn syntax_error(&self, msg: impl Into<String>) -> Value
SyntaxError(eval/new Function に渡したソースの構文エラー)。
Sourcepub fn range_error(&self, msg: impl Into<String>) -> Value
pub fn range_error(&self, msg: impl Into<String>) -> Value
RangeError(呼び出しが深すぎる等)。
Sourcepub(crate) fn error_of_kind(&self, kind: &str, msg: impl Into<String>) -> Value
pub(crate) fn error_of_kind(&self, kind: &str, msg: impl Into<String>) -> Value
kind(TypeError・RangeError 等)の例外オブジェクト(proto もその種類へ繋ぐ)。
pub(crate) fn throw(&self, msg: impl Into<String>) -> Value
Sourcepub(crate) fn eval_source(&mut self, source: &str) -> Result<Value, Value>
pub(crate) fn eval_source(&mut self, source: &str) -> Result<Value, Value>
グローバル eval(source) / Function(...) の実体。仕様上 direct eval は呼び出し元の
レキシカルスコープを見るが、この処理系は常にグローバルスコープで実行する簡略実装
(indirect eval (0,eval)(code) と同じセマンティクス)。
Sourcepub fn eval_script_source(&mut self, source: &str) -> Result<Value, Value>
pub fn eval_script_source(&mut self, source: &str) -> Result<Value, Value>
スクリプト評価($262.evalScript 等。is_eval = false として configurable: false のグローバル宣言を作る)。
Sourcepub(crate) fn eval_source_in(
&mut self,
source: &str,
scope: &Rc<RefCell<Scope>>,
this: &Value,
) -> Result<Value, Value>
pub(crate) fn eval_source_in( &mut self, source: &str, scope: &Rc<RefCell<Scope>>, this: &Value, ) -> Result<Value, Value>
直接 eval(eval(code) の形の呼び出し)の実体。呼び出し元のスコープ(scope)と this で実行する。
Sourcefn exec_eval_statements(
&mut self,
stmts: &[Statement],
eval_scope: &Rc<RefCell<Scope>>,
this: &Value,
eval_strict: bool,
) -> Result<Completion, Value>
fn exec_eval_statements( &mut self, stmts: &[Statement], eval_scope: &Rc<RefCell<Scope>>, this: &Value, eval_strict: bool, ) -> Result<Completion, Value>
eval(直接・間接)の本体の宣言インスタンス化(ECMA-262 §19.2.1.3 / Annex B.3.3.3)と実行。
Sourcepub(crate) fn exec_top_statements(
&mut self,
stmts: &[Statement],
scope: &Rc<RefCell<Scope>>,
this: &Value,
) -> Result<Completion, Value>
pub(crate) fn exec_top_statements( &mut self, stmts: &[Statement], scope: &Rc<RefCell<Scope>>, this: &Value, ) -> Result<Completion, Value>
スクリプトまたは eval の最上位文リストを実行する。
最上位の function 宣言のみ CreateGlobalFunctionBinding を適用し、
内側のブロック・switch・try 内の関数宣言(Annex B.3.3.3)と区別する。
Sourcepub(crate) fn exec_top_statements_strict(
&mut self,
stmts: &[Statement],
scope: &Rc<RefCell<Scope>>,
this: &Value,
inherit_strict: bool,
) -> Result<Completion, Value>
pub(crate) fn exec_top_statements_strict( &mut self, stmts: &[Statement], scope: &Rc<RefCell<Scope>>, this: &Value, inherit_strict: bool, ) -> Result<Completion, Value>
inherit_strict は直接 eval 用(呼び出し元が strict なら eval のコードも strict)。
pub(crate) fn exec_statements( &mut self, stmts: &[Statement], scope: &Rc<RefCell<Scope>>, this: &Value, ) -> Result<Completion, Value>
Sourcepub(crate) fn exec_statements_hoisted(
&mut self,
stmts: &[Statement],
scope: &Rc<RefCell<Scope>>,
this: &Value,
hoisted: Option<&[Rc<str>]>,
) -> Result<Completion, Value>
pub(crate) fn exec_statements_hoisted( &mut self, stmts: &[Statement], scope: &Rc<RefCell<Scope>>, this: &Value, hoisted: Option<&[Rc<str>]>, ) -> Result<Completion, Value>
exec_statements の、var 巻き上げの名前を呼び出し側が渡せる版(関数本体で保存済みの名前)。
Sourcepub(crate) fn exec_statements_prehoisted(
&mut self,
stmts: &[Statement],
scope: &Rc<RefCell<Scope>>,
this: &Value,
) -> Result<Completion, Value>
pub(crate) fn exec_statements_prehoisted( &mut self, stmts: &[Statement], scope: &Rc<RefCell<Scope>>, this: &Value, ) -> Result<Completion, Value>
巻き上げ完了済みの文列を実行する。
Sourcefn hoist_global_declarations_impl(
&mut self,
stmts: &[Statement],
scope: &Rc<RefCell<Scope>>,
this: &Value,
hoisted: Option<&[Rc<str>]>,
is_eval: bool,
) -> Result<(), Value>
fn hoist_global_declarations_impl( &mut self, stmts: &[Statement], scope: &Rc<RefCell<Scope>>, this: &Value, hoisted: Option<&[Rc<str>]>, is_eval: bool, ) -> Result<(), Value>
ECMA-262 §16.1.7 GlobalDeclarationInstantiation 相当:
トップレベルの var と function 宣言を検証・巻き上げし、globalThis の自前プロパティと同期する。
Sourcefn hoist_top_global_function_decls(
&mut self,
stmts: &[Statement],
scope: &Rc<RefCell<Scope>>,
this: &Value,
is_eval: bool,
)
fn hoist_top_global_function_decls( &mut self, stmts: &[Statement], scope: &Rc<RefCell<Scope>>, this: &Value, is_eval: bool, )
スクリプト・eval 最上位の関数宣言を CreateGlobalFunctionBinding で巻き上げる。
Sourcepub(crate) fn hoist_declarations(
&mut self,
stmts: &[Statement],
scope: &Rc<RefCell<Scope>>,
this: &Value,
hoisted: Option<&[Rc<str>]>,
)
pub(crate) fn hoist_declarations( &mut self, stmts: &[Statement], scope: &Rc<RefCell<Scope>>, this: &Value, hoisted: Option<&[Rc<str>]>, )
【2026-10-28 スタックフレーム縮小】var と関数宣言の巻き上げを exec_statements_hoisted から分離。
exec_statements_hoisted は全関数呼び出し・ブロック実行のコールスタックに乗るため、
巻き上げ用の一時変数(collected: Vec<Rc<str>> 等)をこのフレームに残さない。
Sourcepub(crate) fn hoist_function_decls(
&mut self,
stmts: &[Statement],
scope: &Rc<RefCell<Scope>>,
this: &Value,
)
pub(crate) fn hoist_function_decls( &mut self, stmts: &[Statement], scope: &Rc<RefCell<Scope>>, this: &Value, )
ブロック/関数本体のトップレベルにある関数宣言を現在のスコープへ巻き上げる。
Sourcefn sync_global_var_binding(&self, name: &Rc<str>)
fn sync_global_var_binding(&self, name: &Rc<str>)
exec_var_decl / exec_for_in で更新されたグローバル var を globalThis.props へ同期する。
fn exec_using_decl( &mut self, decls: &[(Pattern, Option<Expression>)], is_await: bool, scope: &Rc<RefCell<Scope>>, this: &Value, disposables: &mut Vec<(Value, bool)>, ) -> Result<(), Value>
fn finish_disposables( &mut self, disposables: Vec<(Value, bool)>, outcome: Result<Completion, Value>, last: Value, ) -> Result<Completion, Value>
pub(crate) fn exec_stmt( &mut self, stmt: &Statement, scope: &Rc<RefCell<Scope>>, this: &Value, ) -> Result<Completion, Value>
Sourcefn eval_gen_cached(
&mut self,
expr: &Expression,
scope: &Rc<RefCell<Scope>>,
this: &Value,
) -> Result<Value, Value>
fn eval_gen_cached( &mut self, expr: &Expression, scope: &Rc<RefCell<Scope>>, this: &Value, ) -> Result<Value, Value>
ジェネレータリプレイ中のみ、完了済み式(ループの test / update 等)を
done_stmts に記録・再生して再評価による副作用の二重適用を防ぐ。
fn exec_stmt_inner( &mut self, stmt: &Statement, scope: &Rc<RefCell<Scope>>, this: &Value, ) -> Result<Completion, Value>
Sourcepub(crate) fn define_public_field(
&mut self,
target: &Value,
key: &str,
val: Value,
) -> Result<(), Value>
pub(crate) fn define_public_field( &mut self, target: &Value, key: &str, val: Value, ) -> Result<(), Value>
パブリッククラスフィールドの定義(CreateDataPropertyOrThrow)。素のオブジェクトへは直接書く。
fn exec_var_decl( &mut self, kind: &VarKind, decls: &[(Pattern, Option<Expression>)], scope: &Rc<RefCell<Scope>>, this: &Value, ) -> Result<Completion, Value>
fn exec_block( &mut self, body: &[Statement], scope: &Rc<RefCell<Scope>>, this: &Value, ) -> Result<Completion, Value>
fn exec_while( &mut self, test: &Expression, body: &Statement, scope: &Rc<RefCell<Scope>>, this: &Value, ) -> Result<Completion, Value>
fn exec_do_while( &mut self, body: &Statement, test: &Expression, scope: &Rc<RefCell<Scope>>, this: &Value, ) -> Result<Completion, Value>
fn exec_labeled( &mut self, label: &Rc<str>, inner: &Statement, scope: &Rc<RefCell<Scope>>, this: &Value, ) -> Result<Completion, Value>
fn exec_for( &mut self, init: Option<&Statement>, test: Option<&Expression>, update: Option<&Expression>, body: &Statement, scope: &Rc<RefCell<Scope>>, this: &Value, ) -> Result<Completion, Value>
fn exec_for_in( &mut self, decl_kind: &Option<VarKind>, pattern: &Pattern, object: &Expression, body: &Statement, of: bool, is_await: bool, scope: &Rc<RefCell<Scope>>, this: &Value, ) -> Result<Completion, Value>
Sourcefn for_of_lazy(
&mut self,
iterator: &Value,
next_fn: &Value,
decl_kind: &Option<VarKind>,
pattern: &Pattern,
body: &Statement,
is_let_like: bool,
own_label: Option<Rc<str>>,
scope: &Rc<RefCell<Scope>>,
this: &Value,
) -> Result<Completion, Value>
fn for_of_lazy( &mut self, iterator: &Value, next_fn: &Value, decl_kind: &Option<VarKind>, pattern: &Pattern, body: &Statement, is_let_like: bool, own_label: Option<Rc<str>>, scope: &Rc<RefCell<Scope>>, this: &Value, ) -> Result<Completion, Value>
for-of の遅延反復(利用者定義の反復子)。next() を 1 回ずつ呼び、抜けるときは IteratorClose。
fn exec_switch( &mut self, discriminant: &Expression, cases: &[SwitchCase], scope: &Rc<RefCell<Scope>>, this: &Value, ) -> Result<Completion, Value>
fn exec_try( &mut self, t: &TryStmt, scope: &Rc<RefCell<Scope>>, this: &Value, ) -> Result<Completion, Value>
fn exec_module_stmt( &mut self, stmt: &Statement, scope: &Rc<RefCell<Scope>>, this: &Value, ) -> Result<Completion, Value>
Sourcepub(crate) fn record_export(
&mut self,
scope: &Rc<RefCell<Scope>>,
name: &str,
val: Value,
)
pub(crate) fn record_export( &mut self, scope: &Rc<RefCell<Scope>>, name: &str, val: Value, )
現在評価中モジュールの export マップにエントリを記録する。 モジュール文脈でない(通常スクリプト)の場合は無視する。
Sourcefn module_body(&self, specifier: &str) -> Option<Vec<Statement>>
fn module_body(&self, specifier: &str) -> Option<Vec<Statement>>
登録済みモジュールの文の列(無ければ None。構文の誤りがあっても木は返す)。
Sourcefn resolve_export(
&self,
specifier: &str,
name: &str,
visited: &mut Vec<(String, String)>,
) -> Result<Option<(String, String)>, ()>
fn resolve_export( &self, specifier: &str, name: &str, visited: &mut Vec<(String, String)>, ) -> Result<Option<(String, String)>, ()>
ResolveExport(§16.2.1.6.3)の簡略版。見つかれば Ok(Some((最終のモジュール, 束縛名)))、
無ければ Ok(None)、曖昧なら Err(())。未登録のモジュールは「見つかった」とみなす(寛容)。
Sourcefn link_check(
&mut self,
specifier: &str,
seen: &mut Vec<String>,
) -> Result<(), Value>
fn link_check( &mut self, specifier: &str, seen: &mut Vec<String>, ) -> Result<(), Value>
連結の誤り(§16.2.1.5.3 InnerModuleLinking): 再エクスポートが解決できない・曖昧、 取り込む名前が公開されていない、は SyntaxError。依存するモジュールも辿る。
Sourcepub(crate) fn module_namespace(
&mut self,
specifier: &str,
) -> Result<Value, Value>
pub(crate) fn module_namespace( &mut self, specifier: &str, ) -> Result<Value, Value>
評価済みモジュールの名前空間オブジェクト(モジュールごとに 1 つ。以後は同じ物を返す)。
Source§impl Interp
impl Interp
Sourcepub(crate) fn is_lazy_iter_candidate(&self, obj: &Value) -> bool
pub(crate) fn is_lazy_iter_candidate(&self, obj: &Value) -> bool
遅延反復(と IteratorClose)の対象か。利用者定義の Symbol.iterator を持つ素のオブジェクト、
および配列の反復子(Array.prototype[Symbol.iterator] か自前の Symbol.iterator)が差し替えられた配列。
素の配列は従来の一括の高速な経路のまま。
Sourcepub(crate) fn open_lazy_iterator(
&mut self,
obj: &Value,
) -> Result<Option<(Value, Value)>, Value>
pub(crate) fn open_lazy_iterator( &mut self, obj: &Value, ) -> Result<Option<(Value, Value)>, Value>
利用者定義の反復子や配列/TypedArray の Symbol.iterator を遅延反復する準備。
Generator は 1 要素ずつ next() で遅延駆動し、break/return/throw で return() により閉じる。
Set/Map/ホスト物などは従来の一括の経路(None)。
Sourcepub(crate) fn iterator_close(&mut self, iterator: &Value) -> Result<(), Value>
pub(crate) fn iterator_close(&mut self, iterator: &Value) -> Result<(), Value>
IteratorClose(§7.4.11)。return が無ければ何もしない。結果がオブジェクトでなければ TypeError。
例外で抜ける途中の呼び出しは、呼び出し側が結果を捨てる(元の例外を優先)。
Sourcepub(crate) fn iterate_values(
&mut self,
obj: &Value,
of: bool,
) -> Result<Vec<Value>, Value>
pub(crate) fn iterate_values( &mut self, obj: &Value, of: bool, ) -> Result<Vec<Value>, Value>
for-in / for-of の列挙対象を Value のリストへ。
generator は遅延駆動するため &mut self が必要。
Sourcepub(crate) fn iterate_values_deferred(
&mut self,
obj: &Value,
of: bool,
deferred: &mut Option<Value>,
) -> Result<Vec<Value>, Value>
pub(crate) fn iterate_values_deferred( &mut self, obj: &Value, of: bool, deferred: &mut Option<Value>, ) -> Result<Vec<Value>, Value>
iterate_values。ただし for-of 用に、反復の途中(next()・done・value・ジェネレータ本体)で投げた例外は
すぐ返さず deferred に入れ、それまでに取れた要素を返す(仕様では、本体が先の要素を処理した後で例外になる)。
呼び出し側は要素を回し終えた(break・return でない)後で deferred を投げる。
pub(crate) fn is_gen_executing(&self, state: &Rc<RefCell<GenState>>) -> bool
fn gen_ctx_obj(scope: &Rc<RefCell<Scope>>) -> Option<ObjRef>
pub(crate) fn gen_is_async(&self, scope: &Rc<RefCell<Scope>>) -> bool
fn gen_cache_peek(&self, scope: &Rc<RefCell<Scope>>) -> Option<Value>
fn gen_cache_push(&self, scope: &Rc<RefCell<Scope>>, entry: Value)
pub(crate) fn gen_await_cached( &mut self, scope: &Rc<RefCell<Scope>>, v: Value, ) -> Result<Value, Value>
Sourcepub(crate) fn is_suspending(&self) -> bool
pub(crate) fn is_suspending(&self) -> bool
現在 generator 本体の中断処理中か(suspend 番兵 Err を try/catch が 捕捉しないようにするためのガード)。
Sourcepub(crate) fn is_gen_returning(&self) -> bool
pub(crate) fn is_gen_returning(&self) -> bool
現在 generator が強制Returnによる巻き戻し中か。
Sourcepub(crate) fn do_yield(&mut self, value: Value) -> Result<Value, Value>
pub(crate) fn do_yield(&mut self, value: Value) -> Result<Value, Value>
yield value の評価。replay 中でなければ無効(undefined)。
target 番目の yield に達したら中断(suspend 番兵 Err を返す)。
既に通過済みの yield には保存済み resume 値を返して続行する。
Sourcefn do_yield_delegate(&mut self, value: Value) -> Result<GenCompletion, Value>
fn do_yield_delegate(&mut self, value: Value) -> Result<GenCompletion, Value>
yield* 委譲用の yield: 通過済みの場合は GenCompletion(Normal/Throw/Return)をそのまま返す。
fn do_gen_return(&mut self, val: Value) -> Result<Value, Value>
pub(crate) fn async_iterator_close( &mut self, iterator: &Value, ) -> Result<(), Value>
pub(crate) fn get_iter_method_for_val( &mut self, v: &Value, sym_key: &str, ) -> Result<Value, Value>
pub(crate) fn yield_star_get_iterator( &mut self, v: &Value, is_async: bool, ) -> Result<(Value, Value, bool), Value>
pub(crate) fn yield_star_step( &mut self, iterator: &Value, next_fn: &Value, is_async: bool, is_async_from_sync: bool, received: GenCompletion, ) -> (u8, Value)
pub(crate) fn eval_yield_delegate( &mut self, argument: Option<&Expression>, scope: &Rc<RefCell<Scope>>, this: &Value, ) -> Result<Value, Value>
Sourcepub fn generator_resume(
&mut self,
state: &Rc<RefCell<GenState>>,
sent: Value,
) -> Result<(Value, bool), Value>
pub fn generator_resume( &mut self, state: &Rc<RefCell<GenState>>, sent: Value, ) -> Result<(Value, bool), Value>
Generator を 1 ステップ進める(.next(sent) 相当)。
戻り値は (value, done)。replay 方式で本体を先頭から再実行し、
次の yield まで進めて中断するか、本体完了で done:true を返す。
Sourcepub fn generator_throw(
&mut self,
state: &Rc<RefCell<GenState>>,
err: Value,
) -> Result<(Value, bool), Value>
pub fn generator_throw( &mut self, state: &Rc<RefCell<GenState>>, err: Value, ) -> Result<(Value, bool), Value>
.throw(err) 相当: 現在中断中の yield 式の位置で err を投げて generator を
再開する(generator 本体の try/catch で捕捉されなければ、そのまま呼び出し元へ
伝播する)。
Sourcepub fn generator_return(
&mut self,
state: &Rc<RefCell<GenState>>,
val: Value,
) -> Result<(Value, bool), Value>
pub fn generator_return( &mut self, state: &Rc<RefCell<GenState>>, val: Value, ) -> Result<(Value, bool), Value>
.return(val) 相当: 現在中断中の yield 式の位置で return を発生させ、
try…finally ブロック等を実行して generator を再開・完了させる。
pub(crate) fn generator_resume_inner( &mut self, state: &Rc<RefCell<GenState>>, sent: GenCompletion, ) -> Result<(Value, bool), Value>
fn clear_gen_ctx(state: &Rc<RefCell<GenState>>)
fn generator_resume_body( &mut self, state: &Rc<RefCell<GenState>>, sent: GenCompletion, ) -> Result<(Value, bool), Value>
Sourcepub(crate) fn iter_step_once(
&mut self,
next_fn: &Value,
iterator: &Value,
) -> Result<Option<Value>, Value>
pub(crate) fn iter_step_once( &mut self, next_fn: &Value, iterator: &Value, ) -> Result<Option<Value>, Value>
イテレータを 1 つ進める(IteratorStepValue)。None は完了。
Sourcepub(crate) fn drain_generator_deferred(
&mut self,
gen: &ObjRef,
deferred: &mut Option<Value>,
) -> Vec<Value>
pub(crate) fn drain_generator_deferred( &mut self, gen: &ObjRef, deferred: &mut Option<Value>, ) -> Vec<Value>
drain_generator の for-of 版(途中の例外は deferred へ)。
Sourcepub(crate) fn require_iterable(&self, v: &Value) -> Result<(), Value>
pub(crate) fn require_iterable(&self, v: &Value) -> Result<(), Value>
反復できない値(undefined・null・数値・真偽値・BigInt)なら TypeError([...1]・f(...null)・
var [a] = 1)。【2026-11-16】以前は空として扱い、例外にならなかった。
Sourcepub(crate) fn spread_values(&mut self, v: &Value) -> Result<Vec<Value>, Value>
pub(crate) fn spread_values(&mut self, v: &Value) -> Result<Vec<Value>, Value>
スプレッド([...x]・f(...x))の要素。反復できない値は TypeError。
Source§impl Interp
impl Interp
Sourcepub(crate) fn gen_vm_resume(
&mut self,
state: &Rc<RefCell<GenState>>,
sent: GenCompletion,
) -> Result<Result<(Value, bool), Value>, GenCompletion>
pub(crate) fn gen_vm_resume( &mut self, state: &Rc<RefCell<GenState>>, sent: GenCompletion, ) -> Result<Result<(Value, bool), Value>, GenCompletion>
generator を VM で 1 段進める。VM で扱えない本体なら Err(sent) を返す(呼び出し側が replay で実行する)。
fn gen_vm_run(&mut self, f: &mut GenFrame, start: Option<Compl>) -> RunEnd
fn gen_truncate_scopes(&mut self, f: &mut GenFrame, n: usize)
Sourcefn gen_unwind(
&mut self,
f: &mut GenFrame,
code: &GenCode,
c: Compl,
) -> Option<RunEnd>
fn gen_unwind( &mut self, f: &mut GenFrame, code: &GenCode, c: Compl, ) -> Option<RunEnd>
通常でない完了でハンドラを外側へたどる。続けて実行するなら None(f.pc を設定済み)。
Sourcefn gen_drop_iter(&mut self, f: &mut GenFrame) -> Option<IterRec>
fn gen_drop_iter(&mut self, f: &mut GenFrame) -> Option<IterRec>
反復の表を外す(next() の例外など、IteratorClose を呼ばずに抜けるとき)。
fn gen_step(&mut self, f: &mut GenFrame, op: &GOp) -> Result<Flow, Value>
fn gen_iter_open(&mut self, obj: &Value, kind: u8) -> Result<IterRec, Value>
Source§impl Interp
impl Interp
pub fn eval( &mut self, expr: &Expression, scope: &Rc<RefCell<Scope>>, this: &Value, ) -> Result<Value, Value>
Sourcepub(crate) fn resolve_this(
&self,
scope: &Rc<RefCell<Scope>>,
fallback: &Value,
) -> Result<Value, Value>
pub(crate) fn resolve_this( &self, scope: &Rc<RefCell<Scope>>, fallback: &Value, ) -> Result<Value, Value>
変数を読む。スコープに無ければ window のプロパティを見る。
【2026-09-05】ブラウザでは window.x = 1 の後に素の x で読める(グローバルオブジェクトの
プロパティ=グローバル変数)。この処理系は window を普通のオブジェクトとして持ち、グローバル変数とは
別管理なので、window.$ = ... が素の $ から見えなかった(jQuery 1.8.2 が
$ is not defined になっていた)。【2026-10-22 高速化】self.global から直接 O(1)。
pub(crate) fn load_identifier( &mut self, name: &Rc<str>, scope: &Rc<RefCell<Scope>>, ) -> Result<Value, Value>
pub(crate) fn load_identifier_no_with( &mut self, name: &Rc<str>, scope: &Rc<RefCell<Scope>>, ) -> Result<Value, Value>
fn eval_binary_expr( &mut self, op: &BinaryOp, left: &Expression, right: &Expression, scope: &Rc<RefCell<Scope>>, this: &Value, ) -> Result<Value, Value>
fn eval_member( &mut self, object: &Expression, property: &Rc<str>, optional: bool, scope: &Rc<RefCell<Scope>>, this: &Value, ) -> Result<Value, Value>
fn eval_index( &mut self, object: &Expression, index: &Expression, optional: bool, scope: &Rc<RefCell<Scope>>, this: &Value, ) -> Result<Value, Value>
fn eval_template_lit( &mut self, quasis: &[String], exprs: &[Expression], scope: &Rc<RefCell<Scope>>, this: &Value, ) -> Result<Value, Value>
fn eval_tagged_template( &mut self, tag: &Expression, quasis: &[String], raw: &[String], exprs: &[Expression], scope: &Rc<RefCell<Scope>>, this: &Value, ) -> Result<Value, Value>
fn eval_array_lit( &mut self, items: &[Expression], scope: &Rc<RefCell<Scope>>, this: &Value, ) -> Result<Value, Value>
fn eval_object_lit( &mut self, props: &[Property], scope: &Rc<RefCell<Scope>>, this: &Value, ) -> Result<Value, Value>
Sourcepub(crate) fn object_spread_copy(
&mut self,
o: &ObjRef,
src: &Value,
) -> Result<(), Value>
pub(crate) fn object_spread_copy( &mut self, o: &ObjRef, src: &Value, ) -> Result<(), Value>
オブジェクトリテラルの ...src(CopyDataProperties)。generator の VM と共用(2026-11-30 に切り出した)。
Sourcepub(crate) fn object_lit_func_prop(
&mut self,
o: &ObjRef,
p: &Property,
key: PropKey,
scope: &Rc<RefCell<Scope>>,
this: &Value,
home_scope: &mut Option<Rc<RefCell<Scope>>>,
) -> Result<(), Value>
pub(crate) fn object_lit_func_prop( &mut self, o: &ObjRef, p: &Property, key: PropKey, scope: &Rc<RefCell<Scope>>, this: &Value, home_scope: &mut Option<Rc<RefCell<Scope>>>, ) -> Result<(), Value>
オブジェクトリテラルの、値が関数の定義(メソッド・アクセサ・関数式)のプロパティ。
[[HomeObject]] のスコープ(__home__)で評価する。generator の VM と共用。
pub(crate) fn eval_regex_lit( &self, lit: &(String, String), ) -> Result<Value, Value>
Sourcefn expr_contains_yield_or_await(expr: &Expression) -> bool
fn expr_contains_yield_or_await(expr: &Expression) -> bool
リプレイで既通過の yield 引数を再評価してよいか判定するため、内側の関数境界を越えずに
yield / await の有無を調べる。
fn eval_yield( &mut self, argument: Option<&Expression>, delegate: bool, scope: &Rc<RefCell<Scope>>, this: &Value, ) -> Result<Value, Value>
pub(crate) fn eval_function_expr( &self, name: &Option<Rc<str>>, params: &Rc<Vec<Param>>, body: &Rc<FnBody>, is_arrow: bool, is_async: bool, is_generator: bool, scope: &Rc<RefCell<Scope>>, this: &Value, ) -> Result<Value, Value>
pub(crate) fn make_function( &self, name: Option<String>, params: Rc<Vec<Param>>, body: Rc<FnBody>, is_arrow: bool, is_async: bool, is_generator: bool, scope: &Rc<RefCell<Scope>>, this: &Value, ) -> Value
Sourcepub(crate) fn bind_pattern(
&mut self,
pat: &Pattern,
value: Value,
scope: &Rc<RefCell<Scope>>,
this: &Value,
) -> Result<(), Value>
pub(crate) fn bind_pattern( &mut self, pat: &Pattern, value: Value, scope: &Rc<RefCell<Scope>>, this: &Value, ) -> Result<(), Value>
分割代入パターンへ値を束縛する(var 宣言・引数・for-of 共通)。
fn bind_array_pattern( &mut self, elems: &[ArrPatElem], value: &Value, scope: &Rc<RefCell<Scope>>, this: &Value, ) -> Result<(), Value>
Sourcefn bind_array_pattern_lazy(
&mut self,
elems: &[ArrPatElem],
iterator: &Value,
next_fn: &Value,
scope: &Rc<RefCell<Scope>>,
this: &Value,
) -> Result<(), Value>
fn bind_array_pattern_lazy( &mut self, elems: &[ArrPatElem], iterator: &Value, next_fn: &Value, scope: &Rc<RefCell<Scope>>, this: &Value, ) -> Result<(), Value>
配列の分割代入(利用者定義の反復子)。next() の例外は閉じずに、束縛・既定値の例外は IteratorClose してから伝える。
Sourcefn lookup_private_desc(
&self,
scope: &Rc<RefCell<Scope>>,
name: &str,
) -> Result<PrivateDescriptor, Value>
fn lookup_private_desc( &self, scope: &Rc<RefCell<Scope>>, name: &str, ) -> Result<PrivateDescriptor, Value>
クラス内のプライベート要素記述子(__priv_#name)をスコープ連鎖から引く。
Sourcepub(crate) fn private_get(
&mut self,
obj: &Value,
name: &str,
scope: &Rc<RefCell<Scope>>,
) -> Result<Value, Value>
pub(crate) fn private_get( &mut self, obj: &Value, name: &str, scope: &Rc<RefCell<Scope>>, ) -> Result<Value, Value>
obj.#name の読み出し(フィールド/メソッド/getter、ブランド検査付き)。
Sourcepub(crate) fn private_set(
&mut self,
obj: &Value,
name: &str,
val: Value,
scope: &Rc<RefCell<Scope>>,
) -> Result<(), Value>
pub(crate) fn private_set( &mut self, obj: &Value, name: &str, val: Value, scope: &Rc<RefCell<Scope>>, ) -> Result<(), Value>
obj.#name = val の書き込み(フィールド/メソッド書込禁止/setter、ブランド検査付き)。
Sourcepub(crate) fn private_in(
&mut self,
obj: &Value,
name: &str,
scope: &Rc<RefCell<Scope>>,
) -> Result<Value, Value>
pub(crate) fn private_in( &mut self, obj: &Value, name: &str, scope: &Rc<RefCell<Scope>>, ) -> Result<Value, Value>
#name in obj のブランド/スロット存在検査。
Sourcepub(crate) fn eval_class(
&mut self,
name: &Option<String>,
superclass: &Option<Box<Expression>>,
members: &[ClassMember],
scope: &Rc<RefCell<Scope>>,
this: &Value,
) -> Result<Value, Value>
pub(crate) fn eval_class( &mut self, name: &Option<String>, superclass: &Option<Box<Expression>>, members: &[ClassMember], scope: &Rc<RefCell<Scope>>, this: &Value, ) -> Result<Value, Value>
class を評価し、コンストラクタ関数(prototype・静的メンバ・super 連携付き)を返す。
Sourcepub(crate) fn super_ctor(
&mut self,
scope: &Rc<RefCell<Scope>>,
) -> Result<Value, Value>
pub(crate) fn super_ctor( &mut self, scope: &Rc<RefCell<Scope>>, ) -> Result<Value, Value>
現在のスコープから基底クラスのコンストラクタを取得。
Sourcepub(crate) fn super_proto(
&mut self,
scope: &Rc<RefCell<Scope>>,
) -> Result<Value, Value>
pub(crate) fn super_proto( &mut self, scope: &Rc<RefCell<Scope>>, ) -> Result<Value, Value>
super.x の探索の起点(ECMA-262 §13.3.7.3 MakeSuperPropertyReference:
baseValue = env.GetSuperBase() = HomeObject.[GetPrototypeOf])。
【2026-11-19】以前は「基底クラスの prototype」固定で、static メソッドや
オブジェクトリテラルのメソッド({ __proto__: p, f() { super.x } })で使えなかった。
Sourcepub(crate) fn super_get(
&mut self,
scope: &Rc<RefCell<Scope>>,
key: &str,
this: &Value,
) -> Result<Value, Value>
pub(crate) fn super_get( &mut self, scope: &Rc<RefCell<Scope>>, key: &str, this: &Value, ) -> Result<Value, Value>
super[key] / super.key の読み出し(§6.2.5.5 GetValue: 参照の thisValue = 現在の this)。
起点から原型の連鎖をたどり、アクセサ(getter)が先に見つかれば this を受け手にして呼ぶ。
【2026-11-19】以前は起点オブジェクトを受け手にしていて、getter の this が起点になっていた。
Source§impl Interp
impl Interp
Sourcepub fn promise_resolve(
&mut self,
state: &Rc<RefCell<PromiseState>>,
value: Value,
)
pub fn promise_resolve( &mut self, state: &Rc<RefCell<PromiseState>>, value: Value, )
Promise を解決する。値が Promise/thenable なら採用(チェーン)する。
Sourcepub fn promise_reject(
&mut self,
state: &Rc<RefCell<PromiseState>>,
reason: Value,
)
pub fn promise_reject( &mut self, state: &Rc<RefCell<PromiseState>>, reason: Value, )
Promise を拒否する。
Sourcepub fn promise_then(
&mut self,
state: &Rc<RefCell<PromiseState>>,
on_fulfilled: Option<Value>,
on_rejected: Option<Value>,
) -> Value
pub fn promise_then( &mut self, state: &Rc<RefCell<PromiseState>>, on_fulfilled: Option<Value>, on_rejected: Option<Value>, ) -> Value
then 反応を登録し、派生 Promise を返す。
pub(crate) fn schedule_reaction( &self, reaction: &Reaction, value: Value, is_fulfill: bool, )
Sourcepub(crate) fn run_one_microtask(&mut self) -> bool
pub(crate) fn run_one_microtask(&mut self) -> bool
マイクロタスクを 1 つ実行。実行したら true。
Sourcepub fn run_microtasks(&mut self)
pub fn run_microtasks(&mut self)
保留中のマイクロタスクを全て消化する。
microtask_step_cap を超えたら次のジョブの前で戻る。残りは has_due_timers が検知して
次のフレームの pump_timers で続く(実行中のジョブは打ち切らない)。
Sourcepub(crate) fn timer_now(&self) -> u64
pub(crate) fn timer_now(&self) -> u64
setTimeout コールバック(マクロタスク)を 1 つ実行。実行したら true。 タイマー用の現在時刻(ミリ秒。実時刻 + 試験用の早送り分)。
Sourcepub(crate) fn run_timer(&mut self, force: bool) -> bool
pub(crate) fn run_timer(&mut self, force: bool) -> bool
タイマーを 1 つ実行する。force なら期限前でも最も早いものを実行する(同期 await の進行用)。
期限の早い順、同じなら登録順。setInterval は呼ぶ前に次の予定を積み直す(コールバック内の
clearInterval で消せるように)。実行したら true。
Sourcepub(crate) fn run_one_macrotask(&mut self) -> bool
pub(crate) fn run_one_macrotask(&mut self) -> bool
互換: 期限の来たタイマーを 1 つ実行する。
Sourcepub fn has_due_timer(&self) -> bool
pub fn has_due_timer(&self) -> bool
期限の来たタイマーがあるか。
Sourcefn await_network_step(&mut self, wait_start: &mut Option<u64>) -> bool
fn await_network_step(&mut self, wait_start: &mut Option<u64>) -> bool
同期 await の中で、非同期の通信(XHR)が走っている間の 1 歩。進めたら true。
【2026-11-04】従来は通信の結果を受け取らないまま期限前のタイマーを早送りしていたので、
「応答」と「時間切れのタイマー」の Promise.race を await すると、応答が先に届いていても必ず
時間切れが勝った(YouTube の next/player が net.timeout で失敗した。race を直して表に出た)。
届いた結果を先に配り、次に期限の来たタイマーだけを実行し、どちらも無ければ実時間で少し待つ。
待つのは最大 AWAIT_NET_WAIT_MS まで(過ぎたら従来どおり早送りへ戻る)。
Sourcepub fn run_event_loop_for(&mut self, budget_ms: u64)
pub fn run_event_loop_for(&mut self, budget_ms: u64)
イベントループ: マイクロタスクを消化 → 期限の来たタイマー 1 つ → 繰り返す。
budget_ms を使い切るか期限の来たタイマーが無くなれば戻る(残りは次の呼び出しで)。
Sourcepub fn run_event_loop(&mut self)
pub fn run_event_loop(&mut self)
スクリプト評価直後のイベントループ(期限の来たタイマーを最大 300ms 分)。
Sourcepub(crate) fn chain_suppressed(
&mut self,
prev: Option<Value>,
new_err: Value,
) -> Value
pub(crate) fn chain_suppressed( &mut self, prev: Option<Value>, new_err: Value, ) -> Value
await: 値が Promise ならマイクロタスクを駆動して解決まで進め、値を返す(reject は throw)。
using の複数 dispose が例外を投げた場合に、新しい例外(new_err)と既存の
保留中の例外(prev)を SuppressedError へ集約する。prev が無ければ new_err を
そのまま返す(グローバルに SuppressedError が無い異常系でも new_err へ安全にフォールバック)。
pub(crate) fn await_value(&mut self, v: Value) -> Result<Value, Value>
Source§impl Interp
impl Interp
pub(crate) fn eval_unary( &mut self, op: &UnaryOp, expr: &Expression, scope: &Rc<RefCell<Scope>>, this: &Value, ) -> Result<Value, Value>
Sourcepub(crate) fn unary_on_value(
&mut self,
op: &UnaryOp,
v: Value,
) -> Result<Value, Value>
pub(crate) fn unary_on_value( &mut self, op: &UnaryOp, v: Value, ) -> Result<Value, Value>
評価済みの値に単項演算子(delete 以外)を適用する(generator の VM と共用。2026-11-30)。
Sourcepub(crate) fn eval_delete(
&mut self,
expr: &Expression,
scope: &Rc<RefCell<Scope>>,
this: &Value,
) -> Result<Value, Value>
pub(crate) fn eval_delete( &mut self, expr: &Expression, scope: &Rc<RefCell<Scope>>, this: &Value, ) -> Result<Value, Value>
delete expr の実装。expr がプロパティアクセス(obj.x/obj[x])なら
実際にプロパティを取り除いて true を返す。それ以外(変数・リテラル等)は
仕様上ほぼ no-op のため副作用なく true を返す(configurable:false 相当の
「削除できず false」ケースはこの処理系にはプロパティ属性の概念が無いため非対応)。
Sourcepub(crate) fn delete_checked(&self, r: Value, key: &str) -> Result<Value, Value>
pub(crate) fn delete_checked(&self, r: Value, key: &str) -> Result<Value, Value>
strict のコードの delete は、削除できなかった([[Delete]] が false)ときに TypeError(§13.5.1.2)。
Sourcepub(crate) fn delete_property(
&mut self,
obj: &Value,
property: &str,
) -> Result<Value, Value>
pub(crate) fn delete_property( &mut self, obj: &Value, property: &str, ) -> Result<Value, Value>
delete obj.prop/delete obj[key] の共通実装(Member/Index 両方から使う)。
以前は Member 経由でしか dataset/style/storage Host プロキシの特別扱いが
効かず、delete element.style['color'] のような Index 経由の等価な書き方だと
何も削除されないバグがあった。
pub(crate) fn eval_update( &mut self, op: &str, prefix: bool, target: &Expression, scope: &Rc<RefCell<Scope>>, this: &Value, ) -> Result<Value, Value>
pub(crate) fn eval_assign( &mut self, op: &str, target: &Expression, value: &Expression, scope: &Rc<RefCell<Scope>>, this: &Value, ) -> Result<Value, Value>
Sourcefn delete_identifier(
&mut self,
name: &Rc<str>,
scope: &Rc<RefCell<Scope>>,
) -> bool
fn delete_identifier( &mut self, name: &Rc<str>, scope: &Rc<RefCell<Scope>>, ) -> bool
delete name。消せるのは代入だけで作られたグローバル変数と window のプロパティ。
宣言された変数は消えず false。
Sourcefn assign_ident_no_with(
&mut self,
name: &Rc<str>,
val: Value,
scope: &Rc<RefCell<Scope>>,
) -> Result<(), Value>
fn assign_ident_no_with( &mut self, name: &Rc<str>, val: Value, scope: &Rc<RefCell<Scope>>, ) -> Result<(), Value>
事前に with 解決済みの識別子に対して宣言的環境またはグローバルへ代入する。
Sourcepub(crate) fn assign_to(
&mut self,
target: &Expression,
val: Value,
scope: &Rc<RefCell<Scope>>,
this: &Value,
) -> Result<(), Value>
pub(crate) fn assign_to( &mut self, target: &Expression, val: Value, scope: &Rc<RefCell<Scope>>, this: &Value, ) -> Result<(), Value>
代入先(識別子・メンバ・添字)へ値を書き込む。
Sourcepub(crate) fn set_on_nullish_error(&self, obj: &Value, key: &str) -> Value
pub(crate) fn set_on_nullish_error(&self, obj: &Value, key: &str) -> Value
undefined.x = 1 などの TypeError(V8 と同じ文言)。
Sourcefn assign_array_destructure(
&mut self,
items: &[Expression],
val: Value,
scope: &Rc<RefCell<Scope>>,
this: &Value,
) -> Result<(), Value>
fn assign_array_destructure( &mut self, items: &[Expression], val: Value, scope: &Rc<RefCell<Scope>>, this: &Value, ) -> Result<(), Value>
配列の分割代入。代入先の各要素は識別子・メンバー・入れ子のパターン(既定値 = v・残り ...r つき)。
Sourcefn eval_target_ref(
&mut self,
target: &Expression,
scope: &Rc<RefCell<Scope>>,
this: &Value,
) -> Result<Option<(Value, Value)>, Value>
fn eval_target_ref( &mut self, target: &Expression, scope: &Rc<RefCell<Scope>>, this: &Value, ) -> Result<Option<(Value, Value)>, Value>
分割代入の要素の代入先がメンバー/添字なら、その参照(対象と添字)を先に評価する。
識別子・入れ子のパターン・super・プライベートは None(従来どおり代入時に処理)。
Sourcefn assign_prepared(
&mut self,
target: &Expression,
pre: Option<(Value, Value)>,
val: Value,
scope: &Rc<RefCell<Scope>>,
this: &Value,
) -> Result<(), Value>
fn assign_prepared( &mut self, target: &Expression, pre: Option<(Value, Value)>, val: Value, scope: &Rc<RefCell<Scope>>, this: &Value, ) -> Result<(), Value>
eval_target_ref で評価済みの参照へ書き込む。None なら通常の assign_to。
fn assign_array_destructure_lazy( &mut self, items: &[Expression], iterator: &Value, next_fn: &Value, scope: &Rc<RefCell<Scope>>, this: &Value, ) -> Result<(), Value>
Sourcefn assign_object_destructure(
&mut self,
props: &[Property],
val: Value,
scope: &Rc<RefCell<Scope>>,
this: &Value,
) -> Result<(), Value>
fn assign_object_destructure( &mut self, props: &[Property], val: Value, scope: &Rc<RefCell<Scope>>, this: &Value, ) -> Result<(), Value>
オブジェクトの分割代入(({a, b: c, [k]: d = 1, ...rest} = o))。
Sourcepub(crate) fn eval_key(
&mut self,
e: &Expression,
scope: &Rc<RefCell<Scope>>,
this: &Value,
) -> Result<Value, Value>
pub(crate) fn eval_key( &mut self, e: &Expression, scope: &Rc<RefCell<Scope>>, this: &Value, ) -> Result<Value, Value>
プロパティキー式の評価 + ToPropertyKey の ToPrimitive(例外を伝える)。
Sourcepub(crate) fn prim_key_for(
&mut self,
base: &Value,
k: Value,
) -> Result<Value, Value>
pub(crate) fn prim_key_for( &mut self, base: &Value, k: Value, ) -> Result<Value, Value>
prim_key。ただし基底が undefined/null のときは変換しない(eval_key_for と同じ理由)。
Sourcepub(crate) fn eval_key_for(
&mut self,
base: &Value,
e: &Expression,
scope: &Rc<RefCell<Scope>>,
this: &Value,
) -> Result<Value, Value>
pub(crate) fn eval_key_for( &mut self, base: &Value, e: &Expression, scope: &Rc<RefCell<Scope>>, this: &Value, ) -> Result<Value, Value>
eval_key。ただし基底が undefined/null のときは変換しない(仕様: 基底の検査が ToPropertyKey より先。
呼び出し側が TypeError にする)。
Sourcepub(crate) fn prim_num(&mut self, v: Value) -> Result<Value, Value>
pub(crate) fn prim_num(&mut self, v: Value) -> Result<Value, Value>
数値のヒントで ToPrimitive(オブジェクト以外は素通し。例外を伝える)。
Sourcepub(crate) fn prim_key(&mut self, v: Value) -> Result<Value, Value>
pub(crate) fn prim_key(&mut self, v: Value) -> Result<Value, Value>
プロパティキー用に ToPrimitive(string)(オブジェクト以外は素通し。例外を伝える)。
Sourcepub(crate) fn numeric_step(
&mut self,
v: &Value,
delta: f64,
) -> Result<(Value, Value), Value>
pub(crate) fn numeric_step( &mut self, v: &Value, delta: f64, ) -> Result<(Value, Value), Value>
++/-- の ToNumeric と加減算(BigInt なら BigInt のまま 1 を足し引きする)。
戻り値は(古い値の数値化、新しい値)。
Sourcepub(crate) fn num_of(&mut self, v: &Value) -> Result<f64, Value>
pub(crate) fn num_of(&mut self, v: &Value) -> Result<f64, Value>
ToNumber(例外を伝える)。オブジェクト以外は Value::to_number と同じ。
Sourcepub(crate) fn to_primitive(
&mut self,
v: Value,
hint: &str,
) -> Result<Value, Value>
pub(crate) fn to_primitive( &mut self, v: Value, hint: &str, ) -> Result<Value, Value>
ToPrimitive(ECMA-262 7.1.1)。原型の連鎖に利用者定義の Symbol.toPrimitive・toString・
valueOf があるときだけ呼ぶ(無ければ値をそのまま返し、従来の組込みの変換に任せる)。
hint は “string”・“number”・“default”。
【2026-10-20】String(obj)・obj + ''・テンプレート文字列・XHR の URL が利用者定義の
toString を呼ばず [object Object] になっていた(YouTube の TrustedResourceUrl 相当の
URL オブジェクトで GET /[object Object] を送っていた)。
Sourcepub(crate) fn to_string_value(&mut self, v: Value) -> Result<String, Value>
pub(crate) fn to_string_value(&mut self, v: Value) -> Result<String, Value>
ToString(利用者定義の toString を考慮)。
pub fn eval_binary( &mut self, op: &BinaryOp, l: Value, r: Value, ) -> Result<Value, Value>
Sourcepub(crate) fn instance_of(
&mut self,
l: &Value,
r: &Value,
) -> Result<Value, Value>
pub(crate) fn instance_of( &mut self, l: &Value, r: &Value, ) -> Result<Value, Value>
l instanceof r: r.prototype を起点に l のプロトタイプ連鎖を辿って一致を探す
(OrdinaryHasInstance の簡略実装。Symbol.hasInstance によるカスタマイズは非対応)。
Sourcepub(crate) fn eval_binary_bigint(
&mut self,
op: &BinaryOp,
l: Value,
r: Value,
) -> Result<Value, Value>
pub(crate) fn eval_binary_bigint( &mut self, op: &BinaryOp, l: Value, r: Value, ) -> Result<Value, Value>
BigInt が絡む二項演算。BigInt 同士は任意精度演算、BigInt と Number の 混在は算術・ビット演算で TypeError。等価・大小比較は数値として許容する。
Sourcepub(crate) fn bigint_loose_eq(&self, l: &Value, r: &Value) -> bool
pub(crate) fn bigint_loose_eq(&self, l: &Value, r: &Value) -> bool
BigInt を含む緩い等価比較(BigInt↔Number/String を数値として比較)。
Source§impl Interp
impl Interp
Sourcepub(crate) fn recursion_cycle_detail(&self) -> Vec<String>
pub(crate) fn recursion_cycle_detail(&self) -> Vec<String>
呼び出しが深すぎた時、内側 64 段に現れる関数を本体ごとに 1 回ずつ(最大 6 個)説明する。 無名関数どうしの無限再帰がどの関数かを見分けるため(2026-10-29。YouTube で自動再生の後に起きる)。
Sourcepub(crate) fn call_stack_names(&self, n: usize) -> Vec<String>
pub(crate) fn call_stack_names(&self, n: usize) -> Vec<String>
呼び出し中の関数名(内側から最大 n 個)。
pub(crate) fn eval_call( &mut self, callee: &Expression, arguments: &[Expression], optional: bool, scope: &Rc<RefCell<Scope>>, this: &Value, ) -> Result<Value, Value>
Sourcepub(crate) fn not_callable(
&mut self,
func: &Value,
callee: &Expression,
call_this: &Value,
) -> Option<Value>
pub(crate) fn not_callable( &mut self, func: &Value, callee: &Expression, call_this: &Value, ) -> Option<Value>
呼べない値なら TypeError を返す。
Sourcepub(crate) fn resolve_callee(
&mut self,
callee: &Expression,
scope: &Rc<RefCell<Scope>>,
this: &Value,
) -> Result<(Value, Value, bool), Value>
pub(crate) fn resolve_callee( &mut self, callee: &Expression, scope: &Rc<RefCell<Scope>>, this: &Value, ) -> Result<(Value, Value, bool), Value>
Call の callee を this 束縛込みで解決する(super/super.method は呼出元
eval_call で先に処理済みのためここには来ない)。戻り値は
(関数, call_this, 途中で ?. 短絡したか)。object/callee 側は
eval_chain_object を再帰的に使うため、a?.b.c() のように途中で短絡した場合は
以降のプロパティアクセス/引数評価/呼出を一切行わずチェーン全体が undefined になる
(ECMA-262 の OptionalChain セマンティクス。以前は最初の ?. の直近1段しか
短絡せず、後続のアクセスで TypeError になっていた)。
Sourcepub(crate) fn eval_chain_object(
&mut self,
expr: &Expression,
scope: &Rc<RefCell<Scope>>,
this: &Value,
) -> Result<(Value, bool), Value>
pub(crate) fn eval_chain_object( &mut self, expr: &Expression, scope: &Rc<RefCell<Scope>>, this: &Value, ) -> Result<(Value, bool), Value>
Member/Index/Call の「object/callee」位置を短絡込みで評価する。戻り値の
bool は「このサブチェーンのどこかで ?. が短絡したか」。短絡時、値は常に
Value::Undefined。グローバルな可変フラグではなく戻り値だけで伝播するため、
無関係な式の評価に短絡状態が漏れることが無い。super/super.method を含む
Call は短絡セマンティクス対象外のため既存の eval_call にそのまま委譲する。
Sourcepub(crate) fn eval_arguments(
&mut self,
arguments: &[Expression],
scope: &Rc<RefCell<Scope>>,
this: &Value,
) -> Result<Vec<Value>, Value>
pub(crate) fn eval_arguments( &mut self, arguments: &[Expression], scope: &Rc<RefCell<Scope>>, this: &Value, ) -> Result<Vec<Value>, Value>
呼出引数を評価し、スプレッド ...x を展開した Vec を返す。
Sourcepub(crate) fn recycle_args(&mut self, args: Vec<Value>)
pub(crate) fn recycle_args(&mut self, args: Vec<Value>)
呼び終えた引数の Vec をプールへ戻す(呼ばれた側は必要な値を複製済み)。
pub(crate) fn eval_new( &mut self, callee: &Expression, arguments: &[Expression], scope: &Rc<RefCell<Scope>>, this: &Value, ) -> Result<Value, Value>
Sourcepub fn construct_value(
&mut self,
func: &Value,
args: &[Value],
) -> Result<Value, Value>
pub fn construct_value( &mut self, func: &Value, args: &[Value], ) -> Result<Value, Value>
new の本体: インスタンスを生成しコンストラクタを呼ぶ。
pub(crate) fn construct_object( &mut self, func: &Value, args: &[Value], ) -> Result<Value, Value>
Sourcepub(crate) fn construct_with_target(
&mut self,
func: &Value,
args: &[Value],
new_target: &Value,
) -> Result<Value, Value>
pub(crate) fn construct_with_target( &mut self, func: &Value, args: &[Value], new_target: &Value, ) -> Result<Value, Value>
new / Reflect.construct(func, args, new_target)。インスタンスの原型は
new_target.prototype(仕様の OrdinaryCreateFromConstructor)。
Sourcepub(crate) fn call_enter(&mut self, func: &Value) -> Result<(), Value>
pub(crate) fn call_enter(&mut self, func: &Value) -> Result<(), Value>
関数呼び出しの共通前処理(再帰深度/スタック検査・コールスタック記録・循環GC)。
Sourcepub(crate) fn call_leave(&mut self)
pub(crate) fn call_leave(&mut self)
関数呼び出しの共通後処理(CE反応処理・コールスタック/深度復元)。
Sourcepub(crate) fn call_value_with_new_target(
&mut self,
func: &Value,
this: Value,
args: &[Value],
new_target: Value,
) -> Result<Value, Value>
pub(crate) fn call_value_with_new_target( &mut self, func: &Value, this: Value, args: &[Value], new_target: Value, ) -> Result<Value, Value>
new.target を設定して関数値を呼び出す(ホスト要素の構築フック用)。
Sourcefn make_arguments_obj(
&self,
args: &[Value],
callee: Value,
is_strict: bool,
) -> Rc<RefCell<Obj>>
fn make_arguments_obj( &self, args: &[Value], callee: Value, is_strict: bool, ) -> Rc<RefCell<Obj>>
arguments オブジェクトを生成する。strict 関数では callee をシングルトン %ThrowTypeError% アクセサにする。
Sourcepub fn call_value(
&mut self,
func: &Value,
this: Value,
args: &[Value],
) -> Result<Value, Value>
pub fn call_value( &mut self, func: &Value, this: Value, args: &[Value], ) -> Result<Value, Value>
関数値を呼び出す。
Sourcepub fn call_listener(
&mut self,
func: &Value,
this: Value,
args: &[Value],
context: &str,
) -> bool
pub fn call_listener( &mut self, func: &Value, this: Value, args: &[Value], context: &str, ) -> bool
イベントリスナ・タイマコールバック・オブザーバ通知など、 呼び出し元へ例外を返せない場所からの関数呼び出し。
【2026-07-28】これらは従来 let _ = self.call_value(...) と書かれており、
ハンドラ内で投げられた例外はコンソールにもログにも現れず完全に消えていた
(「ボタンを押しても何も起きない」だけが症状として残る)。ブラウザ同様、
捕捉されなかった例外は必ず報告する。
Sourcepub fn report_uncaught(&mut self, context: &str, thrown: &Value)
pub fn report_uncaught(&mut self, context: &str, thrown: &Value)
捕捉されなかった例外を、ページのコンソール出力とシリアルログの両方へ出す。
Sourcepub(crate) fn dispatch_call_kind(
&mut self,
kind: CallKind,
func: &Value,
this: Value,
args: &[Value],
) -> Result<Value, Value>
pub(crate) fn dispatch_call_kind( &mut self, kind: CallKind, func: &Value, this: Value, args: &[Value], ) -> Result<Value, Value>
1 回の borrow で取得済み CallKind を実行する(call_value_inner と op_call の共通本体)。
pub(crate) fn call_value_inner( &mut self, func: &Value, this: Value, args: &[Value], ) -> Result<Value, Value>
pub(crate) fn alloc_call_scope( &mut self, parent: Rc<RefCell<Scope>>, n_vars: usize, ) -> Rc<RefCell<Scope>>
pub(crate) fn alloc_block_scope( &mut self, parent: Rc<RefCell<Scope>>, ) -> Rc<RefCell<Scope>>
pub(crate) fn recycle_call_scope(&mut self, scope: Rc<RefCell<Scope>>)
pub(crate) fn recycle_block_scope(&mut self, scope: Rc<RefCell<Scope>>)
Sourcepub(crate) fn global_window(&mut self) -> Value
pub(crate) fn global_window(&mut self) -> Value
グローバルオブジェクト(globalThis)。位置を覚えて毎回の名前の検索を省く(非 strict の関数の呼び出しごとに要る)。
pub(crate) fn call_user_function( &mut self, fd: &FunctionData, this: Value, args: &[Value], callee: Value, ) -> Result<Value, Value>
fn call_user_function_inner( &mut self, fd: &FunctionData, this: Value, args: &[Value], callee: Value, dt_cell: Option<Rc<RefCell<Option<Value>>>>, ) -> Result<Value, Value>
Source§impl Interp
impl Interp
pub(crate) fn string_get_prop(&self, sv: &Value, key: &str) -> Value
pub(crate) fn number_get_prop(&self, key: &str) -> Value
pub(crate) fn boolean_get_prop(&self, key: &str) -> Value
pub(crate) fn bigint_get_prop(&self, key: &str) -> Value
pub(crate) fn object_get_prop(&self, o: &ObjRef, key: &str) -> Value
Sourcepub(crate) fn has_property_chain(&self, o: &ObjRef, key: &str) -> bool
pub(crate) fn has_property_chain(&self, o: &ObjRef, key: &str) -> bool
key in obj 用: 自身 props → プロトタイプ連鎖を辿って存在判定。
配列の length / 数値インデックスも考慮する。
Sourcepub(crate) fn is_global_obj(&self, o: &ObjRef) -> bool
pub(crate) fn is_global_obj(&self, o: &ObjRef) -> bool
o がグローバルオブジェクト(globalThis / ブラウザ時は window)か。
Sourcepub(crate) fn is_window_obj(&self, o: &ObjRef) -> bool
pub(crate) fn is_window_obj(&self, o: &ObjRef) -> bool
is_global_obj の互換名。
Sourcepub fn get_property_of_expr(
&mut self,
recv: &Value,
key: &str,
obj_expr: &Expression,
) -> Result<Value, Value>
pub fn get_property_of_expr( &mut self, recv: &Value, key: &str, obj_expr: &Expression, ) -> Result<Value, Value>
recv.key を読む。recv が undefined/null のときの例外に、その値を生んだ式
(obj_expr)を stack の先頭行の直後へ添える(2026-09-26。どの式が undefined
だったか分からず、ミニファイされたライブラリの不具合を追えなかった)。
Sourcepub(crate) fn get_index_fast(&self, obj: &Value, key: &Value) -> Option<Value>
pub(crate) fn get_index_fast(&self, obj: &Value, key: &Value) -> Option<Value>
数値の添字 obj[n] の読み取りの近道(配列・型付き配列・文字列)。扱えなければ None
(呼び出し側は文字列キーの get_property へ回す)。
【2026-10-24】従来は添字を毎回文字列に変換(確保と数値の書式化)して文字列キーで
引き直していた。YouTube が JS 版 zlib(pako)で送信データを圧縮する内側のループ
(S.window[p+2] 等)が QEMU で 1 回 90µs かかり、再生開始が数分遅れていた。
【2026-11-10】Value::Str に対するインデックスアクセスも直接高速処理し、UTF-16 単位キャッシュ
から O(1) ゼロアロケーションで文字を返却可能に拡張。
Sourcepub(crate) fn set_index_fast(
&mut self,
obj: &Value,
key: &Value,
val: Value,
) -> Option<Value>
pub(crate) fn set_index_fast( &mut self, obj: &Value, key: &Value, val: Value, ) -> Option<Value>
数値の添字 obj[n] = v の書き込みの近道。扱えたら None、扱えなければ値を返す
(呼び出し側は文字列キーの set_property へ回す)。
【2026-11-10】範囲内要素の上書きに加え、末尾要素の追加(i == items.len())および
近傍拡張(i - items.len() <= 64)を直接 push/resize でゼロアロケーション実行可能にし、
かつ _ta_kind の走査をゼロコピー借用に刷新。
pub fn get_property(&mut self, recv: &Value, key: &str) -> Result<Value, Value>
Sourcepub(crate) fn get_property_proto_chain(
&mut self,
recv: &Value,
o: &ObjRef,
key: &str,
start: Option<ObjRef>,
) -> Result<Value, Value>
pub(crate) fn get_property_proto_chain( &mut self, recv: &Value, o: &ObjRef, key: &str, start: Option<ObjRef>, ) -> Result<Value, Value>
自身のプロパティ / アクセサ / プロトタイプ連鎖を辿って解決する。
アクセサの getter は必ず元の recv(レシーバ)を this として呼ぶ。
以前はプロトタイプ連鎖を get_property の再帰で辿っていたため、
継承した getter(class の get x(){} 等)を呼ぶ際に this が
プロトタイプ自身に化けてしまい、インスタンス側のフィールドを
正しく読めない(this.r 等が常に undefined になる)バグがあった。
ここでは recv を固定したまま cur だけをプロトタイプ連鎖に沿って
進めるループに書き換えている。
Sourcepub(crate) fn proto_chain_lookup(
&mut self,
recv: &Value,
o: &ObjRef,
key: &str,
start: Option<ObjRef>,
) -> Option<Result<Value, Value>>
pub(crate) fn proto_chain_lookup( &mut self, recv: &Value, o: &ObjRef, key: &str, start: Option<ObjRef>, ) -> Option<Result<Value, Value>>
原型連鎖(実体が原型を持たない組込みは、種類に応じた組込みの prototype と Object.prototype まで)を
辿って、自前・アクセサ・継承のプロパティを探す。見つからなければ None(組込みの名前表へは進まない)。
【2026-11-20】以前は proto が無い配列・素のオブジェクトで連鎖が途切れ、Array.prototype.foo = …; [].foo()・
Object.prototype.bar = …; ({}).bar() が「関数でない」になっていた(test262 の原型汚染の試験が大量に落ちる)。
Sourcepub fn set_property(&mut self, recv: &Value, key: &str, val: Value)
pub fn set_property(&mut self, recv: &Value, key: &str, val: Value)
[[Set]] の結果を捨てる版(組み込み関数の内部用。従来どおり、失敗は黙殺し、setter・Proxy の例外は報告だけする)。
pub fn set_property_rc(&mut self, recv: &Value, key: &Rc<str>, val: Value)
Sourcepub fn put_value(
&mut self,
recv: &Value,
key: &str,
val: Value,
) -> Result<(), Value>
pub fn put_value( &mut self, recv: &Value, key: &str, val: Value, ) -> Result<(), Value>
利用者のコードの代入(PutValue。ECMA-262 §6.2.5.6)。[[Set]] が false を返したとき、strict のコードなら TypeError、 setter・Proxy の set トラップが投げた例外は常に呼び出し元へ伝える。
pub fn put_value_rc( &mut self, recv: &Value, key: &Rc<str>, val: Value, ) -> Result<(), Value>
fn put_failed(&mut self, recv: &Value, key: &str) -> Result<(), Value>
Source§impl Interp
impl Interp
Sourcepub(crate) fn next_private_brand_id(&self) -> u64
pub(crate) fn next_private_brand_id(&self) -> u64
新しい一意なプライベートブランド ID を払い出す。
Sourcepub(crate) fn effective_this(&self, fallback: &Value) -> Value
pub(crate) fn effective_this(&self, fallback: &Value) -> Value
super() が返したオブジェクトで置換された現在の this を返す。
Sourcepub(crate) fn global_object(&self) -> Option<ObjRef>
pub(crate) fn global_object(&self) -> Option<ObjRef>
グローバルオブジェクト(globalThis / ブラウザ時は window)を取得する。
Sourcepub(crate) fn sync_global_prop_if_present(
&self,
name: &str,
val: &Value,
) -> Option<Value>
pub(crate) fn sync_global_prop_if_present( &self, name: &str, val: &Value, ) -> Option<Value>
グローバル変数の値更新を globalThis.props へ同期する(既に自前プロパティとして存在する場合のみ)。
writable: false のため更新を拒否した場合は Some(元の値) を返す(globalThis 以外のレキシカル宣言等は None)。
Sourcepub fn builtin_fn_val(&self, name: &'static str, func: NativeFn) -> Value
pub fn builtin_fn_val(&self, name: &'static str, func: NativeFn) -> Value
組込みネイティブ関数のシングルトン値を取得する(無ければキャッシュに登録して返す)。
プロパティ参照([].push や el.getAttribute 等)での無駄なアロケーションをゼロにする。
関数ポインタアドレス func as usize をキーにすることで、[].slice と "".slice 等の
同名・別実装メソッド間のキャッシュ衝突を防ぐ。
Sourcepub fn char_unit_val(&self, u: Option<u16>) -> Value
pub fn char_unit_val(&self, u: Option<u16>) -> Value
UTF-16 の単位 1 個の文字列。ASCII は実行環境ごとに使い回す(builtin_fn_cache の鍵 1〜128。2026-11-05。
s.charAt(i)・s[i] が 1 文字ごとに確保を 2 回していた)。
Sourcepub fn empty_str_val(&self) -> Value
pub fn empty_str_val(&self) -> Value
空文字列 "" のシングルトン Value を取得する(毎回ヒープアロケーションしない)。
Source§impl Interp
impl Interp
Sourcepub(crate) fn take_pending_new_target(&mut self) -> Option<Value>
pub(crate) fn take_pending_new_target(&mut self) -> Option<Value>
new で呼ばれたネイティブのコンストラクタが、new.target を受け取る(呼ばれたのが new でなければ None)。
Sourcepub(crate) fn resolve_with_scope(
&mut self,
scope: &Rc<RefCell<Scope>>,
name: &str,
) -> Result<Option<(ObjRef, bool)>, Value>
pub(crate) fn resolve_with_scope( &mut self, scope: &Rc<RefCell<Scope>>, name: &str, ) -> Result<Option<(ObjRef, bool)>, Value>
with (obj) スコープチェーン上で識別子 name を解決する(HasBinding + @@unscopables)。
Source§impl Interp
impl Interp
Sourcepub(crate) fn attrs_map_get(&mut self, elem: usize, key: &str) -> Option<Value>
pub(crate) fn attrs_map_get(&mut self, elem: usize, key: &str) -> Option<Value>
element.attributes(HOST_ATTRS)のメンバー。見つからないときは None(原型連鎖へ)。
Sourcepub(crate) fn attrs_map_values(&self, elem: usize) -> Vec<Value>
pub(crate) fn attrs_map_values(&self, elem: usize) -> Vec<Value>
for…of・展開で並べる Attr のハンドル。
Source§impl Interp
impl Interp
Sourcepub(crate) fn dom_exception(&self, name: &str, message: &str) -> Value
pub(crate) fn dom_exception(&self, name: &str, message: &str) -> Value
組み込みの DOMException の原型(DOMException.prototype)を持つ例外オブジェクトを作る
(2026-11-19。e instanceof DOMException・e.constructor === DOMException が成り立つ。WPT の assert_throws_dom が見る)。
グローバルに DOMException が無ければ原型なしの make_dom_exception と同じ。
Source§impl Interp
impl Interp
Sourcefn ce_registry(&self) -> Option<ObjRef>
fn ce_registry(&self) -> Option<ObjRef>
customElements の登録表(名前 → コンストラクタ)。
Sourcepub(crate) fn ce_ctor_for(&self, tag: &str) -> Option<Value>
pub(crate) fn ce_ctor_for(&self, tag: &str) -> Option<Value>
要素名 tag に定義されたコンストラクタ。
Sourcepub(crate) fn ce_constructs_element(&self, new_target: &Value) -> bool
pub(crate) fn ce_constructs_element(&self, new_target: &Value) -> bool
new new_target をカスタム要素の構築として扱うか(昇格中・同じ new.target の入れ子の構築・
登録済みのクラス)。それ以外は原型が HTMLElement に届いても普通のオブジェクトとして構築する。
【2026-10-24】Polymer の templatize は <template> を拡張する ES5 の関数 v(原型が
HTMLTemplateElement 経由で HTMLElement に届く。本体は既存のテンプレートを返すだけ)を
new v() しており、未登録のため「Illegal constructor」で落ちていた(ブラウザでは普通の
オブジェクトが作られる)。
Sourcefn ce_name_for_ctor(&self, func: &Value) -> Option<String>
fn ce_name_for_ctor(&self, func: &Value) -> Option<String>
コンストラクタ func を登録した要素名。
Sourcepub(crate) fn element_class_proto(&self, func: &Value) -> Option<ObjRef>
pub(crate) fn element_class_proto(&self, func: &Value) -> Option<ObjRef>
func.prototype の連鎖が HTMLElement.prototype に届くか(カスタム要素のクラスか)。
Sourcepub(crate) fn ce_construct_target(
&mut self,
new_target: &Value,
proto: ObjRef,
) -> Result<(usize, bool), Value>
pub(crate) fn ce_construct_target( &mut self, new_target: &Value, proto: ObjRef, ) -> Result<(usize, bool), Value>
カスタム要素のクラスの new: this にする DOM 要素の添字を決め、原型を付ける。
戻り値の bool は新しく構築を始めたか(構築スタックに積むか)。
- 構築中の要素と同じ new.target の入れ子の構築(ES5 版の
Reflect.construct(HTMLElement, [], this.constructor))は、同じ要素を返す(仕様の構築スタック)。 - 昇格中ならその要素、そうでなければ new.target の登録名で要素を作る(未登録なら TypeError)。
Sourcepub(crate) fn ce_try_upgrade(&mut self, idx: usize, connected: bool) -> bool
pub(crate) fn ce_try_upgrade(&mut self, idx: usize, connected: bool) -> bool
要素 idx を(定義があり、未昇格なら)昇格する。connected なら connectedCallback も呼ぶ。
昇格したら true。
Sourcefn ce_callback(&mut self, idx: usize, name: &str)
fn ce_callback(&mut self, idx: usize, name: &str)
昇格済みのカスタム要素のライフサイクル関数を呼ぶ(無ければ何もしない)。
Sourcepub(crate) fn ce_adopted_callback(&mut self, idx: usize)
pub(crate) fn ce_adopted_callback(&mut self, idx: usize)
カスタム要素の adoptedCallback(oldDocument, newDocument) を呼ぶ
Sourcepub(crate) fn process_ce_reactions(&mut self)
pub(crate) fn process_ce_reactions(&mut self)
溜まったカスタム要素の反応を処理する(DOM を変える呼び出しの後に呼ぶ)。
反応の中(connectedCallback 等)で DOM を変えた場合も、その呼び出しが戻る前に処理する
(仕様の CEReactions は呼び出しごとに要素キューを積んで、戻る前に空にする)。
【2026-10-24】従来は処理中の再入を禁じて外側の処理の後へ回していたため、YouTube の
<ytd-watch-flexy> が connectedCallback 内でテンプレートを複製した直後に呼ぶ
getPlayer().preparePlayer() で、子の <ytd-player> がまだ昇格しておらず例外になっていた。
Source§impl Interp
impl Interp
Sourcepub fn dispatch_event_in_interp(
&mut self,
node_idx: usize,
event_type: &str,
extra: &[(String, Value)],
) -> (bool, bool)
pub fn dispatch_event_in_interp( &mut self, node_idx: usize, event_type: &str, extra: &[(String, Value)], ) -> (bool, bool)
element.dispatchEvent から呼ぶ Interp 内ディスパッチ。JsRuntime 版と同じ capture→target→bubble の3フェーズ・once・stopPropagation を再現するが、 リスナは self.call_value で同一 Interp 上で実行する。戻り値: (発火したか, defaultPrevented)。
Sourcepub fn dispatch_event_object(
&mut self,
node_idx: usize,
event_type: &str,
extra: &[(String, Value)],
user_ev: Option<ObjRef>,
) -> (bool, bool)
pub fn dispatch_event_object( &mut self, node_idx: usize, event_type: &str, extra: &[(String, Value)], user_ev: Option<ObjRef>, ) -> (bool, bool)
dispatch_event_in_interp の、呼び出し元のイベントオブジェクト user_ev をそのまま
リスナーへ渡す版(element.dispatchEvent(ev))。仕様どおりリスナーと呼び出し元は同じ
オブジェクトを見る。【2026-10-24】従来は複製した新しいオブジェクトを渡していたため、
ShadyDOM(YouTube)がイベントに付けた印や、リスナー側で付けた値が呼び出し元に見えなかった。
Sourcefn set_dispatch_target(
&self,
ev: &ObjRef,
adj: &[Option<usize>],
related: &[Option<usize>],
has_related: bool,
pos: usize,
)
fn set_dispatch_target( &self, ev: &ObjRef, adj: &[Option<usize>], related: &[Option<usize>], has_related: bool, pos: usize, )
パス位置 pos の呼び出しに向け、event.target(直前までで最後の非 null な shadow-adjusted target)
と retarget 済み relatedTarget を設定する。
fn fire_window_listeners_in_dispatch( &mut self, ev: &ObjRef, event_type: &str, want_capture: bool, ) -> (bool, bool)
Sourcefn fire_document_listeners(
&mut self,
ev: &ObjRef,
event_type: &str,
want_capture: bool,
) -> (bool, bool)
fn fire_document_listeners( &mut self, ev: &ObjRef, event_type: &str, want_capture: bool, ) -> (bool, bool)
documentの_listeners[event_type]のうちcaptureフラグがwant_capture
と一致するリスナを発火する。
Sourcepub(crate) fn dom_obj(&self, idx: usize) -> ObjRef
pub(crate) fn dom_obj(&self, idx: usize) -> ObjRef
DOM ノード idx の JS のオブジェクト。ノードごとに 1 個にまとめる。
【2026-11-02】従来はアクセスのたびに新しいオブジェクトを作っていた。YouTube の視聴ページでは
ノード約 1.5 万個に対して 9 万個が生きていて、同じ要素をキーにした Map・WeakMap も毎回
別のキーになっていた。弱参照で覚えるので、JS が手放せば今までどおり解放される。
非 DOM の EventTarget(window/XMLHttpRequest 等)向け relatedTarget の retarget。
Sourcefn is_mouse_event_obj(&self, ev: &ObjRef) -> bool
fn is_mouse_event_obj(&self, ev: &ObjRef) -> bool
ev が MouseEvent(またはそのサブクラス)のインスタンスか。
Sourcefn post_activation_step(
&mut self,
act_idx: usize,
act_state: Option<ActivationState>,
default_prevented: bool,
click_target_idx: usize,
)
fn post_activation_step( &mut self, act_idx: usize, act_state: Option<ActivationState>, default_prevented: bool, click_target_idx: usize, )
activation behavior の事後処理(click イベント配送完了・window.event 復元後)。
Source§impl Interp
impl Interp
pub(crate) fn dom_get_property(&mut self, disp: DomDisp, key: &str) -> Value
Sourcepub(crate) fn dom_builtin_get(&mut self, idx: usize, key: &str) -> Value
pub(crate) fn dom_builtin_get(&mut self, idx: usize, key: &str) -> Value
要素の組込みメンバだけを引く(expando・カスタム要素のクラスを見ない)。
Element.prototype.setAttribute 等の転送用ネイティブが使う。
Sourcepub(crate) fn dom_builtin_set(&mut self, idx: usize, key: &str, val: Value)
pub(crate) fn dom_builtin_set(&mut self, idx: usize, key: &str, val: Value)
要素の組込みプロパティに書く(クラスの setter を経由しない)。
Sourcefn dom_proto_override(&mut self, idx: usize, key: &str) -> Option<Value>
fn dom_proto_override(&mut self, idx: usize, key: &str) -> Option<Value>
要素の原型連鎖に JS が定義した上書き(ネイティブでない関数・getter)があれば返す。
【2026-10-20】YouTube は Node.prototype.appendChild 等を JS で包み、挿入時に
monomer 部品の接続処理を呼ぶ(usePatchedLifecycles)。組込みが先だと包みが効かず、
ytd-page-manager が接続されないまま視聴ページが描かれなかった。
Sourcefn ce_chain_get(&mut self, idx: usize, key: &str) -> Option<Value>
fn ce_chain_get(&mut self, idx: usize, key: &str) -> Option<Value>
昇格したカスタム要素のクラスの原型連鎖から key を引く(無ければ None)。
pub(crate) fn dom_element_get(&mut self, idx: usize, key: &str) -> Value
Sourcefn dom_proto_chain_get(&mut self, idx: usize, key: &str) -> Value
fn dom_proto_chain_get(&mut self, idx: usize, key: &str) -> Value
DOM 要素の原型の連鎖から key を引く(無ければ undefined)。
pub(crate) fn dom_set_property(&mut self, disp: DomDisp, key: &str, val: Value)
Sourcefn elem_ns_local(&self, idx: usize) -> Option<(Option<String>, String)>
fn elem_ns_local(&self, idx: usize) -> Option<(Option<String>, String)>
要素ノードなら (namespaceURI, localName) を返す(テキスト・コメント・PI 等は None)。
Sourcefn is_rel_list_elem(&self, idx: usize) -> bool
fn is_rel_list_elem(&self, idx: usize) -> bool
relList を持つ要素か(HTML の a/area/link/form、または SVG/MathML の a)。
Sourcefn token_list_val(&self, class: u8, idx: usize) -> Value
fn token_list_val(&self, class: u8, idx: usize) -> Value
DOMTokenList プロキシオブジェクトを生成し、DOMTokenList.prototype を接続して返す。
Sourcepub(crate) fn get_iframe_content_window(&mut self, idx: usize) -> Value
pub(crate) fn get_iframe_content_window(&mut self, idx: usize) -> Value
iframe 要素の contentWindow(子フレームの WindowProxy オブジェクト)を取得し、同一ノードでは同一インスタンスを返す。
Source§impl Interp
impl Interp
pub(crate) fn dom_state(&self) -> &InterpHostState
pub(crate) fn wasm(&self) -> &Rc<RefCell<WasmState>>
pub(crate) fn pending_xhrs(&self) -> &Rc<RefCell<BTreeMap<u64, Value>>>
Sourcepub fn clean_unreachable_dom_resources(&self) -> usize
pub fn clean_unreachable_dom_resources(&self) -> usize
文書ツリーに属しておらず、かつ JS の変数やキャッシュからも参照されていない孤立 DOM ノードの リソース(リスナ、expando、カスタム要素プロトタイプ等)を解放する。
Sourcepub(crate) fn media_status(&self, idx: usize) -> Option<PlaybackStatus>
pub(crate) fn media_status(&self, idx: usize) -> Option<PlaybackStatus>
<video>/<audio> が再生スレッドの対象(src が一致)なら、その再生状態。
Sourcepub(crate) fn media_source_duration(&self, src: &str) -> Option<f64>
pub(crate) fn media_source_duration(&self, src: &str) -> Option<f64>
MSE の要素の長さ(秒): JS が設定した mediaSource.duration、無ければ buffered の終わり。
Sourcepub(crate) fn resolve_url_against_page(&self, raw: &str) -> String
pub(crate) fn resolve_url_against_page(&self, raw: &str) -> String
href/src/action IDL プロパティ用: 現在のページURL基準で相対URLを
絶対URLへ解決する(JsRuntime::new_interp の base_url 解決と同じ真実源)。
Source§impl Interp
impl Interp
Sourcepub(crate) fn dom_document_get(
&mut self,
o: &ObjRef,
key: &str,
) -> Option<Value>
pub(crate) fn dom_document_get( &mut self, o: &ObjRef, key: &str, ) -> Option<Value>
document の取得(body・head・title・cookie など。HOST_DOCUMENT)。
None は「ホストとしては処理しない」(getElementById 等のメソッドは通常の props 解決へ)。
Sourcepub(crate) fn dom_document_set(
&mut self,
o: &ObjRef,
key: &str,
val: &Value,
) -> bool
pub(crate) fn dom_document_set( &mut self, o: &ObjRef, key: &str, val: &Value, ) -> bool
document への代入(title・cookie)。処理したら true。
Sourcepub(crate) fn dom_form_collection_get(
&mut self,
o: &ObjRef,
key: &str,
) -> Option<Value>
pub(crate) fn dom_form_collection_get( &mut self, o: &ObjRef, key: &str, ) -> Option<Value>
RadioNodeList.prototype.value(HTML Standard §4.10.21.1 getter)と select.selectedIndex の取得。
対象外なら None(核が普通の解決を続ける)。
Sourcepub(crate) fn dom_form_collection_set(
&mut self,
o: &ObjRef,
key: &str,
val: &Value,
) -> bool
pub(crate) fn dom_form_collection_set( &mut self, o: &ObjRef, key: &str, val: &Value, ) -> bool
RadioNodeList.prototype.value = val(同 setter)と select.selectedIndex = n。処理したら true。
Sourcepub(crate) fn get_dom_node_proto(&self, node_idx: usize) -> Option<ObjRef>
pub(crate) fn get_dom_node_proto(&self, node_idx: usize) -> Option<ObjRef>
DOM ノードのタグ名または種別から、動的に対応する HTMLXxxElement.prototype
(または HTMLElement.prototype / Element.prototype / Node.prototype)を解決する。
Source§impl Interp
impl Interp
Sourcepub(crate) fn run_post_connection_steps(&mut self)
pub(crate) fn run_post_connection_steps(&mut self)
積まれた post-connection steps を処理し、外れた子フレームを捨てて window.length・window[i] を直す。
何も無ければすぐ戻る(関数呼び出しのたびに呼ばれる)。
Sourcefn prune_frames_if_needed(&mut self)
fn prune_frames_if_needed(&mut self)
木から外れた(閲覧コンテキストのある文書に繋がらなくなった)枠の子文書を捨てる。
fn post_connect_one(&mut self, idx: usize)
Sourcefn prepare_inserted_script(&mut self, idx: usize)
fn prepare_inserted_script(&mut self, idx: usize)
<script> の準備(HTML「prepare the script element」の、この処理系で扱う部分)。
Sourcefn run_inline_script(
&mut self,
idx: usize,
code: &str,
frame_elem: Option<usize>,
)
fn run_inline_script( &mut self, idx: usize, code: &str, frame_elem: Option<usize>, )
インラインのクラシックスクリプトを同期で実行する(document.currentScript を設定・復元し、例外は報告する)。
Sourcefn setup_inserted_frame(&mut self, idx: usize)
fn setup_inserted_frame(&mut self, idx: usize)
<iframe>/<frame> の post-connection steps: 子の閲覧コンテキスト(about:blank の文書)を作り、
src が無ければ load を同期で送る。
Sourcepub(crate) fn frame_has_browsing_context(&mut self, idx: usize) -> bool
pub(crate) fn frame_has_browsing_context(&mut self, idx: usize) -> bool
枠の要素が子の閲覧コンテキストを持つか(contentWindow・contentDocument 用)。
閲覧コンテキストのある文書に繋がっていて post-connection 待ちでなければ、ここで子文書を作る
(パーサが作った <iframe> は挿入の経路を通らないため)。
Sourcepub(crate) fn sync_child_frames(&mut self)
pub(crate) fn sync_child_frames(&mut self)
主文書の window と各子フレームの contentWindow の length・[i] を、接続中の子フレームに合わせる(ツリー順)。
fn set_window_frames(&mut self, win: &ObjRef, frames: &[usize])
Source§impl Interp
impl Interp
Sourcepub(crate) fn reflect_get(&mut self, idx: usize, key: &str) -> Option<Value>
pub(crate) fn reflect_get(&mut self, idx: usize, key: &str) -> Option<Value>
el.<key> の取得。表に無ければ None(従来の実装へ)。
Sourcefn reflect_resolve_url(&self, raw: &str) -> String
fn reflect_resolve_url(&self, raw: &str) -> String
反映する URL 属性の取得: 文書の URL を基準に解析し、できなければ属性値そのまま(空文字列も基準 URL になる)。
fn reflect_local(&self, idx: usize) -> Option<String>
Sourcepub(crate) fn reflect_set(&mut self, idx: usize, key: &str, val: &Value) -> bool
pub(crate) fn reflect_set(&mut self, idx: usize, key: &str, val: &Value) -> bool
el.<key> = val。表で処理したら true。
Sourcepub(crate) fn anchor_url(&self, idx: usize) -> Option<Url>
pub(crate) fn anchor_url(&self, idx: usize) -> Option<Url>
<a>/<area> の href を、文書の URL を基準に解析した URL(解析できなければ None)。
Sourcepub(crate) fn anchor_get(&self, idx: usize, key: &str) -> String
pub(crate) fn anchor_get(&self, idx: usize, key: &str) -> String
a.protocol などの取得(URL 分解プロパティ)。
Sourcepub(crate) fn anchor_set(&mut self, idx: usize, key: &str, v: &str)
pub(crate) fn anchor_set(&mut self, idx: usize, key: &str, v: &str)
a.protocol = v などの代入。新しい URL を href 属性へ書く。