Truly independent web browser
LibJS: Move no argument into itself after updating it
Andreas Kling727384e10597
diff --git a/Libraries/LibJS/Rust/src/bytecode/codegen.rs b/Libraries/LibJS/Rust/src/bytecode/codegen.rsindex a790c74d009..2b22512c177 100644--- a/Libraries/LibJS/Rust/src/bytecode/codegen.rs+++ b/Libraries/LibJS/Rust/src/bytecode/codegen.rs@@ -5161,11 +5161,8 @@ fn emit_set_variable(generator: &mut Generator, id: crate::ast::IdentifierId, va}let local_index = ident.local_index;let local = generator.resolve_local(local_index, ident.local_type.unwrap());- // Skip self-move entirely.- let is_variable_self_move = ident.local_type == Some(LocalType::Variable)- && value.operand().is_local()- && value.operand().index() == local_index;- if is_variable_self_move {+ // Skip self-move entirely, of variables and arguments alike.+ if local.operand() == value.operand() {return;}// No TDZ check here: the caller is responsible for checking TDZdiff --git a/Tests/LibJS/Bytecode/expected/argument-postfix-self-move.txt b/Tests/LibJS/Bytecode/expected/argument-postfix-self-move.txtindex e4c43e83966..5091a00967f 100644--- a/Tests/LibJS/Bytecode/expected/argument-postfix-self-move.txt+++ b/Tests/LibJS/Bytecode/expected/argument-postfix-self-move.txt@@ -12,12 +12,11 @@ block0:[ 40] End value:reg5-f$01d98a5f argument-postfix-self-move.js:2:6+f$049d7b6f argument-postfix-self-move.js:2:6Registers: 6Blocks: 1block0:[ 0] Enter[ 8] PostfixDecrement arith_feedback:0, dst:reg5, src:arg0- [ 18] Mov dst:arg0, src:arg0- [ 28] Return value:arg0+ [ 18] Return value:arg0diff --git a/Tests/LibJS/Bytecode/expected/postfix-update-in-logical-and.txt b/Tests/LibJS/Bytecode/expected/postfix-update-in-logical-and.txtindex 0d71159b7f2..1aa721216b0 100644--- a/Tests/LibJS/Bytecode/expected/postfix-update-in-logical-and.txt+++ b/Tests/LibJS/Bytecode/expected/postfix-update-in-logical-and.txt@@ -12,7 +12,7 @@ block0:[ 40] End value:reg5-postfixInLogicalAnd$80fa793a postfix-update-in-logical-and.js:2:5+postfixInLogicalAnd$ff9880b2 postfix-update-in-logical-and.js:2:5Registers: 8Blocks: 3Constants:@@ -26,7 +26,7 @@ block0:block1:[ 38] PostfixDecrement arith_feedback:1, dst:reg7, src:arg0- [ 48] Mov2 c0_dst:arg0, c0_src:arg0, c1_dst:reg6, c1_src:reg7+ [ 48] Mov dst:reg6, src:reg7block2:- [ 60] Return value:reg6+ [ 58] Return value:reg6