Commit f3b7f21c authored by leszeks's avatar leszeks Committed by Commit bot

[turbofan] Reserve the StateValueList's size before filling it

Avoid needless resizing of the StateValueList's fields vector by
reserving its (already known) size.

Review-Url: https://codereview.chromium.org/2572683005
Cr-Commit-Position: refs/heads/master@{#41698}
parent e521757f
......@@ -555,6 +555,11 @@ size_t InstructionSelector::AddInputsToFrameStateDescriptor(
DCHECK_EQ(descriptor->stack_count(), StateValuesAccess(stack).size());
StateValueList* values_descriptor = descriptor->GetStateValueDescriptors();
DCHECK_EQ(values_descriptor->size(), 0u);
values_descriptor->ReserveSize(
descriptor->GetSize(OutputFrameStateCombine::Ignore()));
entries += AddOperandToStateValueDescriptor(
values_descriptor, inputs, g, deduplicator, function,
MachineType::AnyTagged(), FrameStateInputKind::kStackSlot, zone);
......
......@@ -1197,6 +1197,8 @@ class StateValueList {
ZoneVector<StateValueList*>::iterator nested_iterator;
};
void ReserveSize(size_t size) { fields_.reserve(size); }
StateValueList* PushRecursiveField(Zone* zone, size_t id) {
fields_.push_back(StateValueDescriptor::Recursive(id));
StateValueList* nested =
......
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