Skip to content

Commit

Permalink
remove StaticPropAccessW and make the existing one wide
Browse files Browse the repository at this point in the history
  • Loading branch information
y21 committed May 5, 2024
1 parent 44a0255 commit c175698
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 9 deletions.
3 changes: 2 additions & 1 deletion crates/dash_compiler/src/instruction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,8 @@ impl<'cx, 'interner> InstructionBuilder<'cx, 'interner> {

pub fn build_static_prop_access(&mut self, ident: Symbol, preserve_this: bool) -> Result<(), LimitExceededError> {
let id = self.current_function_mut().cp.add(Constant::Identifier(ident))?;
self.write_wide_instr(Instruction::StaticPropAccess, Instruction::StaticPropAccessW, id);
self.write_instr(Instruction::StaticPropAccess);
self.writew(id);
self.write(preserve_this.into());

Ok(())
Expand Down
7 changes: 1 addition & 6 deletions crates/dash_decompiler/src/decompiler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -210,15 +210,10 @@ impl<'interner, 'buf> FunctionDecompiler<'interner, 'buf> {
);
}
Instruction::StaticPropAccess => {
let b = self.read()?;
let b = self.read_i16()?;
let _preserve_this = self.read()?;
self.handle_op_instr("staticpropaccess", &[&self.display(&self.constants[b as usize])]);
}
Instruction::StaticPropAccessW => {
let b = self.read_u16()?;
let _preserve_this = self.read()?;
self.handle_op_instr("staticpropaccessw", &[&self.display(&self.constants[b as usize])]);
}
Instruction::Ret => {
self.read_u16()?; // intentionally ignored
self.handle_opless_instr("ret")
Expand Down
1 change: 0 additions & 1 deletion crates/dash_middle/src/compiler/instruction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ pub enum Instruction {
JmpFalseP,
Jmp,
StaticPropAccess,
StaticPropAccessW,
DynamicPropAccess,
ArrayLit,
ArrayLitW,
Expand Down
2 changes: 1 addition & 1 deletion crates/dash_vm/src/dispatch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1474,7 +1474,7 @@ mod handlers {
}

pub fn staticpropertyaccess<'sc, 'vm>(mut cx: DispatchContext<'sc, 'vm>) -> Result<Option<HandleResult>, Unrooted> {
let id = cx.fetch_and_inc_ip();
let id = cx.fetchw_and_inc_ip();
let ident = cx.identifier_constant(id.into());

let preserve_this = cx.fetch_and_inc_ip() == 1;
Expand Down

0 comments on commit c175698

Please sign in to comment.