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

Unified Diff: src/assembler.cc

Issue 874323003: Externalize deoptimization reasons. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: minor change Created 5 years, 10 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/assembler.h ('k') | src/code-stubs-hydrogen.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/assembler.cc
diff --git a/src/assembler.cc b/src/assembler.cc
index deabe3b776a9377e10f0f4d3346946ab036c10af..4c5eda198106e5c9ef9bac136788e5188dad9b84 100644
--- a/src/assembler.cc
+++ b/src/assembler.cc
@@ -256,6 +256,7 @@ int Label::pos() const {
// position: 01
// statement_position: 10
// comment: 11 (not used in short_data_record)
+// deopt_reason: 11 (not used in long_data_record)
//
// Long record format:
// 4-bit middle_tag:
@@ -328,6 +329,10 @@ const int kNonstatementPositionTag = 1;
const int kStatementPositionTag = 2;
const int kCommentTag = 3;
+// Reuse the same value for deopt reason tag in short record format.
+// It is possible because we use kCommentTag only for the long record format.
+const int kDeoptReasonTag = 3;
+
const int kPoolExtraTag = kPCJumpExtraTag - 2;
const int kConstPoolTag = 0;
const int kVeneerPoolTag = 1;
@@ -442,6 +447,10 @@ void RelocInfoWriter::Write(const RelocInfo* rinfo) {
WriteExtraTaggedIntData(id_delta, kCodeWithIdTag);
}
last_id_ = static_cast<int>(rinfo->data());
+ } else if (rmode == RelocInfo::DEOPT_REASON) {
+ DCHECK(rinfo->data() < (1 << kSmallDataBits));
+ WriteTaggedPC(pc_delta, kLocatableTag);
+ WriteTaggedData(rinfo->data(), kDeoptReasonTag);
} else if (RelocInfo::IsPosition(rmode)) {
// Use signed delta-encoding for position.
DCHECK(static_cast<int>(rinfo->data()) == rinfo->data());
@@ -473,7 +482,7 @@ void RelocInfoWriter::Write(const RelocInfo* rinfo) {
int saved_mode = rmode - RelocInfo::LAST_COMPACT_ENUM;
// For all other modes we simply use the mode as the extra tag.
// None of these modes need a data component.
- DCHECK(saved_mode < kPCJumpExtraTag && saved_mode < kDataJumpExtraTag);
+ DCHECK(saved_mode < kPoolExtraTag);
WriteExtraTaggedPC(pc_delta, saved_mode);
}
last_pc_ = rinfo->pc();
@@ -583,6 +592,12 @@ inline void RelocIterator::ReadTaggedPosition() {
}
+inline void RelocIterator::ReadTaggedData() {
+ uint8_t unsigned_b = *pos_;
+ rinfo_.data_ = unsigned_b >> kTagBits;
+}
+
+
static inline RelocInfo::Mode GetPositionModeFromTag(int tag) {
DCHECK(tag == kNonstatementPositionTag ||
tag == kStatementPositionTag);
@@ -616,9 +631,10 @@ void RelocIterator::next() {
ReadTaggedId();
return;
}
+ } else if (locatable_tag == kDeoptReasonTag) {
+ ReadTaggedData();
+ if (SetMode(RelocInfo::DEOPT_REASON)) return;
} else {
- // Compact encoding is never used for comments,
- // so it must be a position.
DCHECK(locatable_tag == kNonstatementPositionTag ||
locatable_tag == kStatementPositionTag);
if (mode_mask_ & RelocInfo::kPositionMask) {
@@ -783,6 +799,8 @@ const char* RelocInfo::RelocModeName(RelocInfo::Mode rmode) {
return "external reference";
case RelocInfo::INTERNAL_REFERENCE:
return "internal reference";
+ case RelocInfo::DEOPT_REASON:
+ return "deopt reason";
case RelocInfo::CONST_POOL:
return "constant pool";
case RelocInfo::VENEER_POOL:
@@ -803,6 +821,9 @@ void RelocInfo::Print(Isolate* isolate, std::ostream& os) { // NOLINT
os << static_cast<const void*>(pc_) << " " << RelocModeName(rmode_);
if (IsComment(rmode_)) {
os << " (" << reinterpret_cast<char*>(data_) << ")";
+ } else if (rmode_ == DEOPT_REASON) {
+ os << " (" << Deoptimizer::GetDeoptReason(
+ static_cast<Deoptimizer::DeoptReason>(data_)) << ")";
} else if (rmode_ == EMBEDDED_OBJECT) {
os << " (" << Brief(target_object()) << ")";
} else if (rmode_ == EXTERNAL_REFERENCE) {
@@ -863,6 +884,7 @@ void RelocInfo::Verify(Isolate* isolate) {
case STATEMENT_POSITION:
case EXTERNAL_REFERENCE:
case INTERNAL_REFERENCE:
+ case DEOPT_REASON:
case CONST_POOL:
case VENEER_POOL:
case DEBUG_BREAK_SLOT:
« no previous file with comments | « src/assembler.h ('k') | src/code-stubs-hydrogen.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698