OLD | NEW |
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 6961 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6972 jsobj.AddProperty("_kind", kind_string); | 6972 jsobj.AddProperty("_kind", kind_string); |
6973 jsobj.AddProperty("static", is_static()); | 6973 jsobj.AddProperty("static", is_static()); |
6974 jsobj.AddProperty("const", is_const()); | 6974 jsobj.AddProperty("const", is_const()); |
6975 if (ref) { | 6975 if (ref) { |
6976 return; | 6976 return; |
6977 } | 6977 } |
6978 Code& code = Code::Handle(CurrentCode()); | 6978 Code& code = Code::Handle(CurrentCode()); |
6979 if (!code.IsNull()) { | 6979 if (!code.IsNull()) { |
6980 jsobj.AddProperty("code", code); | 6980 jsobj.AddProperty("code", code); |
6981 } | 6981 } |
| 6982 Array& ics = Array::Handle(ic_data_array()); |
| 6983 if (!ics.IsNull()) { |
| 6984 jsobj.AddProperty("_icDataArray", ics); |
| 6985 } |
6982 jsobj.AddProperty("_optimizable", is_optimizable()); | 6986 jsobj.AddProperty("_optimizable", is_optimizable()); |
6983 jsobj.AddProperty("_inlinable", is_inlinable()); | 6987 jsobj.AddProperty("_inlinable", is_inlinable()); |
6984 code = unoptimized_code(); | 6988 code = unoptimized_code(); |
6985 if (!code.IsNull()) { | 6989 if (!code.IsNull()) { |
6986 jsobj.AddProperty("_unoptimizedCode", code); | 6990 jsobj.AddProperty("_unoptimizedCode", code); |
6987 } | 6991 } |
6988 jsobj.AddProperty("_usageCounter", usage_counter()); | 6992 jsobj.AddProperty("_usageCounter", usage_counter()); |
6989 jsobj.AddProperty("_optimizedCallSiteCount", optimized_call_site_count()); | 6993 jsobj.AddProperty("_optimizedCallSiteCount", optimized_call_site_count()); |
6990 jsobj.AddProperty("_deoptimizations", | 6994 jsobj.AddProperty("_deoptimizations", |
6991 static_cast<intptr_t>(deoptimization_counter())); | 6995 static_cast<intptr_t>(deoptimization_counter())); |
(...skipping 3710 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10702 return result.raw(); | 10706 return result.raw(); |
10703 } | 10707 } |
10704 | 10708 |
10705 | 10709 |
10706 const char* Instructions::ToCString() const { | 10710 const char* Instructions::ToCString() const { |
10707 return "Instructions"; | 10711 return "Instructions"; |
10708 } | 10712 } |
10709 | 10713 |
10710 | 10714 |
10711 void Instructions::PrintJSONImpl(JSONStream* stream, bool ref) const { | 10715 void Instructions::PrintJSONImpl(JSONStream* stream, bool ref) const { |
10712 Object::PrintJSONImpl(stream, ref); | 10716 JSONObject jsobj(stream); |
| 10717 AddCommonObjectProperties(&jsobj, "Object", ref); |
| 10718 jsobj.AddServiceId(*this); |
| 10719 jsobj.AddProperty("_code", Code::Handle(code())); |
| 10720 if (ref) { |
| 10721 return; |
| 10722 } |
| 10723 jsobj.AddProperty("_objectPool", ObjectPool::Handle(object_pool())); |
10713 } | 10724 } |
10714 | 10725 |
10715 | 10726 |
10716 // Encode integer in SLEB128 format. | 10727 // Encode integer in SLEB128 format. |
10717 void PcDescriptors::EncodeInteger(GrowableArray<uint8_t>* data, | 10728 void PcDescriptors::EncodeInteger(GrowableArray<uint8_t>* data, |
10718 intptr_t value) { | 10729 intptr_t value) { |
10719 bool is_last_part = false; | 10730 bool is_last_part = false; |
10720 while (!is_last_part) { | 10731 while (!is_last_part) { |
10721 intptr_t part = value & 0x7f; | 10732 intptr_t part = value & 0x7f; |
10722 value >>= 7; | 10733 value >>= 7; |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10793 const TypedData& array = TypedData::Handle(info_array()); | 10804 const TypedData& array = TypedData::Handle(info_array()); |
10794 array.SetInt8(index, static_cast<int8_t>(info)); | 10805 array.SetInt8(index, static_cast<int8_t>(info)); |
10795 } | 10806 } |
10796 | 10807 |
10797 const char* ObjectPool::ToCString() const { | 10808 const char* ObjectPool::ToCString() const { |
10798 return "ObjectPool"; | 10809 return "ObjectPool"; |
10799 } | 10810 } |
10800 | 10811 |
10801 | 10812 |
10802 void ObjectPool::PrintJSONImpl(JSONStream* stream, bool ref) const { | 10813 void ObjectPool::PrintJSONImpl(JSONStream* stream, bool ref) const { |
10803 Object::PrintJSONImpl(stream, ref); | 10814 JSONObject jsobj(stream); |
| 10815 AddCommonObjectProperties(&jsobj, "Object", ref); |
| 10816 jsobj.AddServiceId(*this); |
| 10817 jsobj.AddProperty("length", Length()); |
| 10818 if (ref) { |
| 10819 return; |
| 10820 } |
| 10821 |
| 10822 { |
| 10823 JSONArray jsarr(&jsobj, "_entries"); |
| 10824 uword imm; |
| 10825 Object& obj = Object::Handle(); |
| 10826 for (intptr_t i = 0; i < Length(); i++) { |
| 10827 switch (InfoAt(i)) { |
| 10828 case ObjectPool::kTaggedObject: |
| 10829 obj = ObjectAt(i); |
| 10830 jsarr.AddValue(obj); |
| 10831 break; |
| 10832 case ObjectPool::kImmediate: |
| 10833 // We might want to distingiush between immediates and addresses |
| 10834 // in the future. |
| 10835 imm = RawValueAt(i); |
| 10836 jsarr.AddValue64(imm); |
| 10837 break; |
| 10838 default: |
| 10839 UNREACHABLE(); |
| 10840 } |
| 10841 } |
| 10842 } |
10804 } | 10843 } |
10805 | 10844 |
10806 | 10845 |
10807 void ObjectPool::DebugPrint() const { | 10846 void ObjectPool::DebugPrint() const { |
10808 ISL_Print("Object Pool: {\n"); | 10847 ISL_Print("Object Pool: {\n"); |
10809 for (intptr_t i = 0; i < Length(); i++) { | 10848 for (intptr_t i = 0; i < Length(); i++) { |
10810 if (InfoAt(i) == kTaggedObject) { | 10849 if (InfoAt(i) == kTaggedObject) { |
10811 ISL_Print(" %" Pd ": 0x%" Px " %s (obj)\n", i, | 10850 ISL_Print(" %" Pd ": 0x%" Px " %s (obj)\n", i, |
10812 reinterpret_cast<uword>(ObjectAt(i)), | 10851 reinterpret_cast<uword>(ObjectAt(i)), |
10813 Object::Handle(ObjectAt(i)).ToCString()); | 10852 Object::Handle(ObjectAt(i)).ToCString()); |
(...skipping 1391 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
12205 Array::Handle(from.arguments_descriptor()), | 12244 Array::Handle(from.arguments_descriptor()), |
12206 from.deopt_id(), | 12245 from.deopt_id(), |
12207 num_args_tested)); | 12246 num_args_tested)); |
12208 // Copy deoptimization reasons. | 12247 // Copy deoptimization reasons. |
12209 result.SetDeoptReasons(from.DeoptReasons()); | 12248 result.SetDeoptReasons(from.DeoptReasons()); |
12210 return result.raw(); | 12249 return result.raw(); |
12211 } | 12250 } |
12212 | 12251 |
12213 | 12252 |
12214 void ICData::PrintJSONImpl(JSONStream* stream, bool ref) const { | 12253 void ICData::PrintJSONImpl(JSONStream* stream, bool ref) const { |
12215 Object::PrintJSONImpl(stream, ref); | 12254 JSONObject jsobj(stream); |
| 12255 AddCommonObjectProperties(&jsobj, "Object", ref); |
| 12256 jsobj.AddServiceId(*this); |
| 12257 jsobj.AddProperty("_owner", Object::Handle(owner())); |
| 12258 jsobj.AddProperty("_selector", String::Handle(target_name()).ToCString()); |
| 12259 if (ref) { |
| 12260 return; |
| 12261 } |
| 12262 jsobj.AddProperty("_argumentsDescriptor", |
| 12263 Object::Handle(arguments_descriptor())); |
| 12264 jsobj.AddProperty("_entries", Object::Handle(ic_data())); |
12216 } | 12265 } |
12217 | 12266 |
12218 | 12267 |
12219 void ICData::PrintToJSONArray(const JSONArray& jsarray, | 12268 void ICData::PrintToJSONArray(const JSONArray& jsarray, |
12220 intptr_t token_pos, | 12269 intptr_t token_pos, |
12221 bool is_static_call) const { | 12270 bool is_static_call) const { |
12222 Isolate* isolate = Isolate::Current(); | 12271 Isolate* isolate = Isolate::Current(); |
12223 Class& cls = Class::Handle(); | 12272 Class& cls = Class::Handle(); |
12224 Function& func = Function::Handle(); | 12273 Function& func = Function::Handle(); |
12225 | 12274 |
(...skipping 741 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
12967 if (ref) { | 13016 if (ref) { |
12968 return; | 13017 return; |
12969 } | 13018 } |
12970 const Object& obj = Object::Handle(owner()); | 13019 const Object& obj = Object::Handle(owner()); |
12971 if (obj.IsFunction()) { | 13020 if (obj.IsFunction()) { |
12972 jsobj.AddProperty("function", obj); | 13021 jsobj.AddProperty("function", obj); |
12973 } else { | 13022 } else { |
12974 // Generate a fake function reference. | 13023 // Generate a fake function reference. |
12975 JSONObject func(&jsobj, "function"); | 13024 JSONObject func(&jsobj, "function"); |
12976 func.AddProperty("type", "@Function"); | 13025 func.AddProperty("type", "@Function"); |
12977 func.AddProperty("kind", "Stub"); | 13026 func.AddProperty("_kind", "Stub"); |
12978 func.AddProperty("name", user_name.ToCString()); | 13027 func.AddProperty("name", user_name.ToCString()); |
12979 AddNameProperties(&func, user_name, vm_name); | 13028 AddNameProperties(&func, user_name, vm_name); |
12980 } | 13029 } |
12981 jsobj.AddPropertyF("_startAddress", "%" Px "", EntryPoint()); | 13030 jsobj.AddPropertyF("_startAddress", "%" Px "", EntryPoint()); |
12982 jsobj.AddPropertyF("_endAddress", "%" Px "", EntryPoint() + Size()); | 13031 jsobj.AddPropertyF("_endAddress", "%" Px "", EntryPoint() + Size()); |
12983 jsobj.AddProperty("_alive", is_alive()); | 13032 jsobj.AddProperty("_alive", is_alive()); |
12984 const ObjectPool& object_pool = ObjectPool::Handle(GetObjectPool()); | 13033 const ObjectPool& object_pool = ObjectPool::Handle(GetObjectPool()); |
12985 jsobj.AddProperty("_objectPool", object_pool); | 13034 jsobj.AddProperty("_objectPool", object_pool); |
12986 { | 13035 { |
12987 JSONArray jsarr(&jsobj, "_disassembly"); | 13036 JSONArray jsarr(&jsobj, "_disassembly"); |
(...skipping 8113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
21101 return tag_label.ToCString(); | 21150 return tag_label.ToCString(); |
21102 } | 21151 } |
21103 | 21152 |
21104 | 21153 |
21105 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const { | 21154 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const { |
21106 Instance::PrintJSONImpl(stream, ref); | 21155 Instance::PrintJSONImpl(stream, ref); |
21107 } | 21156 } |
21108 | 21157 |
21109 | 21158 |
21110 } // namespace dart | 21159 } // namespace dart |
OLD | NEW |