Commit 518a39dd authored by Camillo Bruni's avatar Camillo Bruni Committed by Commit Bot

[cleanup] Use FixedArray::set(int, Smi) directly where possible

We can directly skip the write barrier in the case we set only a Smi.

Change-Id: Ic2f4f13f9edb851a18878bec14981a2ad7687433
Reviewed-on: https://chromium-review.googlesource.com/c/1444957Reviewed-by: 's avatarMarja Hölttä <marja@chromium.org>
Commit-Queue: Camillo Bruni <cbruni@chromium.org>
Cr-Commit-Position: refs/heads/master@{#59197}
parent c3e93c10
......@@ -1166,7 +1166,7 @@ class ElementsAccessorBase : public InternalElementsAccessor {
isolate->factory()->Uint32ToString(i, use_cache);
list->set(insertion_index, *index_string);
} else {
list->set(insertion_index, Smi::FromInt(i), SKIP_WRITE_BARRIER);
list->set(insertion_index, Smi::FromInt(i));
}
insertion_index++;
}
......@@ -3753,7 +3753,7 @@ class SloppyArgumentsElementsAccessor
Handle<String> index_string = isolate->factory()->Uint32ToString(i);
list->set(insertion_index, *index_string);
} else {
list->set(insertion_index, Smi::FromInt(i), SKIP_WRITE_BARRIER);
list->set(insertion_index, Smi::FromInt(i));
}
insertion_index++;
}
......
......@@ -213,21 +213,21 @@ Handle<ScopeInfo> ScopeInfo::Create(Isolate* isolate, Zone* zone, Scope* scope,
ParameterNumberField::encode(ParameterNumberField::kMax);
scope_info->set(context_local_base + local_index, *var->name(), mode);
scope_info->set(context_local_info_base + local_index,
Smi::FromInt(info), mode);
Smi::FromInt(info));
break;
}
case VariableLocation::MODULE: {
scope_info->set(module_var_entry + kModuleVariableNameOffset,
*var->name(), mode);
scope_info->set(module_var_entry + kModuleVariableIndexOffset,
Smi::FromInt(var->index()), mode);
Smi::FromInt(var->index()));
uint32_t properties =
VariableModeField::encode(var->mode()) |
InitFlagField::encode(var->initialization_flag()) |
MaybeAssignedFlagField::encode(var->maybe_assigned()) |
ParameterNumberField::encode(ParameterNumberField::kMax);
scope_info->set(module_var_entry + kModuleVariablePropertiesOffset,
Smi::FromInt(properties), mode);
Smi::FromInt(properties));
module_var_entry += kModuleVariableEntryLength;
break;
}
......@@ -251,7 +251,7 @@ Handle<ScopeInfo> ScopeInfo::Create(Isolate* isolate, Zone* zone, Scope* scope,
int info_index = context_local_info_base + index;
int info = Smi::ToInt(scope_info->get(info_index));
info = ParameterNumberField::update(info, i);
scope_info->set(info_index, Smi::FromInt(info), mode);
scope_info->set(info_index, Smi::FromInt(info));
}
}
......@@ -261,7 +261,7 @@ Handle<ScopeInfo> ScopeInfo::Create(Isolate* isolate, Zone* zone, Scope* scope,
DCHECK_EQ(index, scope_info->ReceiverInfoIndex());
if (has_receiver) {
int var_index = scope->AsDeclarationScope()->receiver()->index();
scope_info->set(index++, Smi::FromInt(var_index), mode);
scope_info->set(index++, Smi::FromInt(var_index));
// ?? DCHECK(receiver_info != CONTEXT || var_index ==
// scope_info->ContextLength() - 1);
}
......@@ -277,7 +277,7 @@ Handle<ScopeInfo> ScopeInfo::Create(Isolate* isolate, Zone* zone, Scope* scope,
name = *var->name();
}
scope_info->set(index++, name, mode);
scope_info->set(index++, Smi::FromInt(var_index), mode);
scope_info->set(index++, Smi::FromInt(var_index));
DCHECK(function_name_info != CONTEXT ||
var_index == scope_info->ContextLength() - 1);
}
......@@ -290,8 +290,8 @@ Handle<ScopeInfo> ScopeInfo::Create(Isolate* isolate, Zone* zone, Scope* scope,
DCHECK_EQ(index, scope_info->PositionInfoIndex());
if (has_position_info) {
scope_info->set(index++, Smi::FromInt(scope->start_position()), mode);
scope_info->set(index++, Smi::FromInt(scope->end_position()), mode);
scope_info->set(index++, Smi::FromInt(scope->start_position()));
scope_info->set(index++, Smi::FromInt(scope->end_position()));
}
// If present, add the outer scope info.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment