| 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 4067 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4078 const Library& lib = Library::Handle(library()); | 4078 const Library& lib = Library::Handle(library()); |
| 4079 const char* library_name = lib.IsNull() ? "" : lib.ToCString(); | 4079 const char* library_name = lib.IsNull() ? "" : lib.ToCString(); |
| 4080 const char* class_name = String::Handle(Name()).ToCString(); | 4080 const char* class_name = String::Handle(Name()).ToCString(); |
| 4081 intptr_t len = OS::SNPrint(NULL, 0, format, library_name, class_name) + 1; | 4081 intptr_t len = OS::SNPrint(NULL, 0, format, library_name, class_name) + 1; |
| 4082 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); | 4082 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); |
| 4083 OS::SNPrint(chars, len, format, library_name, class_name); | 4083 OS::SNPrint(chars, len, format, library_name, class_name); |
| 4084 return chars; | 4084 return chars; |
| 4085 } | 4085 } |
| 4086 | 4086 |
| 4087 | 4087 |
| 4088 static void AddNameProperties(JSONObject* jsobj, |
| 4089 const String& name, |
| 4090 const String& vm_name) { |
| 4091 jsobj->AddProperty("name", name.ToCString()); |
| 4092 if (!name.Equals(vm_name)) { |
| 4093 jsobj->AddProperty("vmName", vm_name.ToCString()); |
| 4094 } |
| 4095 } |
| 4096 |
| 4097 |
| 4088 void Class::PrintJSONImpl(JSONStream* stream, bool ref) const { | 4098 void Class::PrintJSONImpl(JSONStream* stream, bool ref) const { |
| 4089 JSONObject jsobj(stream); | 4099 JSONObject jsobj(stream); |
| 4090 if ((raw() == Class::null()) || (id() == kFreeListElement)) { | 4100 if ((raw() == Class::null()) || (id() == kFreeListElement)) { |
| 4091 jsobj.AddProperty("type", "Null"); | 4101 jsobj.AddProperty("type", "Null"); |
| 4092 return; | 4102 return; |
| 4093 } | 4103 } |
| 4094 const char* internal_class_name = String::Handle(Name()).ToCString(); | |
| 4095 const char* pretty_class_name = | |
| 4096 String::Handle(PrettyName()).ToCString(); | |
| 4097 jsobj.AddProperty("type", JSONType(ref)); | 4104 jsobj.AddProperty("type", JSONType(ref)); |
| 4098 jsobj.AddPropertyF("id", "classes/%" Pd "", id()); | 4105 jsobj.AddPropertyF("id", "classes/%" Pd "", id()); |
| 4099 jsobj.AddProperty("name", internal_class_name); | 4106 const String& user_name = String::Handle(PrettyName()); |
| 4100 jsobj.AddProperty("user_name", pretty_class_name); | 4107 const String& vm_name = String::Handle(Name()); |
| 4108 AddNameProperties(&jsobj, user_name, vm_name); |
| 4101 if (ref) { | 4109 if (ref) { |
| 4102 return; | 4110 return; |
| 4103 } | 4111 } |
| 4104 | 4112 |
| 4105 const Error& err = Error::Handle(EnsureIsFinalized(Isolate::Current())); | 4113 const Error& err = Error::Handle(EnsureIsFinalized(Isolate::Current())); |
| 4106 if (!err.IsNull()) { | 4114 if (!err.IsNull()) { |
| 4107 jsobj.AddProperty("error", err); | 4115 jsobj.AddProperty("error", err); |
| 4108 } | 4116 } |
| 4109 jsobj.AddProperty("implemented", is_implemented()); | 4117 jsobj.AddProperty("implemented", is_implemented()); |
| 4110 jsobj.AddProperty("abstract", is_abstract()); | 4118 jsobj.AddProperty("abstract", is_abstract()); |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4171 for (intptr_t i = 0; i < subclasses.Length(); ++i) { | 4179 for (intptr_t i = 0; i < subclasses.Length(); ++i) { |
| 4172 // TODO(turnidge): Use the Type directly once regis has added | 4180 // TODO(turnidge): Use the Type directly once regis has added |
| 4173 // types to the vmservice. | 4181 // types to the vmservice. |
| 4174 subclass ^= subclasses.At(i); | 4182 subclass ^= subclasses.At(i); |
| 4175 subclasses_array.AddValue(subclass); | 4183 subclasses_array.AddValue(subclass); |
| 4176 } | 4184 } |
| 4177 } | 4185 } |
| 4178 } | 4186 } |
| 4179 } | 4187 } |
| 4180 { | 4188 { |
| 4181 JSONObject typesRef(&jsobj, "canonicalTypes"); | |
| 4182 typesRef.AddProperty("type", "@TypeList"); | |
| 4183 typesRef.AddPropertyF("id", "classes/%" Pd "/types", id()); | |
| 4184 jsobj.AddPropertyF("name", "canonical types of %s", internal_class_name); | |
| 4185 jsobj.AddPropertyF("user_name", "canonical types of %s", pretty_class_name); | |
| 4186 } | |
| 4187 { | |
| 4188 ClassTable* class_table = Isolate::Current()->class_table(); | 4189 ClassTable* class_table = Isolate::Current()->class_table(); |
| 4189 const ClassHeapStats* stats = class_table->StatsWithUpdatedSize(id()); | 4190 const ClassHeapStats* stats = class_table->StatsWithUpdatedSize(id()); |
| 4190 if (stats != NULL) { | 4191 if (stats != NULL) { |
| 4191 JSONObject allocation_stats(&jsobj, "allocationStats"); | 4192 JSONObject allocation_stats(&jsobj, "allocationStats"); |
| 4192 stats->PrintToJSONObject(*this, &allocation_stats); | 4193 stats->PrintToJSONObject(*this, &allocation_stats); |
| 4193 } | 4194 } |
| 4194 } | 4195 } |
| 4195 } | 4196 } |
| 4196 | 4197 |
| 4197 | 4198 |
| (...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4435 // the object id (as in typearguments/id), because the indices are not | 4436 // the object id (as in typearguments/id), because the indices are not |
| 4436 // preserved when the table grows and the entries get rehashed. Use the ring. | 4437 // preserved when the table grows and the entries get rehashed. Use the ring. |
| 4437 Isolate* isolate = Isolate::Current(); | 4438 Isolate* isolate = Isolate::Current(); |
| 4438 ObjectStore* object_store = isolate->object_store(); | 4439 ObjectStore* object_store = isolate->object_store(); |
| 4439 const Array& table = Array::Handle(object_store->canonical_type_arguments()); | 4440 const Array& table = Array::Handle(object_store->canonical_type_arguments()); |
| 4440 ASSERT(table.Length() > 0); | 4441 ASSERT(table.Length() > 0); |
| 4441 ObjectIdRing* ring = Isolate::Current()->object_id_ring(); | 4442 ObjectIdRing* ring = Isolate::Current()->object_id_ring(); |
| 4442 const intptr_t id = ring->GetIdForObject(raw()); | 4443 const intptr_t id = ring->GetIdForObject(raw()); |
| 4443 jsobj.AddProperty("type", JSONType(ref)); | 4444 jsobj.AddProperty("type", JSONType(ref)); |
| 4444 jsobj.AddPropertyF("id", "objects/%" Pd "", id); | 4445 jsobj.AddPropertyF("id", "objects/%" Pd "", id); |
| 4445 const char* name = String::Handle(Name()).ToCString(); | 4446 const String& user_name = String::Handle(PrettyName()); |
| 4446 const char* pretty_name = String::Handle(PrettyName()).ToCString(); | 4447 const String& vm_name = String::Handle(Name()); |
| 4447 jsobj.AddProperty("name", name); | 4448 AddNameProperties(&jsobj, user_name, vm_name); |
| 4448 jsobj.AddProperty("user_name", pretty_name); | |
| 4449 jsobj.AddProperty("length", Length()); | 4449 jsobj.AddProperty("length", Length()); |
| 4450 jsobj.AddProperty("num_instantiations", NumInstantiations()); | 4450 jsobj.AddProperty("num_instantiations", NumInstantiations()); |
| 4451 if (ref) { | 4451 if (ref) { |
| 4452 return; | 4452 return; |
| 4453 } | 4453 } |
| 4454 { | 4454 { |
| 4455 JSONArray jsarr(&jsobj, "types"); | 4455 JSONArray jsarr(&jsobj, "types"); |
| 4456 AbstractType& type_arg = AbstractType::Handle(); | 4456 AbstractType& type_arg = AbstractType::Handle(); |
| 4457 for (intptr_t i = 0; i < Length(); i++) { | 4457 for (intptr_t i = 0; i < Length(); i++) { |
| 4458 type_arg = TypeAt(i); | 4458 type_arg = TypeAt(i); |
| (...skipping 2323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6782 // Oddball functions (not known to their owner) fall back to use the object | 6782 // Oddball functions (not known to their owner) fall back to use the object |
| 6783 // id ring. Current known examples are signature functions of closures | 6783 // id ring. Current known examples are signature functions of closures |
| 6784 // and stubs like 'megamorphic_miss'. | 6784 // and stubs like 'megamorphic_miss'. |
| 6785 ObjectIdRing* ring = Isolate::Current()->object_id_ring(); | 6785 ObjectIdRing* ring = Isolate::Current()->object_id_ring(); |
| 6786 id = ring->GetIdForObject(f.raw()); | 6786 id = ring->GetIdForObject(f.raw()); |
| 6787 return zone->PrintToString("objects/%" Pd "", id); | 6787 return zone->PrintToString("objects/%" Pd "", id); |
| 6788 } | 6788 } |
| 6789 | 6789 |
| 6790 | 6790 |
| 6791 void Function::PrintJSONImpl(JSONStream* stream, bool ref) const { | 6791 void Function::PrintJSONImpl(JSONStream* stream, bool ref) const { |
| 6792 const char* internal_name = String::Handle(name()).ToCString(); | |
| 6793 const char* pretty_name = | |
| 6794 String::Handle(PrettyName()).ToCString(); | |
| 6795 Class& cls = Class::Handle(Owner()); | 6792 Class& cls = Class::Handle(Owner()); |
| 6796 ASSERT(!cls.IsNull()); | 6793 ASSERT(!cls.IsNull()); |
| 6797 Error& err = Error::Handle(); | 6794 Error& err = Error::Handle(); |
| 6798 err ^= cls.EnsureIsFinalized(Isolate::Current()); | 6795 err ^= cls.EnsureIsFinalized(Isolate::Current()); |
| 6799 ASSERT(err.IsNull()); | 6796 ASSERT(err.IsNull()); |
| 6800 JSONObject jsobj(stream); | 6797 JSONObject jsobj(stream); |
| 6801 jsobj.AddProperty("type", JSONType(ref)); | 6798 jsobj.AddProperty("type", JSONType(ref)); |
| 6802 jsobj.AddProperty("id", GetFunctionServiceId(*this, cls)); | 6799 jsobj.AddProperty("id", GetFunctionServiceId(*this, cls)); |
| 6803 jsobj.AddProperty("name", internal_name); | 6800 const String& user_name = String::Handle(PrettyName()); |
| 6804 jsobj.AddProperty("user_name", pretty_name); | 6801 const String& vm_name = String::Handle(name()); |
| 6802 AddNameProperties(&jsobj, user_name, vm_name); |
| 6805 if (cls.IsTopLevel()) { | 6803 if (cls.IsTopLevel()) { |
| 6806 const Library& library = Library::Handle(cls.library()); | 6804 const Library& library = Library::Handle(cls.library()); |
| 6807 jsobj.AddProperty("owningLibrary", library); | 6805 jsobj.AddProperty("owningLibrary", library); |
| 6808 } else { | 6806 } else { |
| 6809 jsobj.AddProperty("owningClass", cls); | 6807 jsobj.AddProperty("owningClass", cls); |
| 6810 } | 6808 } |
| 6811 const Function& parent = Function::Handle(parent_function()); | 6809 const Function& parent = Function::Handle(parent_function()); |
| 6812 if (!parent.IsNull()) { | 6810 if (!parent.IsNull()) { |
| 6813 jsobj.AddProperty("parent", parent); | 6811 jsobj.AddProperty("parent", parent); |
| 6814 } | 6812 } |
| (...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7132 const char* cls_name = String::Handle(cls.Name()).ToCString(); | 7130 const char* cls_name = String::Handle(cls.Name()).ToCString(); |
| 7133 intptr_t len = | 7131 intptr_t len = |
| 7134 OS::SNPrint(NULL, 0, kFormat, cls_name, field_name, kF0, kF1, kF2) + 1; | 7132 OS::SNPrint(NULL, 0, kFormat, cls_name, field_name, kF0, kF1, kF2) + 1; |
| 7135 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); | 7133 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); |
| 7136 OS::SNPrint(chars, len, kFormat, cls_name, field_name, kF0, kF1, kF2); | 7134 OS::SNPrint(chars, len, kFormat, cls_name, field_name, kF0, kF1, kF2); |
| 7137 return chars; | 7135 return chars; |
| 7138 } | 7136 } |
| 7139 | 7137 |
| 7140 void Field::PrintJSONImpl(JSONStream* stream, bool ref) const { | 7138 void Field::PrintJSONImpl(JSONStream* stream, bool ref) const { |
| 7141 JSONObject jsobj(stream); | 7139 JSONObject jsobj(stream); |
| 7142 const char* internal_field_name = String::Handle(name()).ToCString(); | |
| 7143 const char* field_name = String::Handle(PrettyName()).ToCString(); | |
| 7144 Class& cls = Class::Handle(owner()); | 7140 Class& cls = Class::Handle(owner()); |
| 7145 intptr_t id = cls.FindFieldIndex(*this); | 7141 intptr_t id = cls.FindFieldIndex(*this); |
| 7146 ASSERT(id >= 0); | 7142 ASSERT(id >= 0); |
| 7147 intptr_t cid = cls.id(); | 7143 intptr_t cid = cls.id(); |
| 7148 jsobj.AddProperty("type", JSONType(ref)); | 7144 jsobj.AddProperty("type", JSONType(ref)); |
| 7149 jsobj.AddPropertyF("id", "classes/%" Pd "/fields/%" Pd "", cid, id); | 7145 jsobj.AddPropertyF("id", "classes/%" Pd "/fields/%" Pd "", cid, id); |
| 7150 jsobj.AddProperty("name", internal_field_name); | 7146 const String& user_name = String::Handle(PrettyName()); |
| 7151 jsobj.AddProperty("user_name", field_name); | 7147 const String& vm_name = String::Handle(name()); |
| 7148 AddNameProperties(&jsobj, user_name, vm_name); |
| 7152 if (is_static()) { | 7149 if (is_static()) { |
| 7153 const Instance& valueObj = Instance::Handle(value()); | 7150 const Instance& valueObj = Instance::Handle(value()); |
| 7154 jsobj.AddProperty("value", valueObj); | 7151 jsobj.AddProperty("value", valueObj); |
| 7155 } | 7152 } |
| 7156 | 7153 |
| 7157 if (cls.IsTopLevel()) { | 7154 if (cls.IsTopLevel()) { |
| 7158 const Library& library = Library::Handle(cls.library()); | 7155 const Library& library = Library::Handle(cls.library()); |
| 7159 jsobj.AddProperty("owner", library); | 7156 jsobj.AddProperty("owner", library); |
| 7160 } else { | 7157 } else { |
| 7161 jsobj.AddProperty("owner", cls); | 7158 jsobj.AddProperty("owner", cls); |
| (...skipping 1303 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8465 jsobj.AddProperty("type", JSONType(ref)); | 8462 jsobj.AddProperty("type", JSONType(ref)); |
| 8466 const String& name = String::Handle(url()); | 8463 const String& name = String::Handle(url()); |
| 8467 ASSERT(!name.IsNull()); | 8464 ASSERT(!name.IsNull()); |
| 8468 const String& encoded_url = String::Handle(String::EncodeIRI(name)); | 8465 const String& encoded_url = String::Handle(String::EncodeIRI(name)); |
| 8469 ASSERT(!encoded_url.IsNull()); | 8466 ASSERT(!encoded_url.IsNull()); |
| 8470 const Library& lib = Library::Handle(FindLibrary()); | 8467 const Library& lib = Library::Handle(FindLibrary()); |
| 8471 intptr_t lib_index = (lib.IsNull()) ? -1 : lib.index(); | 8468 intptr_t lib_index = (lib.IsNull()) ? -1 : lib.index(); |
| 8472 jsobj.AddPropertyF("id", "libraries/%" Pd "/scripts/%s", | 8469 jsobj.AddPropertyF("id", "libraries/%" Pd "/scripts/%s", |
| 8473 lib_index, encoded_url.ToCString()); | 8470 lib_index, encoded_url.ToCString()); |
| 8474 jsobj.AddProperty("name", name.ToCString()); | 8471 jsobj.AddProperty("name", name.ToCString()); |
| 8475 jsobj.AddProperty("user_name", name.ToCString()); | |
| 8476 jsobj.AddProperty("kind", GetKindAsCString()); | 8472 jsobj.AddProperty("kind", GetKindAsCString()); |
| 8477 if (ref) { | 8473 if (ref) { |
| 8478 return; | 8474 return; |
| 8479 } | 8475 } |
| 8480 jsobj.AddProperty("owning_library", lib); | 8476 jsobj.AddProperty("owning_library", lib); |
| 8481 const String& source = String::Handle(Source()); | 8477 const String& source = String::Handle(Source()); |
| 8482 jsobj.AddProperty("source", source.ToCString()); | 8478 jsobj.AddProperty("source", source.ToCString()); |
| 8483 | 8479 |
| 8484 // Print the line number table | 8480 // Print the line number table |
| 8485 { | 8481 { |
| (...skipping 1265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9751 } | 9747 } |
| 9752 | 9748 |
| 9753 | 9749 |
| 9754 void Library::PrintJSONImpl(JSONStream* stream, bool ref) const { | 9750 void Library::PrintJSONImpl(JSONStream* stream, bool ref) const { |
| 9755 const char* library_name = String::Handle(name()).ToCString(); | 9751 const char* library_name = String::Handle(name()).ToCString(); |
| 9756 intptr_t id = index(); | 9752 intptr_t id = index(); |
| 9757 ASSERT(id >= 0); | 9753 ASSERT(id >= 0); |
| 9758 JSONObject jsobj(stream); | 9754 JSONObject jsobj(stream); |
| 9759 jsobj.AddProperty("type", JSONType(ref)); | 9755 jsobj.AddProperty("type", JSONType(ref)); |
| 9760 jsobj.AddPropertyF("id", "libraries/%" Pd "", id); | 9756 jsobj.AddPropertyF("id", "libraries/%" Pd "", id); |
| 9761 jsobj.AddProperty("user_name", library_name); | |
| 9762 jsobj.AddProperty("name", library_name); | 9757 jsobj.AddProperty("name", library_name); |
| 9763 const char* library_url = String::Handle(url()).ToCString(); | 9758 const char* library_url = String::Handle(url()).ToCString(); |
| 9764 jsobj.AddProperty("url", library_url); | 9759 jsobj.AddProperty("url", library_url); |
| 9765 if (ref) { | 9760 if (ref) { |
| 9766 return; | 9761 return; |
| 9767 } | 9762 } |
| 9768 { | 9763 { |
| 9769 JSONArray jsarr(&jsobj, "classes"); | 9764 JSONArray jsarr(&jsobj, "classes"); |
| 9770 ClassDictionaryIterator class_iter(*this); | 9765 ClassDictionaryIterator class_iter(*this); |
| 9771 Class& klass = Class::Handle(); | 9766 Class& klass = Class::Handle(); |
| (...skipping 2499 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 12271 void Code::PrintJSONImpl(JSONStream* stream, bool ref) const { | 12266 void Code::PrintJSONImpl(JSONStream* stream, bool ref) const { |
| 12272 JSONObject jsobj(stream); | 12267 JSONObject jsobj(stream); |
| 12273 jsobj.AddProperty("type", JSONType(ref)); | 12268 jsobj.AddProperty("type", JSONType(ref)); |
| 12274 jsobj.AddPropertyF("id", "code/%" Px64"-%" Px "", compile_timestamp(), | 12269 jsobj.AddPropertyF("id", "code/%" Px64"-%" Px "", compile_timestamp(), |
| 12275 EntryPoint()); | 12270 EntryPoint()); |
| 12276 jsobj.AddPropertyF("start", "%" Px "", EntryPoint()); | 12271 jsobj.AddPropertyF("start", "%" Px "", EntryPoint()); |
| 12277 jsobj.AddPropertyF("end", "%" Px "", EntryPoint() + Size()); | 12272 jsobj.AddPropertyF("end", "%" Px "", EntryPoint() + Size()); |
| 12278 jsobj.AddProperty("isOptimized", is_optimized()); | 12273 jsobj.AddProperty("isOptimized", is_optimized()); |
| 12279 jsobj.AddProperty("isAlive", is_alive()); | 12274 jsobj.AddProperty("isAlive", is_alive()); |
| 12280 jsobj.AddProperty("kind", "Dart"); | 12275 jsobj.AddProperty("kind", "Dart"); |
| 12281 const String& name = String::Handle(Name()); | 12276 const String& user_name = String::Handle(PrettyName()); |
| 12282 const String& pretty_name = String::Handle(PrettyName()); | 12277 const String& vm_name = String::Handle(Name()); |
| 12283 jsobj.AddProperty("name", name.ToCString()); | 12278 AddNameProperties(&jsobj, user_name, vm_name); |
| 12284 jsobj.AddProperty("user_name", pretty_name.ToCString()); | |
| 12285 const Object& obj = Object::Handle(owner()); | 12279 const Object& obj = Object::Handle(owner()); |
| 12286 if (obj.IsFunction()) { | 12280 if (obj.IsFunction()) { |
| 12287 jsobj.AddProperty("function", obj); | 12281 jsobj.AddProperty("function", obj); |
| 12288 } else { | 12282 } else { |
| 12289 // Generate a fake function reference. | 12283 // Generate a fake function reference. |
| 12290 JSONObject func(&jsobj, "function"); | 12284 JSONObject func(&jsobj, "function"); |
| 12291 func.AddProperty("type", "@Function"); | 12285 func.AddProperty("type", "@Function"); |
| 12292 func.AddProperty("kind", "Stub"); | 12286 func.AddProperty("kind", "Stub"); |
| 12293 func.AddPropertyF("id", "functions/stub-%" Pd "", EntryPoint()); | 12287 func.AddPropertyF("id", "functions/stub-%" Pd "", EntryPoint()); |
| 12294 func.AddProperty("user_name", pretty_name.ToCString()); | 12288 func.AddProperty("name", user_name.ToCString()); |
| 12295 func.AddProperty("name", name.ToCString()); | 12289 AddNameProperties(&func, user_name, vm_name); |
| 12296 } | 12290 } |
| 12297 if (ref) { | 12291 if (ref) { |
| 12298 return; | 12292 return; |
| 12299 } | 12293 } |
| 12300 const Array& array = Array::Handle(ObjectPool()); | 12294 const Array& array = Array::Handle(ObjectPool()); |
| 12301 jsobj.AddProperty("object_pool", array); | 12295 jsobj.AddProperty("object_pool", array); |
| 12302 { | 12296 { |
| 12303 JSONArray jsarr(&jsobj, "disassembly"); | 12297 JSONArray jsarr(&jsobj, "disassembly"); |
| 12304 if (is_alive()) { | 12298 if (is_alive()) { |
| 12305 // Only disassemble alive code objects. | 12299 // Only disassemble alive code objects. |
| (...skipping 2374 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 14680 intptr_t id = type_cls.FindCanonicalTypeIndex(*this); | 14674 intptr_t id = type_cls.FindCanonicalTypeIndex(*this); |
| 14681 ASSERT(id >= 0); | 14675 ASSERT(id >= 0); |
| 14682 intptr_t cid = type_cls.id(); | 14676 intptr_t cid = type_cls.id(); |
| 14683 jsobj.AddPropertyF("id", "classes/%" Pd "/types/%" Pd "", cid, id); | 14677 jsobj.AddPropertyF("id", "classes/%" Pd "/types/%" Pd "", cid, id); |
| 14684 jsobj.AddProperty("type_class", type_cls); | 14678 jsobj.AddProperty("type_class", type_cls); |
| 14685 } else { | 14679 } else { |
| 14686 ObjectIdRing* ring = Isolate::Current()->object_id_ring(); | 14680 ObjectIdRing* ring = Isolate::Current()->object_id_ring(); |
| 14687 const intptr_t id = ring->GetIdForObject(raw()); | 14681 const intptr_t id = ring->GetIdForObject(raw()); |
| 14688 jsobj.AddPropertyF("id", "objects/%" Pd "", id); | 14682 jsobj.AddPropertyF("id", "objects/%" Pd "", id); |
| 14689 } | 14683 } |
| 14690 const char* name = String::Handle(Name()).ToCString(); | 14684 const String& user_name = String::Handle(PrettyName()); |
| 14691 const char* pretty_name = String::Handle(PrettyName()).ToCString(); | 14685 const String& vm_name = String::Handle(Name()); |
| 14692 jsobj.AddProperty("name", name); | 14686 AddNameProperties(&jsobj, user_name, vm_name); |
| 14693 jsobj.AddProperty("user_name", pretty_name); | |
| 14694 if (ref) { | 14687 if (ref) { |
| 14695 return; | 14688 return; |
| 14696 } | 14689 } |
| 14697 jsobj.AddProperty("type_arguments", TypeArguments::Handle(arguments())); | 14690 jsobj.AddProperty("type_arguments", TypeArguments::Handle(arguments())); |
| 14698 } | 14691 } |
| 14699 | 14692 |
| 14700 | 14693 |
| 14701 bool TypeRef::IsInstantiated(GrowableObjectArray* trail) const { | 14694 bool TypeRef::IsInstantiated(GrowableObjectArray* trail) const { |
| 14702 if (TestAndAddToTrail(&trail)) { | 14695 if (TestAndAddToTrail(&trail)) { |
| 14703 return true; | 14696 return true; |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 14844 } | 14837 } |
| 14845 } | 14838 } |
| 14846 | 14839 |
| 14847 | 14840 |
| 14848 void TypeRef::PrintJSONImpl(JSONStream* stream, bool ref) const { | 14841 void TypeRef::PrintJSONImpl(JSONStream* stream, bool ref) const { |
| 14849 JSONObject jsobj(stream); | 14842 JSONObject jsobj(stream); |
| 14850 PrintSharedInstanceJSON(&jsobj, ref); | 14843 PrintSharedInstanceJSON(&jsobj, ref); |
| 14851 ObjectIdRing* ring = Isolate::Current()->object_id_ring(); | 14844 ObjectIdRing* ring = Isolate::Current()->object_id_ring(); |
| 14852 const intptr_t id = ring->GetIdForObject(raw()); | 14845 const intptr_t id = ring->GetIdForObject(raw()); |
| 14853 jsobj.AddPropertyF("id", "objects/%" Pd "", id); | 14846 jsobj.AddPropertyF("id", "objects/%" Pd "", id); |
| 14854 const char* name = String::Handle(Name()).ToCString(); | 14847 const String& user_name = String::Handle(PrettyName()); |
| 14855 const char* pretty_name = String::Handle(PrettyName()).ToCString(); | 14848 const String& vm_name = String::Handle(Name()); |
| 14856 jsobj.AddProperty("name", name); | 14849 AddNameProperties(&jsobj, user_name, vm_name); |
| 14857 jsobj.AddProperty("user_name", pretty_name); | |
| 14858 if (ref) { | 14850 if (ref) { |
| 14859 return; | 14851 return; |
| 14860 } | 14852 } |
| 14861 jsobj.AddProperty("ref_type", AbstractType::Handle(type())); | 14853 jsobj.AddProperty("ref_type", AbstractType::Handle(type())); |
| 14862 } | 14854 } |
| 14863 | 14855 |
| 14864 | 14856 |
| 14865 void TypeParameter::set_is_finalized() const { | 14857 void TypeParameter::set_is_finalized() const { |
| 14866 ASSERT(!IsFinalized()); | 14858 ASSERT(!IsFinalized()); |
| 14867 set_type_state(RawTypeParameter::kFinalizedUninstantiated); | 14859 set_type_state(RawTypeParameter::kFinalizedUninstantiated); |
| (...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 15061 return chars; | 15053 return chars; |
| 15062 } | 15054 } |
| 15063 | 15055 |
| 15064 | 15056 |
| 15065 void TypeParameter::PrintJSONImpl(JSONStream* stream, bool ref) const { | 15057 void TypeParameter::PrintJSONImpl(JSONStream* stream, bool ref) const { |
| 15066 JSONObject jsobj(stream); | 15058 JSONObject jsobj(stream); |
| 15067 PrintSharedInstanceJSON(&jsobj, ref); | 15059 PrintSharedInstanceJSON(&jsobj, ref); |
| 15068 ObjectIdRing* ring = Isolate::Current()->object_id_ring(); | 15060 ObjectIdRing* ring = Isolate::Current()->object_id_ring(); |
| 15069 const intptr_t id = ring->GetIdForObject(raw()); | 15061 const intptr_t id = ring->GetIdForObject(raw()); |
| 15070 jsobj.AddPropertyF("id", "objects/%" Pd "", id); | 15062 jsobj.AddPropertyF("id", "objects/%" Pd "", id); |
| 15071 const char* name = String::Handle(Name()).ToCString(); | 15063 const String& user_name = String::Handle(PrettyName()); |
| 15072 const char* pretty_name = String::Handle(PrettyName()).ToCString(); | 15064 const String& vm_name = String::Handle(Name()); |
| 15073 jsobj.AddProperty("name", name); | 15065 AddNameProperties(&jsobj, user_name, vm_name); |
| 15074 jsobj.AddProperty("user_name", pretty_name); | |
| 15075 const Class& param_cls = Class::Handle(parameterized_class()); | 15066 const Class& param_cls = Class::Handle(parameterized_class()); |
| 15076 jsobj.AddProperty("parameterized_class", param_cls); | 15067 jsobj.AddProperty("parameterized_class", param_cls); |
| 15077 if (ref) { | 15068 if (ref) { |
| 15078 return; | 15069 return; |
| 15079 } | 15070 } |
| 15080 jsobj.AddProperty("index", index()); | 15071 jsobj.AddProperty("index", index()); |
| 15081 const AbstractType& upper_bound = AbstractType::Handle(bound()); | 15072 const AbstractType& upper_bound = AbstractType::Handle(bound()); |
| 15082 jsobj.AddProperty("upper_bound", upper_bound); | 15073 jsobj.AddProperty("upper_bound", upper_bound); |
| 15083 } | 15074 } |
| 15084 | 15075 |
| (...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 15265 return chars; | 15256 return chars; |
| 15266 } | 15257 } |
| 15267 | 15258 |
| 15268 | 15259 |
| 15269 void BoundedType::PrintJSONImpl(JSONStream* stream, bool ref) const { | 15260 void BoundedType::PrintJSONImpl(JSONStream* stream, bool ref) const { |
| 15270 JSONObject jsobj(stream); | 15261 JSONObject jsobj(stream); |
| 15271 PrintSharedInstanceJSON(&jsobj, ref); | 15262 PrintSharedInstanceJSON(&jsobj, ref); |
| 15272 ObjectIdRing* ring = Isolate::Current()->object_id_ring(); | 15263 ObjectIdRing* ring = Isolate::Current()->object_id_ring(); |
| 15273 const intptr_t id = ring->GetIdForObject(raw()); | 15264 const intptr_t id = ring->GetIdForObject(raw()); |
| 15274 jsobj.AddPropertyF("id", "objects/%" Pd "", id); | 15265 jsobj.AddPropertyF("id", "objects/%" Pd "", id); |
| 15275 const char* name = String::Handle(Name()).ToCString(); | 15266 const String& user_name = String::Handle(PrettyName()); |
| 15276 const char* pretty_name = String::Handle(PrettyName()).ToCString(); | 15267 const String& vm_name = String::Handle(Name()); |
| 15277 jsobj.AddProperty("name", name); | 15268 AddNameProperties(&jsobj, user_name, vm_name); |
| 15278 jsobj.AddProperty("user_name", pretty_name); | |
| 15279 if (ref) { | 15269 if (ref) { |
| 15280 return; | 15270 return; |
| 15281 } | 15271 } |
| 15282 jsobj.AddProperty("bounded_type", AbstractType::Handle(type())); | 15272 jsobj.AddProperty("bounded_type", AbstractType::Handle(type())); |
| 15283 jsobj.AddProperty("upper_bound", AbstractType::Handle(bound())); | 15273 jsobj.AddProperty("upper_bound", AbstractType::Handle(bound())); |
| 15284 } | 15274 } |
| 15285 | 15275 |
| 15286 | 15276 |
| 15287 intptr_t MixinAppType::token_pos() const { | 15277 intptr_t MixinAppType::token_pos() const { |
| 15288 return AbstractType::Handle(MixinTypeAt(0)).token_pos(); | 15278 return AbstractType::Handle(MixinTypeAt(0)).token_pos(); |
| (...skipping 4296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 19585 return tag_label.ToCString(); | 19575 return tag_label.ToCString(); |
| 19586 } | 19576 } |
| 19587 | 19577 |
| 19588 | 19578 |
| 19589 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const { | 19579 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const { |
| 19590 Instance::PrintJSONImpl(stream, ref); | 19580 Instance::PrintJSONImpl(stream, ref); |
| 19591 } | 19581 } |
| 19592 | 19582 |
| 19593 | 19583 |
| 19594 } // namespace dart | 19584 } // namespace dart |
| OLD | NEW |