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

Side by Side 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, 7 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 10016 matching lines...) Expand 10 before | Expand all | Expand 10 after
10027 PC(i), 10027 PC(i),
10028 KindAsStr(i), 10028 KindAsStr(i),
10029 DeoptId(i), 10029 DeoptId(i),
10030 TokenPos(i), 10030 TokenPos(i),
10031 TryIndex(i)); 10031 TryIndex(i));
10032 } 10032 }
10033 return buffer; 10033 return buffer;
10034 } 10034 }
10035 10035
10036 10036
10037 void PcDescriptors::PrintToJSONObject(JSONObject* jsobj) const {
10038 jsobj->AddProperty("type", JSONType(false));
10039 // TODO(johnmccutchan): Generate a valid ID.
10040 // PcDescriptors hang off a Code object but do not have a back reference to
10041 // generate an ID. Currently we only print PcDescriptors inline with a Code.
10042 jsobj->AddProperty("id", "");
10043 JSONArray members(jsobj, "members");
10044 for (intptr_t i = 0; i < Length(); i++) {
10045 JSONObject descriptor(&members);
10046 descriptor.AddPropertyF("pc", "%" Px "", PC(i));
10047 descriptor.AddProperty("kind", KindAsStr(i));
10048 descriptor.AddProperty("deoptId", DeoptId(i));
10049 descriptor.AddProperty("tokenPos", TokenPos(i));
10050 descriptor.AddProperty("tryIndex", TryIndex(i));
10051 }
10052 }
10053
10054
10037 void PcDescriptors::PrintToJSONStream(JSONStream* stream, bool ref) const { 10055 void PcDescriptors::PrintToJSONStream(JSONStream* stream, bool ref) const {
10038 Object::PrintToJSONStream(stream, ref); 10056 JSONObject jsobj(stream);
10057 PrintToJSONObject(&jsobj);
10039 } 10058 }
10040 10059
10041 10060
10042 // Verify assumptions (in debug mode only). 10061 // Verify assumptions (in debug mode only).
10043 // - No two deopt descriptors have the same deoptimization id. 10062 // - No two deopt descriptors have the same deoptimization id.
10044 // - No two ic-call descriptors have the same deoptimization id (type feedback). 10063 // - No two ic-call descriptors have the same deoptimization id (type feedback).
10045 // A function without unique ids is marked as non-optimizable (e.g., because of 10064 // A function without unique ids is marked as non-optimizable (e.g., because of
10046 // finally blocks). 10065 // finally blocks).
10047 void PcDescriptors::Verify(const Function& function) const { 10066 void PcDescriptors::Verify(const Function& function) const {
10048 #if defined(DEBUG) 10067 #if defined(DEBUG)
(...skipping 1576 matching lines...) Expand 10 before | Expand all | Expand 10 after
11625 func.AddProperty("kind", "Stub"); 11644 func.AddProperty("kind", "Stub");
11626 func.AddPropertyF("id", "functions/stub-%" Pd "", EntryPoint()); 11645 func.AddPropertyF("id", "functions/stub-%" Pd "", EntryPoint());
11627 func.AddProperty("user_name", user_name.ToCString()); 11646 func.AddProperty("user_name", user_name.ToCString());
11628 func.AddProperty("name", name.ToCString()); 11647 func.AddProperty("name", name.ToCString());
11629 } 11648 }
11630 if (ref) { 11649 if (ref) {
11631 return; 11650 return;
11632 } 11651 }
11633 const Array& array = Array::Handle(ObjectPool()); 11652 const Array& array = Array::Handle(ObjectPool());
11634 jsobj.AddProperty("object_pool", array); 11653 jsobj.AddProperty("object_pool", array);
11635 JSONArray jsarr(&jsobj, "disassembly"); 11654 {
11636 if (is_alive()) { 11655 JSONArray jsarr(&jsobj, "disassembly");
11637 // Only disassemble alive code objects. 11656 if (is_alive()) {
11638 DisassembleToJSONStream formatter(jsarr); 11657 // Only disassemble alive code objects.
11639 Disassemble(&formatter); 11658 DisassembleToJSONStream formatter(jsarr);
11659 Disassemble(&formatter);
11660 }
11661 }
11662 const PcDescriptors& descriptors = PcDescriptors::Handle(pc_descriptors());
11663 if (!descriptors.IsNull()) {
11664 JSONObject desc(&jsobj, "descriptors");
11665 descriptors.PrintToJSONObject(&desc);
11640 } 11666 }
11641 } 11667 }
11642 11668
11643 11669
11644 uword Code::GetPatchCodePc() const { 11670 uword Code::GetPatchCodePc() const {
11645 const PcDescriptors& descriptors = PcDescriptors::Handle(pc_descriptors()); 11671 const PcDescriptors& descriptors = PcDescriptors::Handle(pc_descriptors());
11646 return descriptors.GetPcForKind(PcDescriptors::kPatchCode); 11672 return descriptors.GetPcForKind(PcDescriptors::kPatchCode);
11647 } 11673 }
11648 11674
11649 11675
(...skipping 1762 matching lines...) Expand 10 before | Expand all | Expand 10 after
13412 13438
13413 13439
13414 const char* AbstractType::ToCString() const { 13440 const char* AbstractType::ToCString() const {
13415 // AbstractType is an abstract class. 13441 // AbstractType is an abstract class.
13416 UNREACHABLE(); 13442 UNREACHABLE();
13417 return "AbstractType"; 13443 return "AbstractType";
13418 } 13444 }
13419 13445
13420 13446
13421 void AbstractType::PrintToJSONStream(JSONStream* stream, bool ref) const { 13447 void AbstractType::PrintToJSONStream(JSONStream* stream, bool ref) const {
13448 if (IsNull()) {
13449 Instance::PrintToJSONStream(stream, ref);
13450 return;
13451 }
13422 UNREACHABLE(); 13452 UNREACHABLE();
13423 } 13453 }
13424 13454
13425 13455
13426 RawType* Type::NullType() { 13456 RawType* Type::NullType() {
13427 return Isolate::Current()->object_store()->null_type(); 13457 return Isolate::Current()->object_store()->null_type();
13428 } 13458 }
13429 13459
13430 13460
13431 RawType* Type::DynamicType() { 13461 RawType* Type::DynamicType() {
(...skipping 5208 matching lines...) Expand 10 before | Expand all | Expand 10 after
18640 return tag_label.ToCString(); 18670 return tag_label.ToCString();
18641 } 18671 }
18642 18672
18643 18673
18644 void UserTag::PrintToJSONStream(JSONStream* stream, bool ref) const { 18674 void UserTag::PrintToJSONStream(JSONStream* stream, bool ref) const {
18645 Instance::PrintToJSONStream(stream, ref); 18675 Instance::PrintToJSONStream(stream, ref);
18646 } 18676 }
18647 18677
18648 18678
18649 } // namespace dart 18679 } // namespace dart
OLDNEW
« runtime/bin/vmservice/client/lib/src/service/object.dart ('K') | « runtime/vm/object.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698