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

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

Issue 560503002: Add support for TokenStream, LocalVarDescriptors, and PcDescriptors to service lib and generic obje… (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 3 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/observatory/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 7964 matching lines...) Expand 10 before | Expand all | Expand 10 after
7975 JSONObject jsobj(stream); 7975 JSONObject jsobj(stream);
7976 AddTypeProperties(&jsobj, "Object", JSONType(), ref); 7976 AddTypeProperties(&jsobj, "Object", JSONType(), ref);
7977 // TODO(johnmccutchan): Generate a stable id. TokenStreams hang off 7977 // TODO(johnmccutchan): Generate a stable id. TokenStreams hang off
7978 // a Script object but do not have a back reference to generate a stable id. 7978 // a Script object but do not have a back reference to generate a stable id.
7979 ObjectIdRing* ring = Isolate::Current()->object_id_ring(); 7979 ObjectIdRing* ring = Isolate::Current()->object_id_ring();
7980 const intptr_t id = ring->GetIdForObject(raw()); 7980 const intptr_t id = ring->GetIdForObject(raw());
7981 jsobj.AddPropertyF("id", "objects/%" Pd "", id); 7981 jsobj.AddPropertyF("id", "objects/%" Pd "", id);
7982 if (ref) { 7982 if (ref) {
7983 return; 7983 return;
7984 } 7984 }
7985 Class& cls = Class::Handle(this->clazz());
7986 jsobj.AddProperty("class", cls);
7987 jsobj.AddProperty("size", raw()->Size());
7985 const String& private_key = String::Handle(PrivateKey()); 7988 const String& private_key = String::Handle(PrivateKey());
7986 jsobj.AddProperty("privateKey", private_key); 7989 jsobj.AddProperty("privateKey", private_key);
7987 // TODO(johnmccutchan): Add support for printing LiteralTokens and add 7990 // TODO(johnmccutchan): Add support for printing LiteralTokens and add
7988 // them to members array. 7991 // them to members array.
7989 JSONArray members(&jsobj, "members"); 7992 JSONArray members(&jsobj, "members");
7990 } 7993 }
7991 7994
7992 7995
7993 TokenStream::Iterator::Iterator(const TokenStream& tokens, 7996 TokenStream::Iterator::Iterator(const TokenStream& tokens,
7994 intptr_t token_pos, 7997 intptr_t token_pos,
(...skipping 2603 matching lines...) Expand 10 before | Expand all | Expand 10 after
10598 void PcDescriptors::PrintToJSONObject(JSONObject* jsobj, bool ref) const { 10601 void PcDescriptors::PrintToJSONObject(JSONObject* jsobj, bool ref) const {
10599 AddTypeProperties(jsobj, "Object", JSONType(), ref); 10602 AddTypeProperties(jsobj, "Object", JSONType(), ref);
10600 // TODO(johnmccutchan): Generate a stable id. PcDescriptors hang off a Code 10603 // TODO(johnmccutchan): Generate a stable id. PcDescriptors hang off a Code
10601 // object but do not have a back reference to generate an ID. 10604 // object but do not have a back reference to generate an ID.
10602 ObjectIdRing* ring = Isolate::Current()->object_id_ring(); 10605 ObjectIdRing* ring = Isolate::Current()->object_id_ring();
10603 const intptr_t id = ring->GetIdForObject(raw()); 10606 const intptr_t id = ring->GetIdForObject(raw());
10604 jsobj->AddPropertyF("id", "objects/%" Pd "", id); 10607 jsobj->AddPropertyF("id", "objects/%" Pd "", id);
10605 if (ref) { 10608 if (ref) {
10606 return; 10609 return;
10607 } 10610 }
10611 Class& cls = Class::Handle(this->clazz());
10612 jsobj->AddProperty("class", cls);
10613 jsobj->AddProperty("size", raw()->Size());
10608 JSONArray members(jsobj, "members"); 10614 JSONArray members(jsobj, "members");
10609 Iterator iter(*this, RawPcDescriptors::kAnyKind); 10615 Iterator iter(*this, RawPcDescriptors::kAnyKind);
10610 while (iter.MoveNext()) { 10616 while (iter.MoveNext()) {
10611 JSONObject descriptor(&members); 10617 JSONObject descriptor(&members);
10612 descriptor.AddPropertyF("pc", "%" Px "", iter.Pc()); 10618 descriptor.AddPropertyF("pc", "%" Px "", iter.Pc());
10613 descriptor.AddProperty("kind", KindAsStr(iter.Kind())); 10619 descriptor.AddProperty("kind", KindAsStr(iter.Kind()));
10614 descriptor.AddProperty("deoptId", iter.DeoptId()); 10620 descriptor.AddProperty("deoptId", iter.DeoptId());
10615 descriptor.AddProperty("tokenPos", iter.TokenPos()); 10621 descriptor.AddProperty("tokenPos", iter.TokenPos());
10616 descriptor.AddProperty("tryIndex", iter.TryIndex()); 10622 descriptor.AddProperty("tryIndex", iter.TryIndex());
10617 } 10623 }
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after
10899 JSONObject jsobj(stream); 10905 JSONObject jsobj(stream);
10900 AddTypeProperties(&jsobj, "Object", JSONType(), ref); 10906 AddTypeProperties(&jsobj, "Object", JSONType(), ref);
10901 // TODO(johnmccutchan): Generate a stable id. LocalVarDescriptors hang off 10907 // TODO(johnmccutchan): Generate a stable id. LocalVarDescriptors hang off
10902 // a Code object but do not have a back reference to generate an ID. 10908 // a Code object but do not have a back reference to generate an ID.
10903 ObjectIdRing* ring = Isolate::Current()->object_id_ring(); 10909 ObjectIdRing* ring = Isolate::Current()->object_id_ring();
10904 const intptr_t id = ring->GetIdForObject(raw()); 10910 const intptr_t id = ring->GetIdForObject(raw());
10905 jsobj.AddPropertyF("id", "objects/%" Pd "", id); 10911 jsobj.AddPropertyF("id", "objects/%" Pd "", id);
10906 if (ref) { 10912 if (ref) {
10907 return; 10913 return;
10908 } 10914 }
10915 Class& cls = Class::Handle(this->clazz());
10916 jsobj.AddProperty("class", cls);
10917 jsobj.AddProperty("size", raw()->Size());
10909 JSONArray members(&jsobj, "members"); 10918 JSONArray members(&jsobj, "members");
10910 String& var_name = String::Handle(); 10919 String& var_name = String::Handle();
10911 for (intptr_t i = 0; i < Length(); i++) { 10920 for (intptr_t i = 0; i < Length(); i++) {
10912 RawLocalVarDescriptors::VarInfo info; 10921 RawLocalVarDescriptors::VarInfo info;
10913 var_name = GetName(i); 10922 var_name = GetName(i);
10914 if (var_name.IsNull()) { 10923 if (var_name.IsNull()) {
10915 var_name = Symbols::Empty().raw(); 10924 var_name = Symbols::Empty().raw();
10916 } 10925 }
10917 GetInfo(i, &info); 10926 GetInfo(i, &info);
10918 JSONObject var(&members); 10927 JSONObject var(&members);
(...skipping 9435 matching lines...) Expand 10 before | Expand all | Expand 10 after
20354 return tag_label.ToCString(); 20363 return tag_label.ToCString();
20355 } 20364 }
20356 20365
20357 20366
20358 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const { 20367 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const {
20359 Instance::PrintJSONImpl(stream, ref); 20368 Instance::PrintJSONImpl(stream, ref);
20360 } 20369 }
20361 20370
20362 20371
20363 } // namespace dart 20372 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/bin/vmservice/observatory/lib/src/service/object.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698