5 #ifndef V8_CONSTANT_POOL_H_ 6 #define V8_CONSTANT_POOL_H_ 10 #include "src/double.h" 11 #include "src/globals.h" 12 #include "src/label.h" 13 #include "src/reloc-info.h" 25 RelocInfo::Mode rmode = RelocInfo::NONE)
26 : position_(position),
27 merged_index_(sharing_ok ? SHARING_ALLOWED : SHARING_PROHIBITED),
31 RelocInfo::Mode rmode = RelocInfo::NONE)
32 : position_(position),
33 merged_index_(SHARING_ALLOWED),
34 value64_(value.AsUint64()),
37 int position()
const {
return position_; }
38 bool sharing_ok()
const {
return merged_index_ != SHARING_PROHIBITED; }
39 bool is_merged()
const {
return merged_index_ >= 0; }
40 int merged_index()
const {
44 void set_merged_index(
int index) {
46 merged_index_ = index;
50 DCHECK_GE(merged_index_, 0);
53 void set_offset(
int offset) {
55 merged_index_ = offset;
57 intptr_t value()
const {
return value_; }
58 uint64_t value64()
const {
return value64_; }
59 RelocInfo::Mode rmode()
const {
return rmode_; }
61 enum Type { INTPTR, DOUBLE, NUMBER_OF_TYPES };
63 static int size(Type
type) {
64 return (
type == INTPTR) ? kPointerSize : kDoubleSize;
67 enum Access { REGULAR, OVERFLOWED };
78 RelocInfo::Mode rmode_;
79 enum { SHARING_PROHIBITED = -2, SHARING_ALLOWED = -1 };
82 #if defined(V8_TARGET_ARCH_PPC) 87 class ConstantPoolBuilder {
89 ConstantPoolBuilder(
int ptr_reach_bits,
int double_reach_bits);
92 ConstantPoolEntry::Access AddEntry(
int position, intptr_t value,
95 return AddEntry(entry, ConstantPoolEntry::INTPTR);
99 ConstantPoolEntry::Access AddEntry(
int position, Double value) {
100 ConstantPoolEntry entry(position, value);
101 return AddEntry(entry, ConstantPoolEntry::DOUBLE);
105 ConstantPoolEntry::Access AddEntry(
int position,
double value) {
106 return AddEntry(position, Double(value));
110 ConstantPoolEntry::Access NextAccess(ConstantPoolEntry::Type type)
const;
113 return info_[ConstantPoolEntry::INTPTR].entries.empty() &&
114 info_[ConstantPoolEntry::INTPTR].shared_entries.empty() &&
115 info_[ConstantPoolEntry::DOUBLE].entries.empty() &&
116 info_[ConstantPoolEntry::DOUBLE].shared_entries.empty();
122 int Emit(Assembler* assm);
128 inline Label* EmittedPosition() {
return &emitted_label_; }
131 ConstantPoolEntry::Access AddEntry(ConstantPoolEntry& entry,
132 ConstantPoolEntry::Type type);
133 void EmitSharedEntries(Assembler* assm, ConstantPoolEntry::Type type);
134 void EmitGroup(Assembler* assm, ConstantPoolEntry::Access access,
135 ConstantPoolEntry::Type type);
137 struct PerTypeEntryInfo {
138 PerTypeEntryInfo() : regular_count(0), overflow_start(-1) {}
139 bool overflow()
const {
140 return (overflow_start >= 0 &&
141 overflow_start < static_cast<int>(entries.size()));
143 int regular_reach_bits;
146 std::vector<ConstantPoolEntry> entries;
147 std::vector<ConstantPoolEntry> shared_entries;
150 Label emitted_label_;
151 PerTypeEntryInfo info_[ConstantPoolEntry::NUMBER_OF_TYPES];
154 #endif // defined(V8_TARGET_ARCH_PPC) 159 #endif // V8_CONSTANT_POOL_H_