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

Unified Diff: runtime/vm/object.cc

Issue 196173022: Fix PrintToJSONStream for oddball functions (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 9 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/bin/vmservice/client/lib/src/service/object.dart ('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 c6621370bd0f7107283a536c386b5a14ecc71dc8..7fb08c8ed2496289583e41b645155285d440723b 100644
--- a/runtime/vm/object.cc
+++ b/runtime/vm/object.cc
@@ -6330,16 +6330,19 @@ void Function::PrintToJSONStream(JSONStream* stream, bool ref) const {
id = cls.FindFunctionIndex(*this);
selector = "functions";
}
- // TODO(17697): Oddball functions are treated as plain objects and use the
- // object id ring. Current known examples are signature functions of closures
- // and stubs like 'megamorphic_miss'.
- if (id < 0) {
- return Object::PrintToJSONStream(stream, ref);
- }
intptr_t cid = cls.id();
JSONObject jsobj(stream);
jsobj.AddProperty("type", JSONType(ref));
- jsobj.AddPropertyF("id", "classes/%" Pd "/%s/%" Pd "", cid, selector, id);
+ // TODO(17697): Oddball functions (functions without owners) use the object
+ // id ring. Current known examples are signature functions of closures
+ // and stubs like 'megamorphic_miss'.
+ if (id < 0) {
+ ObjectIdRing* ring = Isolate::Current()->object_id_ring();
+ id = ring->GetIdForObject(raw());
+ jsobj.AddPropertyF("id", "objects/%" Pd "", id);
+ } else {
+ jsobj.AddPropertyF("id", "classes/%" Pd "/%s/%" Pd "", cid, selector, id);
+ }
jsobj.AddProperty("name", internal_name);
jsobj.AddProperty("user_name", user_name);
jsobj.AddProperty("class", cls);
« no previous file with comments | « runtime/bin/vmservice/client/lib/src/service/object.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698