Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(748)

Unified Diff: src/safepoint-table.h

Issue 504493002: Fix deoptimization address patching in Turbofan to use safepoints. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Compilation fix. Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/objects-inl.h ('k') | src/safepoint-table.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/safepoint-table.h
diff --git a/src/safepoint-table.h b/src/safepoint-table.h
index 0bdd43104d5a89ce1e2e55f43c25d77f1ad80824..d91a1956daf14f2789c0c8a4112b2e1e45403f68 100644
--- a/src/safepoint-table.h
+++ b/src/safepoint-table.h
@@ -17,9 +17,10 @@ struct Register;
class SafepointEntry BASE_EMBEDDED {
public:
- SafepointEntry() : info_(0), bits_(NULL) {}
+ SafepointEntry() : info_(0), deoptimization_pc_(0), bits_(NULL) {}
- SafepointEntry(unsigned info, uint8_t* bits) : info_(info), bits_(bits) {
+ SafepointEntry(unsigned info, unsigned deoptimization_pc, uint8_t* bits)
+ : info_(info), deoptimization_pc_(deoptimization_pc), bits_(bits) {
DCHECK(is_valid());
}
@@ -39,6 +40,11 @@ class SafepointEntry BASE_EMBEDDED {
return DeoptimizationIndexField::decode(info_);
}
+ unsigned deoptimization_pc() const {
+ DCHECK(is_valid());
+ return deoptimization_pc_;
+ }
+
static const int kArgumentsFieldBits = 3;
static const int kSaveDoublesFieldBits = 1;
static const int kDeoptIndexBits =
@@ -74,6 +80,7 @@ class SafepointEntry BASE_EMBEDDED {
private:
unsigned info_;
+ unsigned deoptimization_pc_;
uint8_t* bits_;
};
@@ -84,7 +91,8 @@ class SafepointTable BASE_EMBEDDED {
int size() const {
return kHeaderSize +
- (length_ * (kPcAndDeoptimizationIndexSize + entry_size_)); }
+ (length_ * (kPcAndDeoptimizationInfoSize + entry_size_));
+ }
unsigned length() const { return length_; }
unsigned entry_size() const { return entry_size_; }
@@ -93,11 +101,17 @@ class SafepointTable BASE_EMBEDDED {
return Memory::uint32_at(GetPcOffsetLocation(index));
}
+ unsigned GetDeoptimizationPcOffset(unsigned index) const {
+ DCHECK(index < length_);
+ return Memory::uint32_at(GetDeoptimizationPcLocation(index));
+ }
+
SafepointEntry GetEntry(unsigned index) const {
DCHECK(index < length_);
unsigned info = Memory::uint32_at(GetInfoLocation(index));
+ unsigned deopt_pc = Memory::uint32_at(GetDeoptimizationPcLocation(index));
uint8_t* bits = &Memory::uint8_at(entries_ + (index * entry_size_));
- return SafepointEntry(info, bits);
+ return SafepointEntry(info, deopt_pc, bits);
}
// Returns the entry for the given pc.
@@ -114,18 +128,23 @@ class SafepointTable BASE_EMBEDDED {
static const int kPcSize = kIntSize;
static const int kDeoptimizationIndexSize = kIntSize;
- static const int kPcAndDeoptimizationIndexSize =
- kPcSize + kDeoptimizationIndexSize;
+ static const int kDeoptimizationPcSize = kIntSize;
+ static const int kPcAndDeoptimizationInfoSize =
+ kPcSize + kDeoptimizationIndexSize + kDeoptimizationPcSize;
Address GetPcOffsetLocation(unsigned index) const {
return pc_and_deoptimization_indexes_ +
- (index * kPcAndDeoptimizationIndexSize);
+ (index * kPcAndDeoptimizationInfoSize);
}
Address GetInfoLocation(unsigned index) const {
return GetPcOffsetLocation(index) + kPcSize;
}
+ Address GetDeoptimizationPcLocation(unsigned index) const {
+ return GetInfoLocation(index) + kDeoptimizationIndexSize;
+ }
+
static void PrintBits(OStream& os, // NOLINT
uint8_t byte, int digits);
@@ -158,15 +177,30 @@ class Safepoint BASE_EMBEDDED {
kLazyDeopt
};
+ class Id {
+ private:
+ explicit Id(int id) : id_(id) {}
+
+ int id_;
+
+ friend class SafepointTableBuilder;
+ friend class Safepoint;
+ };
+
static const int kNoDeoptimizationIndex =
(1 << (SafepointEntry::kDeoptIndexBits)) - 1;
+ static const unsigned kNoDeoptimizationPc = ~0U;
+
void DefinePointerSlot(int index, Zone* zone) { indexes_->Add(index, zone); }
void DefinePointerRegister(Register reg, Zone* zone);
+ Id id() const { return Id(id_); }
+
private:
- Safepoint(ZoneList<int>* indexes, ZoneList<int>* registers) :
- indexes_(indexes), registers_(registers) { }
+ Safepoint(int id, ZoneList<int>* indexes, ZoneList<int>* registers)
+ : id_(id), indexes_(indexes), registers_(registers) {}
+ int id_;
ZoneList<int>* indexes_;
ZoneList<int>* registers_;
@@ -200,6 +234,11 @@ class SafepointTableBuilder BASE_EMBEDDED {
void BumpLastLazySafepointIndex() {
last_lazy_safepoint_ = deopt_index_list_.length();
}
+ void SetDeoptimizationPc(Safepoint::Id safepoint_id,
+ unsigned deoptimization_pc) {
+ deoptimization_info_[safepoint_id.id_].deoptimization_pc =
+ deoptimization_pc;
+ }
// Emit the safepoint table after the body. The number of bits per
// entry must be enough to hold all the pointer indexes.
@@ -211,6 +250,7 @@ class SafepointTableBuilder BASE_EMBEDDED {
unsigned pc;
unsigned arguments;
bool has_doubles;
+ unsigned deoptimization_pc;
};
uint32_t EncodeExceptPC(const DeoptimizationInfo& info, unsigned index);
« no previous file with comments | « src/objects-inl.h ('k') | src/safepoint-table.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698