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 13112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
13123 for (intptr_t i = 0; i < NumNativeFields(); i++) { | 13123 for (intptr_t i = 0; i < NumNativeFields(); i++) { |
13124 intptr_t value = GetNativeField(i); | 13124 intptr_t value = GetNativeField(i); |
13125 JSONObject jsfield(&jsarr); | 13125 JSONObject jsfield(&jsarr); |
13126 jsfield.AddProperty("index", i); | 13126 jsfield.AddProperty("index", i); |
13127 jsfield.AddProperty("value", value); | 13127 jsfield.AddProperty("value", value); |
13128 } | 13128 } |
13129 } | 13129 } |
13130 } | 13130 } |
13131 | 13131 |
13132 | 13132 |
| 13133 void Object::PrintJSONImpl(JSONStream* stream, bool ref) const { |
| 13134 JSONObject jsobj(stream); |
| 13135 jsobj.AddProperty("type", JSONType(ref)); |
| 13136 ObjectIdRing* ring = Isolate::Current()->object_id_ring(); |
| 13137 const intptr_t id = ring->GetIdForObject(raw()); |
| 13138 jsobj.AddPropertyF("id", "objects/%" Pd "", id); |
| 13139 } |
| 13140 |
| 13141 |
13133 void Instance::PrintJSONImpl(JSONStream* stream, bool ref) const { | 13142 void Instance::PrintJSONImpl(JSONStream* stream, bool ref) const { |
13134 JSONObject jsobj(stream); | 13143 JSONObject jsobj(stream); |
13135 | 13144 |
13136 // Handle certain special instance values. | 13145 // Handle certain special instance values. |
13137 if (raw() == Object::sentinel().raw()) { | 13146 if (raw() == Object::sentinel().raw()) { |
13138 jsobj.AddProperty("type", ref ? "@Null" : "Null"); | 13147 jsobj.AddProperty("type", ref ? "@Null" : "Null"); |
13139 jsobj.AddProperty("id", "objects/not-initialized"); | 13148 jsobj.AddProperty("id", "objects/not-initialized"); |
13140 jsobj.AddProperty("valueAsString", "<not initialized>"); | 13149 jsobj.AddProperty("valueAsString", "<not initialized>"); |
13141 return; | 13150 return; |
13142 } else if (raw() == Object::transition_sentinel().raw()) { | 13151 } else if (raw() == Object::transition_sentinel().raw()) { |
(...skipping 5703 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
18846 return tag_label.ToCString(); | 18855 return tag_label.ToCString(); |
18847 } | 18856 } |
18848 | 18857 |
18849 | 18858 |
18850 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const { | 18859 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const { |
18851 Instance::PrintJSONImpl(stream, ref); | 18860 Instance::PrintJSONImpl(stream, ref); |
18852 } | 18861 } |
18853 | 18862 |
18854 | 18863 |
18855 } // namespace dart | 18864 } // namespace dart |
OLD | NEW |