| 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 964 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 975 | 975 |
| 976 void Instance::PrintSharedInstanceJSON(JSONObject* jsobj, bool ref) const { | 976 void Instance::PrintSharedInstanceJSON(JSONObject* jsobj, bool ref) const { |
| 977 AddCommonObjectProperties(jsobj, "Instance", ref); | 977 AddCommonObjectProperties(jsobj, "Instance", ref); |
| 978 if (ref) { | 978 if (ref) { |
| 979 return; | 979 return; |
| 980 } | 980 } |
| 981 | 981 |
| 982 // Add all fields in layout order, from superclass to subclass. | 982 // Add all fields in layout order, from superclass to subclass. |
| 983 GrowableArray<Class*> classes; | 983 GrowableArray<Class*> classes; |
| 984 Class& cls = Class::Handle(this->clazz()); | 984 Class& cls = Class::Handle(this->clazz()); |
| 985 if (IsClosure()) { |
| 986 // Closure fields are not instances. Skip them. |
| 987 cls = cls.SuperClass(); |
| 988 } |
| 985 do { | 989 do { |
| 986 classes.Add(&Class::Handle(cls.raw())); | 990 classes.Add(&Class::Handle(cls.raw())); |
| 987 cls = cls.SuperClass(); | 991 cls = cls.SuperClass(); |
| 988 } while (!cls.IsNull()); | 992 } while (!cls.IsNull()); |
| 989 | 993 |
| 990 Array& field_array = Array::Handle(); | 994 Array& field_array = Array::Handle(); |
| 991 Field& field = Field::Handle(); | 995 Field& field = Field::Handle(); |
| 992 Instance& field_value = Instance::Handle(); | 996 Instance& field_value = Instance::Handle(); |
| 993 { | 997 { |
| 994 JSONArray jsarr(jsobj, "fields"); | 998 JSONArray jsarr(jsobj, "fields"); |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1031 jsobj.AddProperty("valueAsString", "<not initialized>"); | 1035 jsobj.AddProperty("valueAsString", "<not initialized>"); |
| 1032 return; | 1036 return; |
| 1033 } else if (raw() == Object::transition_sentinel().raw()) { | 1037 } else if (raw() == Object::transition_sentinel().raw()) { |
| 1034 jsobj.AddProperty("type", "Sentinel"); | 1038 jsobj.AddProperty("type", "Sentinel"); |
| 1035 jsobj.AddProperty("kind", "BeingInitialized"); | 1039 jsobj.AddProperty("kind", "BeingInitialized"); |
| 1036 jsobj.AddProperty("valueAsString", "<being initialized>"); | 1040 jsobj.AddProperty("valueAsString", "<being initialized>"); |
| 1037 return; | 1041 return; |
| 1038 } | 1042 } |
| 1039 | 1043 |
| 1040 PrintSharedInstanceJSON(&jsobj, ref); | 1044 PrintSharedInstanceJSON(&jsobj, ref); |
| 1045 // TODO(regis): Wouldn't it be simpler to provide a Closure::PrintJSONImpl()? |
| 1041 if (IsClosure()) { | 1046 if (IsClosure()) { |
| 1042 jsobj.AddProperty("kind", "Closure"); | 1047 jsobj.AddProperty("kind", "Closure"); |
| 1043 } else { | 1048 } else { |
| 1044 jsobj.AddProperty("kind", "PlainInstance"); | 1049 jsobj.AddProperty("kind", "PlainInstance"); |
| 1045 } | 1050 } |
| 1046 jsobj.AddServiceId(*this); | 1051 jsobj.AddServiceId(*this); |
| 1047 if (IsClosure()) { | 1052 if (IsClosure()) { |
| 1053 // TODO(regis): How about closureInstantiator? |
| 1048 jsobj.AddProperty("closureFunction", | 1054 jsobj.AddProperty("closureFunction", |
| 1049 Function::Handle(Closure::Cast(*this).function())); | 1055 Function::Handle(Closure::Cast(*this).function())); |
| 1050 jsobj.AddProperty("closureContext", | 1056 jsobj.AddProperty("closureContext", |
| 1051 Context::Handle(Closure::Cast(*this).context())); | 1057 Context::Handle(Closure::Cast(*this).context())); |
| 1052 } | 1058 } |
| 1053 if (ref) { | 1059 if (ref) { |
| 1054 return; | 1060 return; |
| 1055 } | 1061 } |
| 1056 if (IsClosure()) { | 1062 if (IsClosure()) { |
| 1057 Debugger* debugger = Isolate::Current()->debugger(); | 1063 Debugger* debugger = Isolate::Current()->debugger(); |
| (...skipping 492 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1550 jsobj.AddProperty("mirrorReferent", referent_handle); | 1556 jsobj.AddProperty("mirrorReferent", referent_handle); |
| 1551 } | 1557 } |
| 1552 | 1558 |
| 1553 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const { | 1559 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const { |
| 1554 Instance::PrintJSONImpl(stream, ref); | 1560 Instance::PrintJSONImpl(stream, ref); |
| 1555 } | 1561 } |
| 1556 | 1562 |
| 1557 #endif | 1563 #endif |
| 1558 | 1564 |
| 1559 } // namespace dart | 1565 } // namespace dart |
| OLD | NEW |