OLD | NEW |
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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/debugger.h" | 5 #include "vm/debugger.h" |
6 #include "vm/disassembler.h" | 6 #include "vm/disassembler.h" |
7 #include "vm/object.h" | 7 #include "vm/object.h" |
8 #include "vm/object_store.h" | 8 #include "vm/object_store.h" |
9 #include "vm/stub_code.h" | 9 #include "vm/stub_code.h" |
10 #include "vm/symbols.h" | 10 #include "vm/symbols.h" |
(...skipping 747 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
758 if (ref) { | 758 if (ref) { |
759 return; | 759 return; |
760 } | 760 } |
761 jsobj.AddProperty("_argumentsDescriptor", | 761 jsobj.AddProperty("_argumentsDescriptor", |
762 Object::Handle(arguments_descriptor())); | 762 Object::Handle(arguments_descriptor())); |
763 jsobj.AddProperty("_entries", Object::Handle(ic_data())); | 763 jsobj.AddProperty("_entries", Object::Handle(ic_data())); |
764 } | 764 } |
765 | 765 |
766 | 766 |
767 void ICData::PrintToJSONArray(const JSONArray& jsarray, | 767 void ICData::PrintToJSONArray(const JSONArray& jsarray, |
768 TokenPosition token_pos, | 768 TokenPosition token_pos) const { |
769 bool is_static_call) const { | |
770 Isolate* isolate = Isolate::Current(); | 769 Isolate* isolate = Isolate::Current(); |
771 Class& cls = Class::Handle(); | 770 Class& cls = Class::Handle(); |
772 Function& func = Function::Handle(); | 771 Function& func = Function::Handle(); |
773 | |
774 JSONObject jsobj(&jsarray); | |
775 jsobj.AddProperty("name", String::Handle(target_name()).ToCString()); | |
776 jsobj.AddProperty("tokenPos", token_pos); | |
777 // TODO(rmacnak): Figure out how to stringify DeoptReasons(). | |
778 // jsobj.AddProperty("deoptReasons", ...); | |
779 | |
780 JSONArray cache_entries(&jsobj, "cacheEntries"); | |
781 for (intptr_t i = 0; i < NumberOfChecks(); i++) { | |
782 func = GetTargetAt(i); | |
783 if (is_static_call) { | |
784 cls ^= func.Owner(); | |
785 } else { | |
786 intptr_t cid = GetReceiverClassIdAt(i); | |
787 cls ^= isolate->class_table()->At(cid); | |
788 } | |
789 intptr_t count = GetCountAt(i); | |
790 JSONObject cache_entry(&cache_entries); | |
791 if (cls.IsTopLevel()) { | |
792 cache_entry.AddProperty("receiverContainer", | |
793 Library::Handle(cls.library())); | |
794 } else { | |
795 cache_entry.AddProperty("receiverContainer", cls); | |
796 } | |
797 cache_entry.AddProperty("count", count); | |
798 cache_entry.AddProperty("target", func); | |
799 } | |
800 } | |
801 | |
802 | |
803 void ICData::PrintToJSONArrayNew(const JSONArray& jsarray, | |
804 TokenPosition token_pos, | |
805 bool is_static_call) const { | |
806 Isolate* isolate = Isolate::Current(); | |
807 Class& cls = Class::Handle(); | |
808 Function& func = Function::Handle(); | |
809 | 772 |
810 JSONObject jsobj(&jsarray); | 773 JSONObject jsobj(&jsarray); |
811 jsobj.AddProperty("name", String::Handle(target_name()).ToCString()); | 774 jsobj.AddProperty("name", String::Handle(target_name()).ToCString()); |
812 jsobj.AddProperty("tokenPos", token_pos.value()); | 775 jsobj.AddProperty("tokenPos", token_pos.value()); |
813 // TODO(rmacnak): Figure out how to stringify DeoptReasons(). | 776 // TODO(rmacnak): Figure out how to stringify DeoptReasons(). |
814 // jsobj.AddProperty("deoptReasons", ...); | 777 // jsobj.AddProperty("deoptReasons", ...); |
815 | 778 |
816 JSONArray cache_entries(&jsobj, "cacheEntries"); | 779 JSONArray cache_entries(&jsobj, "cacheEntries"); |
817 for (intptr_t i = 0; i < NumberOfChecks(); i++) { | 780 for (intptr_t i = 0; i < NumberOfChecks(); i++) { |
818 JSONObject cache_entry(&cache_entries); | 781 JSONObject cache_entry(&cache_entries); |
819 func = GetTargetAt(i); | 782 func = GetTargetAt(i); |
820 intptr_t count = GetCountAt(i); | 783 intptr_t count = GetCountAt(i); |
821 if (!is_static_call) { | 784 if (!is_static_call()) { |
822 intptr_t cid = GetReceiverClassIdAt(i); | 785 intptr_t cid = GetReceiverClassIdAt(i); |
823 cls ^= isolate->class_table()->At(cid); | 786 cls ^= isolate->class_table()->At(cid); |
824 cache_entry.AddProperty("receiver", cls); | 787 cache_entry.AddProperty("receiver", cls); |
825 } | 788 } |
826 cache_entry.AddProperty("target", func); | 789 cache_entry.AddProperty("target", func); |
827 cache_entry.AddProperty("count", count); | 790 cache_entry.AddProperty("count", count); |
828 } | 791 } |
829 } | 792 } |
830 | 793 |
831 | 794 |
(...skipping 765 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1597 jsobj.AddProperty("mirrorReferent", referent_handle); | 1560 jsobj.AddProperty("mirrorReferent", referent_handle); |
1598 } | 1561 } |
1599 | 1562 |
1600 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const { | 1563 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const { |
1601 Instance::PrintJSONImpl(stream, ref); | 1564 Instance::PrintJSONImpl(stream, ref); |
1602 } | 1565 } |
1603 | 1566 |
1604 #endif | 1567 #endif |
1605 | 1568 |
1606 } // namespace dart | 1569 } // namespace dart |
OLD | NEW |