ARM64: Avoid iterating through unresolved branches information when unnecessary.

R=ulan@chromium.org

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@20444 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
alexandre.rames@arm.com 2014-04-02 16:31:58 +00:00
parent a6d6cd08a1
commit 03a4e5fc78

View File

@ -456,6 +456,8 @@ void Assembler::bind(Label* label) {
ASSERT(!label->is_near_linked()); ASSERT(!label->is_near_linked());
ASSERT(!label->is_bound()); ASSERT(!label->is_bound());
DeleteUnresolvedBranchInfoForLabel(label);
// If the label is linked, the link chain looks something like this: // If the label is linked, the link chain looks something like this:
// //
// |--I----I-------I-------L // |--I----I-------I-------L
@ -497,8 +499,6 @@ void Assembler::bind(Label* label) {
ASSERT(label->is_bound()); ASSERT(label->is_bound());
ASSERT(!label->is_linked()); ASSERT(!label->is_linked());
DeleteUnresolvedBranchInfoForLabel(label);
} }
@ -551,14 +551,16 @@ void Assembler::DeleteUnresolvedBranchInfoForLabel(Label* label) {
return; return;
} }
// Branches to this label will be resolved when the label is bound below. if (label->is_linked()) {
std::multimap<int, FarBranchInfo>::iterator it_tmp, it; // Branches to this label will be resolved when the label is bound below.
it = unresolved_branches_.begin(); std::multimap<int, FarBranchInfo>::iterator it_tmp, it;
while (it != unresolved_branches_.end()) { it = unresolved_branches_.begin();
it_tmp = it++; while (it != unresolved_branches_.end()) {
if (it_tmp->second.label_ == label) { it_tmp = it++;
CHECK(it_tmp->first >= pc_offset()); if (it_tmp->second.label_ == label) {
unresolved_branches_.erase(it_tmp); CHECK(it_tmp->first >= pc_offset());
unresolved_branches_.erase(it_tmp);
}
} }
} }
if (unresolved_branches_.empty()) { if (unresolved_branches_.empty()) {