Skip to content

Commit

Permalink
[ic] Avoid feedback metadata names table reallocations.
Browse files Browse the repository at this point in the history
An attempt to fix memory regression (r38047) caused another regression
because custom capacity chosen for names dictionary implied reallocations
during initialization in some cases.

BUG=chromium:625894,chromium:632231

Review-Url: https://codereview.chromium.org/2394873002
Cr-Commit-Position: refs/heads/master@{#40006}
  • Loading branch information
isheludko authored and Commit bot committed Oct 5, 2016
1 parent 7a82be3 commit c56222c
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/type-feedback-vector.cc
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,7 @@ Handle<TypeFeedbackMetadata> TypeFeedbackMetadata::New(Isolate* isolate,

Handle<UnseededNumberDictionary> names;
if (name_count) {
names = UnseededNumberDictionary::New(
isolate, base::bits::RoundUpToPowerOfTwo32(name_count), TENURED,
USE_CUSTOM_MINIMUM_CAPACITY);
names = UnseededNumberDictionary::New(isolate, name_count, TENURED);
}

int name_index = 0;
Expand All @@ -114,7 +112,10 @@ Handle<TypeFeedbackMetadata> TypeFeedbackMetadata::New(Isolate* isolate,
if (SlotRequiresName(kind)) {
Handle<String> name = spec->GetName(name_index);
DCHECK(!name.is_null());
names = UnseededNumberDictionary::AtNumberPut(names, i, name);
Handle<UnseededNumberDictionary> new_names =
UnseededNumberDictionary::AtNumberPut(names, i, name);
DCHECK_EQ(*new_names, *names);
names = new_names;
name_index++;
}
}
Expand Down

0 comments on commit c56222c

Please sign in to comment.