mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-05-02 01:12:32 +00:00
LibJS/JIT: Add fastpath for set variable
This commit is contained in:
committed by
Andreas Kling
parent
b3cbe0fdb9
commit
84eecbb10e
@@ -264,10 +264,13 @@ ThrowCompletionOr<void> set_variable(
|
||||
DeprecatedFlyString const& name,
|
||||
Value value,
|
||||
Op::EnvironmentMode mode,
|
||||
Op::SetVariable::InitializationMode initialization_mode)
|
||||
Op::SetVariable::InitializationMode initialization_mode,
|
||||
EnvironmentVariableCache& cache)
|
||||
{
|
||||
auto environment = mode == Op::EnvironmentMode::Lexical ? vm.running_execution_context().lexical_environment : vm.running_execution_context().variable_environment;
|
||||
auto reference = TRY(vm.resolve_binding(name, environment));
|
||||
if (reference.environment_coordinate().has_value())
|
||||
cache = reference.environment_coordinate();
|
||||
switch (initialization_mode) {
|
||||
case Op::SetVariable::InitializationMode::Initialize:
|
||||
TRY(reference.initialize_referenced_binding(vm, value));
|
||||
|
||||
Reference in New Issue
Block a user