Preallocate sample buffer to avoid resizes

R=ofrobots@google.com
BUG=

Review URL: https://codereview.chromium.org/1712893002

Cr-Commit-Position: refs/heads/master@{#34161}
This commit is contained in:
mattloring 2016-02-19 07:57:41 -08:00 committed by Commit bot
parent 4f0be51987
commit 6997220817

View File

@ -182,6 +182,7 @@ v8::AllocationProfile::Node* SamplingHeapProfiler::TranslateAllocationNode(
int line = v8::AllocationProfile::kNoLineNumberInfo;
int column = v8::AllocationProfile::kNoColumnNumberInfo;
std::vector<v8::AllocationProfile::Allocation> allocations;
allocations.reserve(node->allocations_.size());
if (node->script_id_ != v8::UnboundScript::kNoScriptId) {
// Cannot use std::map<T>::at because it is not available on android.
auto non_const_scripts = const_cast<std::map<int, Script*>&>(scripts);