Reviewers: Benedikt Meurer,
Message:
Hi Benedikt,
Here is the printing function we discussed a little while ago.
Description:
Special printing for type feedback vectors.
Gdb macro jfv on an object will print it as a feedback vector.
Printouts look like this:
DebugPrint: 0x5dc0d2ad: [TypeFeedbackVector]
- length: 12
- ics with type info: 3
- generic ics: 0
ICSlot 0 CALL_IC MONOMORPHIC
[4]: 0x5dc0d365 WeakCell for 0x5dc0cd69 <JS Function foo
(SharedFunctionInfo
0x5dc0cb0d)>
[5]: 0x4203c4c1 <Code: HANDLER>
ICSlot 1 LOAD_IC MONOMORPHIC
[6]: 0x5dc0d1f5 WeakCell for 0x3a710481 <Map(FAST_HOLEY_SMI_ELEMENTS)>
[7]: 0x4203a1c1 <Code: HANDLER>
ICSlot 2 LOAD_IC UNINITIALIZED
[8]: 0x3060d045 <Symbol: 711234650 <String[20]: uninitialized_symbol>>
[9]: 0x3060d045 <Symbol: 711234650 <String[20]: uninitialized_symbol>>
ICSlot 3 LOAD_IC MONOMORPHIC
[10]: 0x5dc0d3b5 WeakCell for 0x3a710d71 <Map(FAST_HOLEY_ELEMENTS)>
[11]: 0x4202af01 <Code: HANDLER>
BUG=
Please review this at https://codereview.chromium.org/1225403005/
Base URL: https://chromium.googlesource.com/v8/v8.git@master
Affected files (+72, -1 lines):
M src/objects-printer.cc
M src/type-feedback-vector.h
M tools/gdbinit
Index: src/objects-printer.cc
diff --git a/src/objects-printer.cc b/src/objects-printer.cc
index
fdcaa74670c11d14caa5fb2f955291946dbd3298..2f0b1b31eec2fa380b305865f323d9c01fbd154b
100644
--- a/src/objects-printer.cc
+++ b/src/objects-printer.cc
@@ -503,6 +503,61 @@ void
FixedDoubleArray::FixedDoubleArrayPrint(std::ostream& os) { // NOLINT
}
+void TypeFeedbackVector::Print() {
+ OFStream os(stdout);
+ TypeFeedbackVectorPrint(os);
+ os << std::flush;
+}
+
+
+void TypeFeedbackVector::TypeFeedbackVectorPrint(std::ostream& os) { //
NOLINT
+ HeapObject::PrintHeader(os, "TypeFeedbackVector");
+ os << " - length: " << length();
+ if (length() == 0) {
+ os << " (empty)\n";
+ return;
+ }
+
+ os << "\n - ics with type info: " << ic_with_type_info_count();
+ os << "\n - generic ics: " << ic_generic_count();
+
+ if (Slots() > 0) {
+ for (int i = 0; i < Slots(); i++) {
+ FeedbackVectorSlot slot(i);
+ os << "\n Slot " << i << " [" << GetIndex(slot)
+ << "]: " << Brief(Get(slot));
+ }
+ }
+
+ if (ICSlots() > 0) {
+ DCHECK(elements_per_ic_slot() == 2);
+
+ for (int i = 0; i < ICSlots(); i++) {
+ FeedbackVectorICSlot slot(i);
+ Code::Kind kind = GetKind(slot);
+ os << "\n ICSlot " << i;
+ if (kind == Code::LOAD_IC) {
+ LoadICNexus nexus(this, slot);
+ os << " LOAD_IC " <<
Code::ICState2String(nexus.StateFromFeedback());
+ } else if (kind == Code::KEYED_LOAD_IC) {
+ KeyedLoadICNexus nexus(this, slot);
+ os << " KEYED_LOAD_IC "
+ << Code::ICState2String(nexus.StateFromFeedback());
+ } else {
+ DCHECK(kind == Code::CALL_IC);
+ CallICNexus nexus(this, slot);
+ os << " CALL_IC " <<
Code::ICState2String(nexus.StateFromFeedback());
+ }
+
+ os << "\n [" << GetIndex(slot) << "]: " << Brief(Get(slot));
+ os << "\n [" << (GetIndex(slot) + 1)
+ << "]: " << Brief(get(GetIndex(slot) + 1));
+ }
+ }
+ os << "\n";
+}
+
+
void JSValue::JSValuePrint(std::ostream& os) { // NOLINT
HeapObject::PrintHeader(os, "ValueObject");
value()->Print(os);
@@ -761,7 +816,7 @@ void
SharedFunctionInfo::SharedFunctionInfoPrint(std::ostream& os) { // NOLINT
os << "\n - length = " << length();
os << "\n - optimized_code_map = " << Brief(optimized_code_map());
os << "\n - feedback_vector = ";
- feedback_vector()->FixedArrayPrint(os);
+ feedback_vector()->TypeFeedbackVectorPrint(os);
os << "\n";
}
Index: src/type-feedback-vector.h
diff --git a/src/type-feedback-vector.h b/src/type-feedback-vector.h
index
a6f72210fc9f2545d77ea92e885a6f801071fadd..2a6e4f3654af41855d5fd5e01d17b0c39a3033de
100644
--- a/src/type-feedback-vector.h
+++ b/src/type-feedback-vector.h
@@ -192,6 +192,13 @@ class TypeFeedbackVector : public FixedArray {
static Handle<TypeFeedbackVector> Copy(Isolate* isolate,
Handle<TypeFeedbackVector>
vector);
+#ifdef OBJECT_PRINT
+ // For gdb debugging.
+ void Print();
+#endif // OBJECT_PRINT
+
+ DECLARE_PRINTER(TypeFeedbackVector)
+
// Clears the vector slots and the vector ic slots.
void ClearSlots(SharedFunctionInfo* shared) { ClearSlotsImpl(shared,
true); }
void ClearSlotsAtGCTime(SharedFunctionInfo* shared) {
Index: tools/gdbinit
diff --git a/tools/gdbinit b/tools/gdbinit
index
72030e269a086d77162ee30a0150a48946cbebc7..5e6af9d6a89ed00d9b977582a3d44b8743e1fe10
100644
--- a/tools/gdbinit
+++ b/tools/gdbinit
@@ -20,6 +20,15 @@ Print a v8 Code object from an internal code address
Usage: jco pc
end
+# Print TypeFeedbackVector
+define jfv
+print ((v8::internal::TypeFeedbackVector*)($arg0))->Print()
+end
+document jfv
+Print a v8 TypeFeedbackVector object
+Usage: jtv tagged_ptr
+end
+
# Print DescriptorArray.
define jda
print ((v8::internal::DescriptorArray*)($arg0))->Print()
--
--
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.