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

Side by Side Diff: runtime/vm/object.cc

Issue 167713002: Improved how closures are displayed by <instance-ref>. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: gen js Created 6 years, 10 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
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 12058 matching lines...) Expand 10 before | Expand all | Expand 10 after
12069 jsobj.AddProperty("id", "objects/null"); 12069 jsobj.AddProperty("id", "objects/null");
12070 return; 12070 return;
12071 } else if (raw() == Object::sentinel().raw()) { 12071 } else if (raw() == Object::sentinel().raw()) {
12072 jsobj.AddProperty("type", ref ? "@Null" : "Null"); 12072 jsobj.AddProperty("type", ref ? "@Null" : "Null");
12073 jsobj.AddProperty("id", "objects/not-initialized"); 12073 jsobj.AddProperty("id", "objects/not-initialized");
12074 return; 12074 return;
12075 } else if (raw() == Object::transition_sentinel().raw()) { 12075 } else if (raw() == Object::transition_sentinel().raw()) {
12076 jsobj.AddProperty("type", ref ? "@Null" : "Null"); 12076 jsobj.AddProperty("type", ref ? "@Null" : "Null");
12077 jsobj.AddProperty("id", "objects/being-initialized"); 12077 jsobj.AddProperty("id", "objects/being-initialized");
12078 return; 12078 return;
12079 } else if (raw() == Symbols::OptimizedOut().raw()) {
12080 // TODO(turnidge): This is a hack. The user could have this
12081 // special string in their program. Fixing this involves updating
12082 // the debugging api a bit.
12083 jsobj.AddProperty("type", ref ? "@Null" : "Null");
12084 jsobj.AddProperty("id", "objects/optimized-out");
12085 jsobj.AddProperty("preview", "<optimized out>");
12086 return;
12079 } else { 12087 } else {
12080 ObjectIdRing* ring = Isolate::Current()->object_id_ring(); 12088 ObjectIdRing* ring = Isolate::Current()->object_id_ring();
12081 intptr_t id = ring->GetIdForObject(raw()); 12089 intptr_t id = ring->GetIdForObject(raw());
12082 jsobj.AddProperty("type", JSONType(ref)); 12090 if (IsClosure()) {
12091 const Function& closureFunc = Function::Handle(Closure::function(*this));
12092 jsobj.AddProperty("closureFunc", closureFunc);
12093 jsobj.AddProperty("type", ref ? "@Closure" : "Closure");
12094 } else {
12095 jsobj.AddProperty("type", JSONType(ref));
12096 }
12083 jsobj.AddPropertyF("id", "objects/%" Pd "", id); 12097 jsobj.AddPropertyF("id", "objects/%" Pd "", id);
12084 jsobj.AddProperty("class", cls); 12098 jsobj.AddProperty("class", cls);
12085 } 12099 }
12086
12087 if (ref) { 12100 if (ref) {
12088 return; 12101 return;
12089 } 12102 }
12090 12103
12091 // Walk the superclass chain, adding all instance fields. 12104 // Walk the superclass chain, adding all instance fields.
12092 { 12105 {
12093 Instance& fieldValue = Instance::Handle(); 12106 Instance& fieldValue = Instance::Handle();
12094 JSONArray jsarr(&jsobj, "fields"); 12107 JSONArray jsarr(&jsobj, "fields");
12095 while (!cls.IsNull()) { 12108 while (!cls.IsNull()) {
12096 const Array& field_array = Array::Handle(cls.fields()); 12109 const Array& field_array = Array::Handle(cls.fields());
(...skipping 5325 matching lines...) Expand 10 before | Expand all | Expand 10 after
17422 return "_MirrorReference"; 17435 return "_MirrorReference";
17423 } 17436 }
17424 17437
17425 17438
17426 void MirrorReference::PrintToJSONStream(JSONStream* stream, bool ref) const { 17439 void MirrorReference::PrintToJSONStream(JSONStream* stream, bool ref) const {
17427 Instance::PrintToJSONStream(stream, ref); 17440 Instance::PrintToJSONStream(stream, ref);
17428 } 17441 }
17429 17442
17430 17443
17431 } // namespace dart 17444 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/bin/vmservice/client/lib/src/observatory_elements/observatory_element.dart ('k') | runtime/vm/service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698