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

Unified Diff: runtime/vm/object.cc

Issue 251043003: Observatory Display PC descriptors with disassembling (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 8 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 | « runtime/vm/object.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/object.cc
diff --git a/runtime/vm/object.cc b/runtime/vm/object.cc
index 316a738073ff20580cdfd50d14c987bf92e42658..b3c300e0448c0ceadee6575f0e275a1f49350e8a 100644
--- a/runtime/vm/object.cc
+++ b/runtime/vm/object.cc
@@ -10035,8 +10035,27 @@ const char* PcDescriptors::ToCString() const {
}
+void PcDescriptors::PrintToJSONObject(JSONObject* jsobj) const {
+ jsobj->AddProperty("type", JSONType(false));
+ // TODO(johnmccutchan): Generate a valid ID.
+ // PcDescriptors hang off a Code object but do not have a back reference to
+ // generate an ID. Currently we only print PcDescriptors inline with a Code.
+ jsobj->AddProperty("id", "");
+ JSONArray members(jsobj, "members");
+ for (intptr_t i = 0; i < Length(); i++) {
+ JSONObject descriptor(&members);
+ descriptor.AddPropertyF("pc", "%" Px "", PC(i));
+ descriptor.AddProperty("kind", KindAsStr(i));
+ descriptor.AddProperty("deoptId", DeoptId(i));
+ descriptor.AddProperty("tokenPos", TokenPos(i));
+ descriptor.AddProperty("tryIndex", TryIndex(i));
+ }
+}
+
+
void PcDescriptors::PrintToJSONStream(JSONStream* stream, bool ref) const {
- Object::PrintToJSONStream(stream, ref);
+ JSONObject jsobj(stream);
+ PrintToJSONObject(&jsobj);
}
@@ -11633,11 +11652,18 @@ void Code::PrintToJSONStream(JSONStream* stream, bool ref) const {
}
const Array& array = Array::Handle(ObjectPool());
jsobj.AddProperty("object_pool", array);
- JSONArray jsarr(&jsobj, "disassembly");
- if (is_alive()) {
- // Only disassemble alive code objects.
- DisassembleToJSONStream formatter(jsarr);
- Disassemble(&formatter);
+ {
+ JSONArray jsarr(&jsobj, "disassembly");
+ if (is_alive()) {
+ // Only disassemble alive code objects.
+ DisassembleToJSONStream formatter(jsarr);
+ Disassemble(&formatter);
+ }
+ }
+ const PcDescriptors& descriptors = PcDescriptors::Handle(pc_descriptors());
+ if (!descriptors.IsNull()) {
+ JSONObject desc(&jsobj, "descriptors");
+ descriptors.PrintToJSONObject(&desc);
}
}
@@ -13420,6 +13446,10 @@ const char* AbstractType::ToCString() const {
void AbstractType::PrintToJSONStream(JSONStream* stream, bool ref) const {
+ if (IsNull()) {
+ Instance::PrintToJSONStream(stream, ref);
+ return;
+ }
UNREACHABLE();
}
« no previous file with comments | « runtime/vm/object.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698