mirror of
https://github.com/pjh456/OxideJS.git
synced 2026-10-25 11:11:11 +08:00
refactor: 拆分属性与成员分发并统一 LOAD_CONST 发射
This commit is contained in:
@@ -96,6 +96,15 @@ impl CompileCtx {
|
||||
self.bytecode.push(instr);
|
||||
}
|
||||
|
||||
pub(crate) fn emit_load_const(&mut self, reg: u8, idx: u16) {
|
||||
self.emit(opcode::encode(
|
||||
OpCode::LOAD_CONST,
|
||||
reg,
|
||||
(idx & 0xFF) as u8,
|
||||
((idx >> 8) & 0xFF) as u8,
|
||||
));
|
||||
}
|
||||
|
||||
pub(crate) fn alloc_reg(&mut self) -> u8 {
|
||||
let r = self.next_reg;
|
||||
self.next_reg = self.next_reg.wrapping_add(1);
|
||||
|
||||
Reference in New Issue
Block a user