pub(crate) struct Slot {
hops: Cell<u32>,
index: Cell<u32>,
key: Cell<*const u8>,
}Expand description
変数の場所の覚え(A1 の段階 1)。何段外のスコープの何番目か。
スコープの連なりは字句の構造で決まるので、同じ命令なら場所は変わらない。名前の検索を省くのが
目的で、圧縮された JS の深い閉包では外側の変数の検索が実行時間の約 1 割を占めていた。key は
束縛の名前の番地で、その場所に同じ束縛があることの確認に使う。
外れるのは、読んだ後で内側に同名の let が宣言される場合だけで、これは本来 TDZ のエラーになる。
Fields§
§hops: Cell<u32>§index: Cell<u32>§key: Cell<*const u8>Implementations§
Source§impl Slot
impl Slot
Auto Trait Implementations§
impl !Freeze for Slot
impl !RefUnwindSafe for Slot
impl !Send for Slot
impl !Sync for Slot
impl Unpin for Slot
impl UnsafeUnpin for Slot
impl UnwindSafe for Slot
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more