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

Unified Diff: src/assembler.cc

Issue 874323003: Externalize deoptimization reasons. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: arm64 Created 5 years, 11 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
Index: src/assembler.cc
diff --git a/src/assembler.cc b/src/assembler.cc
index deabe3b776a9377e10f0f4d3346946ab036c10af..0c7e58f6f0edeed38959df69c18751c13156c3d4 100644
--- a/src/assembler.cc
+++ b/src/assembler.cc
@@ -328,6 +328,9 @@ const int kNonstatementPositionTag = 1;
const int kStatementPositionTag = 2;
const int kCommentTag = 3;
+// Reuse the same value for deopt reason tag in short record format.
Michael Starzinger 2015/02/04 11:30:51 IIUC, this assumes that comments are always encode
loislo 2015/02/04 14:38:49 done
+const int kDeoptReasonTag = 3;
+
const int kPoolExtraTag = kPCJumpExtraTag - 2;
const int kConstPoolTag = 0;
const int kVeneerPoolTag = 1;
@@ -423,7 +426,10 @@ void RelocInfoWriter::Write(const RelocInfo* rinfo) {
RelocInfo::Mode rmode = rinfo->rmode();
// The two most common modes are given small tags, and usually fit in a byte.
- if (rmode == RelocInfo::EMBEDDED_OBJECT) {
+ if (rmode == RelocInfo::DEOPT_REASON) {
Michael Starzinger 2015/02/04 11:30:51 nit: Can we move this to after EMBEDDED_OBJECT, CO
loislo 2015/02/04 14:38:50 done
+ WriteTaggedPC(pc_delta, kLocatableTag);
+ WriteTaggedData(rinfo->data(), kDeoptReasonTag);
Michael Starzinger 2015/02/04 11:30:51 Can we have a DCHECK here that the deopt reason re
loislo 2015/02/04 14:38:49 done
+ } else if (rmode == RelocInfo::EMBEDDED_OBJECT) {
WriteTaggedPC(pc_delta, kEmbeddedObjectTag);
} else if (rmode == RelocInfo::CODE_TARGET) {
WriteTaggedPC(pc_delta, kCodeTargetTag);
@@ -583,6 +589,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 +628,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 +796,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 +818,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 +881,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') | src/ia32/assembler-ia32.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698