Chromium Code Reviews

Unified Diff: src/assembler.h

Issue 2039233005: Consider reloc info mode when merging constant pool entries Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
« no previous file with comments | « src/arm/macro-assembler-arm.cc ('k') | src/assembler.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/assembler.h
diff --git a/src/assembler.h b/src/assembler.h
index 3670d7fa5c5ca24026b22a235b02b2e7acb7243a..d181e2a5960cb2644cab323eed34ed15764bb610 100644
--- a/src/assembler.h
+++ b/src/assembler.h
@@ -426,6 +426,7 @@ class RelocInfo {
NUMBER_OF_MODES,
NONE32, // never recorded 32-bit value
NONE64, // never recorded 64-bit value
+ NONEINTPTR, // never recorded intptr value
CODE_AGE_SEQUENCE, // Not stored in RelocInfo array, used explictly by
// code aging.
@@ -515,7 +516,7 @@ class RelocInfo {
return mode == DEBUGGER_STATEMENT;
}
static inline bool IsNone(Mode mode) {
- return mode == NONE32 || mode == NONE64;
+ return mode == NONE32 || mode == NONE64 || mode == NONEINTPTR;
}
static inline bool IsCodeAgeSequence(Mode mode) {
return mode == CODE_AGE_SEQUENCE;
@@ -1229,12 +1230,19 @@ class CheckDebugStepCallWrapper : public CallWrapper {
class ConstantPoolEntry {
public:
ConstantPoolEntry() {}
- ConstantPoolEntry(int position, intptr_t value, bool sharing_ok)
+ ConstantPoolEntry(int position, intptr_t value, bool sharing_ok,
+ RelocInfo::Mode rmode)
: position_(position),
merged_index_(sharing_ok ? SHARING_ALLOWED : SHARING_PROHIBITED),
+ rmode_(rmode),
+ type_(INTPTR),
value_(value) {}
ConstantPoolEntry(int position, double value)
- : position_(position), merged_index_(SHARING_ALLOWED), value64_(value) {}
+ : position_(position),
+ merged_index_(SHARING_ALLOWED),
+ rmode_(RelocInfo::NONE64),
+ type_(DOUBLE),
+ value64_(value) {}
int position() const { return position_; }
bool sharing_ok() const { return merged_index_ != SHARING_PROHIBITED; }
@@ -1257,18 +1265,29 @@ class ConstantPoolEntry {
}
intptr_t value() const { return value_; }
uint64_t value64() const { return bit_cast<uint64_t>(value64_); }
+ bool MayBeMergedWith(ConstantPoolEntry& other) const {
+ return type_ == other.type_ && rmode_ == other.rmode_ &&
+ (type_ == INTPTR ? value() == other.value()
+ : value64() == other.value64());
+ }
enum Type { INTPTR, DOUBLE, NUMBER_OF_TYPES };
- static int size(Type type) {
+ Type type() const { return type_; }
+
+ static int SizeOfType(Type type) {
return (type == INTPTR) ? kPointerSize : kDoubleSize;
}
+ int size() const { return SizeOfType(type_); }
+
enum Access { REGULAR, OVERFLOWED };
private:
int position_;
int merged_index_;
+ RelocInfo::Mode rmode_;
+ Type type_;
union {
intptr_t value_;
double value64_;
@@ -1285,16 +1304,17 @@ class ConstantPoolBuilder BASE_EMBEDDED {
ConstantPoolBuilder(int ptr_reach_bits, int double_reach_bits);
// Add pointer-sized constant to the embedded constant pool
- ConstantPoolEntry::Access AddEntry(int position, intptr_t value,
- bool sharing_ok) {
- ConstantPoolEntry entry(position, value, sharing_ok);
- return AddEntry(entry, ConstantPoolEntry::INTPTR);
+ ConstantPoolEntry::Access AddEntry(
+ int position, intptr_t value, bool sharing_ok,
+ RelocInfo::Mode rmode = RelocInfo::NONEINTPTR) {
+ ConstantPoolEntry entry(position, value, sharing_ok, rmode);
+ return AddEntry(entry);
}
// Add double constant to the embedded constant pool
ConstantPoolEntry::Access AddEntry(int position, double value) {
ConstantPoolEntry entry(position, value);
- return AddEntry(entry, ConstantPoolEntry::DOUBLE);
+ return AddEntry(entry);
}
// Previews the access type required for the next new entry to be added.
@@ -1319,8 +1339,7 @@ class ConstantPoolBuilder BASE_EMBEDDED {
inline Label* EmittedPosition() { return &emitted_label_; }
private:
- ConstantPoolEntry::Access AddEntry(ConstantPoolEntry& entry,
- ConstantPoolEntry::Type type);
+ ConstantPoolEntry::Access AddEntry(ConstantPoolEntry& entry);
void EmitSharedEntries(Assembler* assm, ConstantPoolEntry::Type type);
void EmitGroup(Assembler* assm, ConstantPoolEntry::Access access,
ConstantPoolEntry::Type type);
« no previous file with comments | « src/arm/macro-assembler-arm.cc ('k') | src/assembler.cc » ('j') | no next file with comments »

Powered by Google App Engine