Commit 13ed3e38 authored by Sigurd Schneider's avatar Sigurd Schneider Committed by Commit Bot

[arm] Simplify constant pool implementation

Bug: v8:6666
Change-Id: I577c2ac89e8247d6fc90f1e9dbd0ef14a14fbddc
Reviewed-on: https://chromium-review.googlesource.com/1163246
Commit-Queue: Sigurd Schneider <sigurds@chromium.org>
Reviewed-by: 's avatarJakob Gruber <jgruber@chromium.org>
Cr-Commit-Position: refs/heads/master@{#54916}
parent 5414884a
...@@ -5108,14 +5108,17 @@ void Assembler::RecordRelocInfo(RelocInfo::Mode rmode, intptr_t data) { ...@@ -5108,14 +5108,17 @@ void Assembler::RecordRelocInfo(RelocInfo::Mode rmode, intptr_t data) {
void Assembler::ConstantPoolAddEntry(int position, RelocInfo::Mode rmode, void Assembler::ConstantPoolAddEntry(int position, RelocInfo::Mode rmode,
intptr_t value) { intptr_t value) {
DCHECK(rmode != RelocInfo::COMMENT && rmode != RelocInfo::CONST_POOL); DCHECK(rmode != RelocInfo::COMMENT && rmode != RelocInfo::CONST_POOL);
bool sharing_ok = // We can share CODE_TARGETs because we don't patch the code objects anymore,
RelocInfo::IsNone(rmode) || RelocInfo::IsShareableRelocMode(rmode); // and we make sure we emit only one reloc info for them (thus delta patching)
// will apply the delta only once. At the moment, we do not dedup code targets
// if they are wrapped in a heap object request (value == 0).
bool sharing_ok = RelocInfo::IsShareableRelocMode(rmode) ||
(rmode == RelocInfo::CODE_TARGET && value != 0);
DCHECK_LT(pending_32_bit_constants_.size(), kMaxNumPending32Constants); DCHECK_LT(pending_32_bit_constants_.size(), kMaxNumPending32Constants);
if (pending_32_bit_constants_.empty()) { if (pending_32_bit_constants_.empty()) {
first_const_pool_32_use_ = position; first_const_pool_32_use_ = position;
} }
ConstantPoolEntry entry( ConstantPoolEntry entry(position, value, sharing_ok, rmode);
position, value, sharing_ok || (rmode == RelocInfo::CODE_TARGET), rmode);
bool shared = false; bool shared = false;
if (sharing_ok) { if (sharing_ok) {
...@@ -5132,24 +5135,6 @@ void Assembler::ConstantPoolAddEntry(int position, RelocInfo::Mode rmode, ...@@ -5132,24 +5135,6 @@ void Assembler::ConstantPoolAddEntry(int position, RelocInfo::Mode rmode,
} }
} }
// Share entries if allowed and possible.
// Null-values are placeholders and must be ignored.
if (rmode == RelocInfo::CODE_TARGET && value != 0) {
// Sharing entries here relies on canonicalized handles - without them, we
// will miss the optimisation opportunity.
Address handle_address = static_cast<Address>(value);
auto existing = handle_to_index_map_.find(handle_address);
if (existing != handle_to_index_map_.end()) {
int index = existing->second;
entry.set_merged_index(index);
shared = true;
} else {
// Keep track of this code handle.
handle_to_index_map_[handle_address] =
static_cast<int>(pending_32_bit_constants_.size());
}
}
pending_32_bit_constants_.push_back(entry); pending_32_bit_constants_.push_back(entry);
// Make sure the constant pool is not emitted in place of the next // Make sure the constant pool is not emitted in place of the next
...@@ -5387,7 +5372,6 @@ void Assembler::CheckConstPool(bool force_emit, bool require_jump) { ...@@ -5387,7 +5372,6 @@ void Assembler::CheckConstPool(bool force_emit, bool require_jump) {
pending_32_bit_constants_.clear(); pending_32_bit_constants_.clear();
pending_64_bit_constants_.clear(); pending_64_bit_constants_.clear();
handle_to_index_map_.clear();
first_const_pool_32_use_ = -1; first_const_pool_32_use_ = -1;
first_const_pool_64_use_ = -1; first_const_pool_64_use_ = -1;
......
...@@ -1621,9 +1621,6 @@ class V8_EXPORT_PRIVATE Assembler : public AssemblerBase { ...@@ -1621,9 +1621,6 @@ class V8_EXPORT_PRIVATE Assembler : public AssemblerBase {
std::vector<ConstantPoolEntry> pending_32_bit_constants_; std::vector<ConstantPoolEntry> pending_32_bit_constants_;
std::vector<ConstantPoolEntry> pending_64_bit_constants_; std::vector<ConstantPoolEntry> pending_64_bit_constants_;
// Map of address of handle to index in pending_32_bit_constants_.
std::map<Address, int> handle_to_index_map_;
// Scratch registers available for use by the Assembler. // Scratch registers available for use by the Assembler.
RegList scratch_register_list_; RegList scratch_register_list_;
VfpRegList scratch_vfp_register_list_; VfpRegList scratch_vfp_register_list_;
......
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