v8/v8
0

[arm64] Use Abseil's btree_map for unresolved branches

Use Abseil's fast map container for unresolved branches in the
assembler.

Change-Id: I2b7e5d4407bd8e61102634e675dbabe895f65327
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/4720550
Reviewed-by: Clemens Backes <clemensb@chromium.org>
Commit-Queue: Toon Verwaest <verwaest@chromium.org>
Cr-Commit-Position: refs/heads/main@{#91335}
This commit is contained in:
Martyn Capewell
2023-12-01 19:16:14 +00:00
committed by V8 LUCI CQ
parent 5788630379
commit ef823401eb
5 changed files with 10 additions and 3 deletions

@ -3996,6 +3996,7 @@ v8_library(
deps = [
":v8_libbase",
"//external:base_trace_event_common",
"//external:absl_btree",
"//external:absl_flat_hash_map",
"//external:absl_flat_hash_set",
],

1
DEPS

@ -340,6 +340,7 @@ include_rules = [
# https://chromium.googlesource.com/chromium/src/+/main/styleguide/c++/c++11.md
'+absl/container/flat_hash_map.h',
'+absl/container/flat_hash_set.h',
'+absl/container/btree_map.h',
'+absl/types/optional.h',
'+absl/types/variant.h',
'+absl/status',

@ -44,6 +44,11 @@ bind(
actual = "@com_google_absl//absl/types:optional"
)
bind(
name = "absl_btree",
actual = "@com_google_absl//absl/container:btree"
)
bind(
name = "absl_flat_hash_map",
actual = "@com_google_absl//absl/container:flat_hash_map"

@ -4709,8 +4709,7 @@ void Assembler::EmitVeneers(bool force_emit, bool need_protection,
pc_offset -= Instruction::ImmBranchRange(CondBranchType);
}
tasks.emplace_back(FarBranchInfo{pc_offset, it->second});
auto eraser_it = it++;
unresolved_branches_.erase(eraser_it);
it = unresolved_branches_.erase(it);
}
}

@ -9,6 +9,7 @@
#include <map>
#include <memory>
#include "absl/container/btree_map.h"
#include "src/base/optional.h"
#include "src/codegen/arm64/constants-arm64.h"
#include "src/codegen/arm64/instructions-arm64.h"
@ -3350,7 +3351,7 @@ class V8_EXPORT_PRIVATE Assembler : public AssemblerBase {
// Note that the maximum reachable offset (first member of the pairs) should
// always be positive but has the same type as the return value for
// pc_offset() for convenience.
std::map<int, Label*> unresolved_branches_;
absl::btree_map<int, Label*> unresolved_branches_;
// We generate a veneer for a branch if we reach within this distance of the
// limit of the range.