Index: src/safepoint-table.h |
diff --git a/src/safepoint-table.h b/src/safepoint-table.h |
index d92018c22c742055f01115580a385997553a49c4..62cf423685351cd2eb0d527a5b9d4e55412a54c3 100644 |
--- a/src/safepoint-table.h |
+++ b/src/safepoint-table.h |
@@ -30,56 +30,100 @@ |
#include "v8.h" |
-#include "macro-assembler.h" |
+#include "heap.h" |
#include "zone.h" |
#include "zone-inl.h" |
namespace v8 { |
namespace internal { |
-class SafepointTable BASE_EMBEDDED { |
+struct Register; |
+ |
+class SafepointEntry BASE_EMBEDDED { |
public: |
- explicit SafepointTable(Code* code); |
+ SafepointEntry() : info_(0), bits_(NULL) {} |
- int size() const { |
- return kHeaderSize + |
- (length_ * (kPcAndDeoptimizationIndexSize + entry_size_)); } |
- unsigned length() const { return length_; } |
- unsigned entry_size() const { return entry_size_; } |
+ SafepointEntry(unsigned info, uint8_t* bits) : info_(info), bits_(bits) {} |
- unsigned GetPcOffset(unsigned index) const { |
- ASSERT(index < length_); |
- return Memory::uint32_at(GetPcOffsetLocation(index)); |
+ bool is_valid() const { return bits_ != NULL; } |
+ |
+ bool Equals(const SafepointEntry& other) const { |
+ return info_ == other.info_ && bits_ == other.bits_; |
} |
- int GetDeoptimizationIndex(unsigned index) const { |
- ASSERT(index < length_); |
- unsigned value = Memory::uint32_at(GetDeoptimizationLocation(index)); |
- return DeoptimizationIndexField::decode(value); |
+ void Reset() { |
+ info_ = 0; |
+ bits_ = NULL; |
} |
- unsigned GetGapCodeSize(unsigned index) const { |
- ASSERT(index < length_); |
- unsigned value = Memory::uint32_at(GetDeoptimizationLocation(index)); |
- return GapCodeSizeField::decode(value); |
+ int deoptimization_index() const { |
+ ASSERT(is_valid()); |
+ return DeoptimizationIndexField::decode(info_); |
} |
- uint8_t* GetEntry(unsigned index) const { |
- ASSERT(index < length_); |
- return &Memory::uint8_at(entries_ + (index * entry_size_)); |
+ int gap_code_size() const { |
+ ASSERT(is_valid()); |
+ return GapCodeSizeField::decode(info_); |
+ } |
+ |
+ int argument_count() const { |
+ ASSERT(is_valid()); |
+ return ArgumentsField::decode(info_); |
+ } |
+ |
+ uint8_t* bits() { |
+ ASSERT(is_valid()); |
+ return bits_; |
} |
+ bool HasRegisters() const; |
+ bool HasRegisterAt(int reg_index) const; |
+ |
// Reserve 13 bits for the gap code size. On ARM a constant pool can be |
// emitted when generating the gap code. The size of the const pool is less |
// than what can be represented in 12 bits, so 13 bits gives room for having |
// instructions before potentially emitting a constant pool. |
static const int kGapCodeSizeBits = 13; |
- static const int kDeoptIndexBits = 32 - kGapCodeSizeBits; |
+ static const int kArgumentsFieldBits = 3; |
+ static const int kDeoptIndexBits = |
+ 32 - kGapCodeSizeBits - kArgumentsFieldBits; |
class GapCodeSizeField: public BitField<unsigned, 0, kGapCodeSizeBits> {}; |
- class DeoptimizationIndexField: public BitField<int, kGapCodeSizeBits, kDeoptIndexBits> {}; // NOLINT |
+ class DeoptimizationIndexField: public BitField<int, |
+ kGapCodeSizeBits, |
+ kDeoptIndexBits> {}; // NOLINT |
fschneider
2011/01/12 09:57:02
Is the NO_LINT needed? This looks like perfectly f
Vitaly Repeshko
2011/01/12 14:14:35
Cpplint doesn't like the semicolon after the closi
|
+ class ArgumentsField: public BitField<unsigned, |
+ kGapCodeSizeBits + kDeoptIndexBits, |
+ kArgumentsFieldBits> {}; // NOLINT |
+ private: |
+ unsigned info_; |
+ uint8_t* bits_; |
+}; |
+ |
+ |
+class SafepointTable BASE_EMBEDDED { |
+ public: |
+ explicit SafepointTable(Code* code); |
- static bool HasRegisters(uint8_t* entry); |
- static bool HasRegisterAt(uint8_t* entry, int reg_index); |
+ int size() const { |
+ return kHeaderSize + |
+ (length_ * (kPcAndDeoptimizationIndexSize + entry_size_)); } |
+ unsigned length() const { return length_; } |
+ unsigned entry_size() const { return entry_size_; } |
+ |
+ unsigned GetPcOffset(unsigned index) const { |
+ ASSERT(index < length_); |
+ return Memory::uint32_at(GetPcOffsetLocation(index)); |
+ } |
+ |
+ SafepointEntry GetEntry(unsigned index) const { |
+ ASSERT(index < length_); |
+ unsigned info = Memory::uint32_at(GetInfoLocation(index)); |
+ uint8_t* bits = &Memory::uint8_at(entries_ + (index * entry_size_)); |
+ return SafepointEntry(info, bits); |
+ } |
+ |
+ // Returns the entry index for the given pc. |
+ SafepointEntry FindEntry(Address pc) const; |
void PrintEntry(unsigned index) const; |
@@ -100,7 +144,7 @@ class SafepointTable BASE_EMBEDDED { |
(index * kPcAndDeoptimizationIndexSize); |
} |
- Address GetDeoptimizationLocation(unsigned index) const { |
+ Address GetInfoLocation(unsigned index) const { |
return GetPcOffsetLocation(index) + kPcSize; |
} |
@@ -115,16 +159,19 @@ class SafepointTable BASE_EMBEDDED { |
Address entries_; |
friend class SafepointTableBuilder; |
+ friend class SafepointEntry; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(SafepointTable); |
}; |
class Safepoint BASE_EMBEDDED { |
public: |
static const int kNoDeoptimizationIndex = |
- (1 << (SafepointTable::kDeoptIndexBits)) - 1; |
+ (1 << (SafepointEntry::kDeoptIndexBits)) - 1; |
void DefinePointerSlot(int index) { indexes_->Add(index); } |
- void DefinePointerRegister(Register reg) { registers_->Add(reg.code()); } |
+ void DefinePointerRegister(Register reg); |
private: |
Safepoint(ZoneList<int>* indexes, ZoneList<int>* registers) : |
@@ -177,9 +224,10 @@ class SafepointTableBuilder BASE_EMBEDDED { |
unsigned pc; |
unsigned deoptimization_index; |
unsigned pc_after_gap; |
+ unsigned arguments; |
}; |
- uint32_t EncodeDeoptimizationIndexAndGap(DeoptimizationInfo info); |
+ uint32_t EncodeExceptPC(const DeoptimizationInfo& info); |
ZoneList<DeoptimizationInfo> deoptimization_info_; |
ZoneList<ZoneList<int>*> indexes_; |