Reviewers: Yang,
Message:
Please take a look.
This is a usability improvement for --trace-deopt.
Description:
When marking dependent code for deoptimization print the group that is being
deoptimized.
Otherwise it is impossible to figure out from the --trace-deoptimization
output
what is going on.
BUG=
Please review this at https://codereview.chromium.org/467183002/
SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge
Affected files (+52, -2 lines):
M src/heap/mark-compact.cc
M src/objects.h
M src/objects.cc
Index: src/heap/mark-compact.cc
diff --git a/src/heap/mark-compact.cc b/src/heap/mark-compact.cc
index
abb4e1beb8e7e51936657e70d14dec33649a7faf..8a44ce1677268ef549c564cfbdffeed0a86c3da4
100644
--- a/src/heap/mark-compact.cc
+++ b/src/heap/mark-compact.cc
@@ -2724,7 +2724,8 @@ void
MarkCompactCollector::ClearDependentCode(DependentCode* entries) {
DCHECK(entries->is_code_at(i));
Code* code = entries->code_at(i);
if (IsMarked(code) && !code->marked_for_deoptimization()) {
- code->set_marked_for_deoptimization(true);
+ DependentCode::SetMarkedForDeoptimization(
+ code, static_cast<DependentCode::DependencyGroup>(g));
code->InvalidateEmbeddedObjects();
have_code_to_deoptimize_ = true;
}
Index: src/objects.cc
diff --git a/src/objects.cc b/src/objects.cc
index
29af1d83373193db4face20c934c39f939a276be..526bb1c5dc5ba38d14e0c2a245052c830b7defbf
100644
--- a/src/objects.cc
+++ b/src/objects.cc
@@ -12064,7 +12064,7 @@ bool DependentCode::MarkCodeForDeoptimization(
if (is_code_at(i)) {
Code* code = code_at(i);
if (!code->marked_for_deoptimization()) {
- code->set_marked_for_deoptimization(true);
+ SetMarkedForDeoptimization(code, group);
marked = true;
}
} else {
@@ -12115,6 +12115,52 @@ void
DependentCode::AddToDependentICList(Handle<Code> stub) {
}
+void DependentCode::SetMarkedForDeoptimization(Code* code,
+ DependencyGroup group) {
+ code->set_marked_for_deoptimization(true);
+ if (FLAG_trace_deopt) {
+ DeoptimizationInputData* deopt_data =
+ DeoptimizationInputData::cast(code->deoptimization_data());
+ CodeTracer::Scope scope(code->GetHeap()->isolate()->GetCodeTracer());
+ PrintF(scope.file(),
+ "[marking dependent code 0x%08" V8PRIxPTR
+ " (opt #%d) for deoptimization, reason: %s]\n",
+ reinterpret_cast<intptr_t>(code),
+ deopt_data->OptimizationId()->value(),
+ DependencyGroupName(group));
+ }
+}
+
+
+const char* DependentCode::DependencyGroupName(DependencyGroup group) {
+ switch (group) {
+ case kWeakICGroup:
+ return "weak-ic";
+ case kWeakCodeGroup:
+ return "weak-code";
+ case kTransitionGroup:
+ return "transition";
+ case kPrototypeCheckGroup:
+ return "prototype-check";
+ case kElementsCantBeAddedGroup:
+ return "elements-cant-be-added";
+ case kPropertyCellChangedGroup:
+ return "property-cell-changed";
+ case kFieldTypeGroup:
+ return "field-type";
+ case kInitialMapChangedGroup:
+ return "initial-map-changed";
+ case kAllocationSiteTenuringChangedGroup:
+ return "allocation-site-tenuring-changed";
+ case kAllocationSiteTransitionChangedGroup:
+ return "allocation-site-transition-changed";
+ default:
+ UNREACHABLE();
+ return "?";
+ }
+}
+
+
Handle<Map> Map::TransitionToPrototype(Handle<Map> map,
Handle<Object> prototype) {
Handle<Map> new_map = GetPrototypeTransition(map, prototype);
Index: src/objects.h
diff --git a/src/objects.h b/src/objects.h
index
2bb47e80f547cd59ae32c6ffa692f481aea3a22a..7f1a9cebe62d35363f221255afa9937da1d33d43
100644
--- a/src/objects.h
+++ b/src/objects.h
@@ -6070,6 +6070,9 @@ class DependentCode: public FixedArray {
static DependentCode* ForObject(Handle<HeapObject> object,
DependencyGroup group);
+ static const char* DependencyGroupName(DependencyGroup group);
+ static void SetMarkedForDeoptimization(Code* code, DependencyGroup
group);
+
private:
// Make a room at the end of the given group by moving out the first
// code objects of the subsequent groups.
--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.