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

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

Powered by Google App Engine
This is Rietveld 408576698