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