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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « runtime/bin/vmservice/client/lib/src/service/object.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "vm/object.h" 5 #include "vm/object.h"
6 6
7 #include "include/dart_api.h" 7 #include "include/dart_api.h"
8 #include "platform/assert.h" 8 #include "platform/assert.h"
9 #include "vm/assembler.h" 9 #include "vm/assembler.h"
10 #include "vm/cpu.h" 10 #include "vm/cpu.h"
(...skipping 6312 matching lines...) Expand 10 before | Expand all | Expand 10 after
6323 } else if (IsImplicitClosureFunction()) { 6323 } else if (IsImplicitClosureFunction()) {
6324 id = cls.FindImplicitClosureFunctionIndex(*this); 6324 id = cls.FindImplicitClosureFunctionIndex(*this);
6325 selector = "implicit_closures"; 6325 selector = "implicit_closures";
6326 } else if (IsNoSuchMethodDispatcher() || IsInvokeFieldDispatcher()) { 6326 } else if (IsNoSuchMethodDispatcher() || IsInvokeFieldDispatcher()) {
6327 id = cls.FindInvocationDispatcherFunctionIndex(*this); 6327 id = cls.FindInvocationDispatcherFunctionIndex(*this);
6328 selector = "dispatchers"; 6328 selector = "dispatchers";
6329 } else { 6329 } else {
6330 id = cls.FindFunctionIndex(*this); 6330 id = cls.FindFunctionIndex(*this);
6331 selector = "functions"; 6331 selector = "functions";
6332 } 6332 }
6333 // TODO(17697): Oddball functions are treated as plain objects and use the
6334 // object id ring. Current known examples are signature functions of closures
6335 // and stubs like 'megamorphic_miss'.
6336 if (id < 0) {
6337 return Object::PrintToJSONStream(stream, ref);
6338 }
6339 intptr_t cid = cls.id(); 6333 intptr_t cid = cls.id();
6340 JSONObject jsobj(stream); 6334 JSONObject jsobj(stream);
6341 jsobj.AddProperty("type", JSONType(ref)); 6335 jsobj.AddProperty("type", JSONType(ref));
6342 jsobj.AddPropertyF("id", "classes/%" Pd "/%s/%" Pd "", cid, selector, id); 6336 // TODO(17697): Oddball functions (functions without owners) use the object
6337 // id ring. Current known examples are signature functions of closures
6338 // and stubs like 'megamorphic_miss'.
6339 if (id < 0) {
6340 ObjectIdRing* ring = Isolate::Current()->object_id_ring();
6341 id = ring->GetIdForObject(raw());
6342 jsobj.AddPropertyF("id", "objects/%" Pd "", id);
6343 } else {
6344 jsobj.AddPropertyF("id", "classes/%" Pd "/%s/%" Pd "", cid, selector, id);
6345 }
6343 jsobj.AddProperty("name", internal_name); 6346 jsobj.AddProperty("name", internal_name);
6344 jsobj.AddProperty("user_name", user_name); 6347 jsobj.AddProperty("user_name", user_name);
6345 jsobj.AddProperty("class", cls); 6348 jsobj.AddProperty("class", cls);
6346 const Function& parent = Function::Handle(parent_function()); 6349 const Function& parent = Function::Handle(parent_function());
6347 if (!parent.IsNull()) { 6350 if (!parent.IsNull()) {
6348 jsobj.AddProperty("parent", parent); 6351 jsobj.AddProperty("parent", parent);
6349 } 6352 }
6350 const char* kind_string = Function::KindToCString(kind()); 6353 const char* kind_string = Function::KindToCString(kind());
6351 jsobj.AddProperty("kind", kind_string); 6354 jsobj.AddProperty("kind", kind_string);
6352 if (ref) { 6355 if (ref) {
(...skipping 11643 matching lines...) Expand 10 before | Expand all | Expand 10 after
17996 return "_MirrorReference"; 17999 return "_MirrorReference";
17997 } 18000 }
17998 18001
17999 18002
18000 void MirrorReference::PrintToJSONStream(JSONStream* stream, bool ref) const { 18003 void MirrorReference::PrintToJSONStream(JSONStream* stream, bool ref) const {
18001 Instance::PrintToJSONStream(stream, ref); 18004 Instance::PrintToJSONStream(stream, ref);
18002 } 18005 }
18003 18006
18004 18007
18005 } // namespace dart 18008 } // namespace dart
OLDNEW
« 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