Commit 85a3e244 authored by Michael Starzinger's avatar Michael Starzinger Committed by Commit Bot

[assembler] Make {RelocInfo::WASM_STUB_CALL} shareable.

This makes sure that reloc entries with WASM_STUB_CALL mode can be
shared within the constant pool. Call sites to such stubs never need to
be patched individually and absolute addresses of such call targets can
be shared when they are put into constant pools.

This applies to ARM, ARM64 and PPC architectures only.

R=clemensh@chromium.org
BUG=chromium:850413

Change-Id: I657248f61f122f1a3d6d30ebd14326df45f67540
Reviewed-on: https://chromium-review.googlesource.com/1091055Reviewed-by: 's avatarClemens Hammacher <clemensh@chromium.org>
Commit-Queue: Michael Starzinger <mstarzinger@chromium.org>
Cr-Commit-Position: refs/heads/master@{#53603}
parent 6b50454d
......@@ -5147,8 +5147,8 @@ void Assembler::RecordRelocInfo(RelocInfo::Mode rmode, intptr_t data) {
void Assembler::ConstantPoolAddEntry(int position, RelocInfo::Mode rmode,
intptr_t value) {
DCHECK(rmode != RelocInfo::COMMENT && rmode != RelocInfo::CONST_POOL);
bool sharing_ok = RelocInfo::IsNone(rmode) ||
(rmode >= RelocInfo::FIRST_SHAREABLE_RELOC_MODE);
bool sharing_ok =
RelocInfo::IsNone(rmode) || RelocInfo::IsShareableRelocMode(rmode);
DCHECK_LT(pending_32_bit_constants_.size(), kMaxNumPending32Constants);
if (pending_32_bit_constants_.empty()) {
first_const_pool_32_use_ = position;
......
......@@ -466,8 +466,7 @@ void ConstPool::Clear() {
bool ConstPool::CanBeShared(RelocInfo::Mode mode) {
return RelocInfo::IsNone(mode) ||
(mode >= RelocInfo::FIRST_SHAREABLE_RELOC_MODE);
return RelocInfo::IsNone(mode) || RelocInfo::IsShareableRelocMode(mode);
}
......
......@@ -362,12 +362,15 @@ class RelocInfo {
static const int kMaxSmallPCDelta;
enum Mode : int8_t {
// Please note the order is important (see IsCodeTarget, IsGCRelocMode).
CODE_TARGET,
EMBEDDED_OBJECT,
WASM_CALL,
WASM_STUB_CALL,
// Please note the order is important (see IsRealRelocMode, IsCodeTarget,
// IsGCRelocMode, and IsShareableRelocMode predicates below).
CODE_TARGET, // LAST_CODE_ENUM
EMBEDDED_OBJECT, // LAST_GCED_ENUM
JS_TO_WASM_CALL,
WASM_CALL,
WASM_STUB_CALL, // FIRST_SHAREABLE_RELOC_MODE
RUNTIME_ENTRY,
COMMENT,
......@@ -407,7 +410,7 @@ class RelocInfo {
LAST_REAL_RELOC_MODE = VENEER_POOL,
LAST_CODE_ENUM = CODE_TARGET,
LAST_GCED_ENUM = EMBEDDED_OBJECT,
FIRST_SHAREABLE_RELOC_MODE = RUNTIME_ENTRY,
FIRST_SHAREABLE_RELOC_MODE = WASM_STUB_CALL,
};
STATIC_ASSERT(NUMBER_OF_MODES <= kBitsPerInt);
......@@ -428,6 +431,11 @@ class RelocInfo {
static inline bool IsCodeTarget(Mode mode) {
return mode <= LAST_CODE_ENUM;
}
// Is the relocation mode affected by GC?
static inline bool IsGCRelocMode(Mode mode) { return mode <= LAST_GCED_ENUM; }
static inline bool IsShareableRelocMode(Mode mode) {
return mode >= RelocInfo::FIRST_SHAREABLE_RELOC_MODE;
}
static inline bool IsEmbeddedObject(Mode mode) {
return mode == EMBEDDED_OBJECT;
}
......@@ -438,10 +446,6 @@ class RelocInfo {
static inline bool IsWasmStubCall(Mode mode) {
return mode == WASM_STUB_CALL;
}
// Is the relocation mode affected by GC?
static inline bool IsGCRelocMode(Mode mode) {
return mode <= LAST_GCED_ENUM;
}
static inline bool IsComment(Mode mode) {
return mode == COMMENT;
}
......
......@@ -1455,10 +1455,10 @@ class Assembler : public AssemblerBase {
void RecordRelocInfo(RelocInfo::Mode rmode, intptr_t data = 0);
ConstantPoolEntry::Access ConstantPoolAddEntry(RelocInfo::Mode rmode,
intptr_t value) {
bool sharing_ok = RelocInfo::IsNone(rmode) ||
!(serializer_enabled() ||
rmode < RelocInfo::FIRST_SHAREABLE_RELOC_MODE ||
is_constant_pool_entry_sharing_blocked());
bool sharing_ok =
RelocInfo::IsNone(rmode) ||
(!serializer_enabled() && RelocInfo::IsShareableRelocMode(rmode) &&
!is_constant_pool_entry_sharing_blocked());
return constant_pool_builder_.AddEntry(pc_offset(), value, sharing_ok);
}
ConstantPoolEntry::Access ConstantPoolAddEntry(Double value) {
......
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