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 3907 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3918 if (!subclasses.IsNull()) { | 3918 if (!subclasses.IsNull()) { |
3919 for (intptr_t i = 0; i < subclasses.Length(); ++i) { | 3919 for (intptr_t i = 0; i < subclasses.Length(); ++i) { |
3920 // TODO(turnidge): Use the Type directly once regis has added | 3920 // TODO(turnidge): Use the Type directly once regis has added |
3921 // types to the vmservice. | 3921 // types to the vmservice. |
3922 subclass ^= subclasses.At(i); | 3922 subclass ^= subclasses.At(i); |
3923 subclasses_array.AddValue(subclass); | 3923 subclasses_array.AddValue(subclass); |
3924 } | 3924 } |
3925 } | 3925 } |
3926 } | 3926 } |
3927 } | 3927 } |
| 3928 { |
| 3929 JSONObject typesRef(&jsobj, "canonicalTypes"); |
| 3930 typesRef.AddProperty("type", "@TypeList"); |
| 3931 typesRef.AddPropertyF("id", "classes/%" Pd "/types", id()); |
| 3932 jsobj.AddPropertyF("name", "canonical types of %s", internal_class_name); |
| 3933 jsobj.AddPropertyF("user_name", "canonical types of %s", |
| 3934 user_visible_class_name); |
| 3935 } |
3928 } | 3936 } |
3929 | 3937 |
3930 | 3938 |
3931 void Class::InsertCanonicalConstant(intptr_t index, | 3939 void Class::InsertCanonicalConstant(intptr_t index, |
3932 const Instance& constant) const { | 3940 const Instance& constant) const { |
3933 // The constant needs to be added to the list. Grow the list if it is full. | 3941 // The constant needs to be added to the list. Grow the list if it is full. |
3934 Array& canonical_list = Array::Handle(constants()); | 3942 Array& canonical_list = Array::Handle(constants()); |
3935 const intptr_t list_len = canonical_list.Length(); | 3943 const intptr_t list_len = canonical_list.Length(); |
3936 if (index >= list_len) { | 3944 if (index >= list_len) { |
3937 const intptr_t new_length = (list_len == 0) ? 4 : list_len + 4; | 3945 const intptr_t new_length = (list_len == 0) ? 4 : list_len + 4; |
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4130 if (!type.TypeTest(test_kind, other_type, bound_error)) { | 4138 if (!type.TypeTest(test_kind, other_type, bound_error)) { |
4131 return false; | 4139 return false; |
4132 } | 4140 } |
4133 } | 4141 } |
4134 return true; | 4142 return true; |
4135 } | 4143 } |
4136 | 4144 |
4137 | 4145 |
4138 void TypeArguments::PrintToJSONStream(JSONStream* stream, bool ref) const { | 4146 void TypeArguments::PrintToJSONStream(JSONStream* stream, bool ref) const { |
4139 JSONObject jsobj(stream); | 4147 JSONObject jsobj(stream); |
| 4148 if (IsNull()) { |
| 4149 jsobj.AddProperty("type", ref ? "@Null" : "Null"); |
| 4150 jsobj.AddProperty("id", "objects/null"); |
| 4151 return; |
| 4152 } |
| 4153 // The index in the canonical_type_arguments table cannot be used as part of |
| 4154 // the object id (as in typearguments/id), because the indices are not |
| 4155 // preserved when the table grows and the entries get rehashed. Use the ring. |
| 4156 Isolate* isolate = Isolate::Current(); |
| 4157 ObjectStore* object_store = isolate->object_store(); |
| 4158 const Array& table = Array::Handle(object_store->canonical_type_arguments()); |
| 4159 ASSERT(table.Length() > 0); |
| 4160 ObjectIdRing* ring = Isolate::Current()->object_id_ring(); |
| 4161 const intptr_t id = ring->GetIdForObject(raw()); |
| 4162 jsobj.AddProperty("type", JSONType(ref)); |
| 4163 jsobj.AddPropertyF("id", "objects/%" Pd "", id); |
| 4164 const char* name = String::Handle(Name()).ToCString(); |
| 4165 const char* user_name = String::Handle(UserVisibleName()).ToCString(); |
| 4166 jsobj.AddProperty("name", name); |
| 4167 jsobj.AddProperty("user_name", user_name); |
| 4168 jsobj.AddProperty("length", Length()); |
| 4169 jsobj.AddProperty("num_instantiations", NumInstantiations()); |
| 4170 if (ref) { |
| 4171 return; |
| 4172 } |
| 4173 { |
| 4174 JSONArray jsarr(&jsobj, "types"); |
| 4175 AbstractType& type_arg = AbstractType::Handle(); |
| 4176 for (intptr_t i = 0; i < Length(); i++) { |
| 4177 type_arg = TypeAt(i); |
| 4178 jsarr.AddValue(type_arg); |
| 4179 } |
| 4180 } |
| 4181 if (!IsInstantiated()) { |
| 4182 JSONArray jsarr(&jsobj, "instantiations"); |
| 4183 Array& prior_instantiations = Array::Handle(instantiations()); |
| 4184 ASSERT(prior_instantiations.Length() > 0); // Always at least a sentinel. |
| 4185 TypeArguments& type_args = TypeArguments::Handle(); |
| 4186 intptr_t i = 0; |
| 4187 while (true) { |
| 4188 if (prior_instantiations.At(i) == Smi::New(StubCode::kNoInstantiator)) { |
| 4189 break; |
| 4190 } |
| 4191 JSONObject instantiation(&jsarr); |
| 4192 type_args ^= prior_instantiations.At(i); |
| 4193 instantiation.AddProperty("instantiator", type_args, true); |
| 4194 type_args ^= prior_instantiations.At(i + 1); |
| 4195 instantiation.AddProperty("instantiated", type_args, true); |
| 4196 i += 2; |
| 4197 } |
| 4198 } |
4140 } | 4199 } |
4141 | 4200 |
4142 | 4201 |
4143 bool TypeArguments::HasInstantiations() const { | 4202 bool TypeArguments::HasInstantiations() const { |
4144 const Array& prior_instantiations = Array::Handle(instantiations()); | 4203 const Array& prior_instantiations = Array::Handle(instantiations()); |
4145 ASSERT(prior_instantiations.Length() > 0); // Always at least a sentinel. | 4204 ASSERT(prior_instantiations.Length() > 0); // Always at least a sentinel. |
4146 return prior_instantiations.Length() > 1; | 4205 return prior_instantiations.Length() > 1; |
4147 } | 4206 } |
4148 | 4207 |
4149 | 4208 |
(...skipping 8272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
12422 } else if (raw() == Symbols::OptimizedOut().raw()) { | 12481 } else if (raw() == Symbols::OptimizedOut().raw()) { |
12423 // TODO(turnidge): This is a hack. The user could have this | 12482 // TODO(turnidge): This is a hack. The user could have this |
12424 // special string in their program. Fixing this involves updating | 12483 // special string in their program. Fixing this involves updating |
12425 // the debugging api a bit. | 12484 // the debugging api a bit. |
12426 jsobj.AddProperty("type", ref ? "@Null" : "Null"); | 12485 jsobj.AddProperty("type", ref ? "@Null" : "Null"); |
12427 jsobj.AddProperty("id", "objects/optimized-out"); | 12486 jsobj.AddProperty("id", "objects/optimized-out"); |
12428 jsobj.AddProperty("preview", "<optimized out>"); | 12487 jsobj.AddProperty("preview", "<optimized out>"); |
12429 return; | 12488 return; |
12430 } else { | 12489 } else { |
12431 ObjectIdRing* ring = Isolate::Current()->object_id_ring(); | 12490 ObjectIdRing* ring = Isolate::Current()->object_id_ring(); |
12432 intptr_t id = ring->GetIdForObject(raw()); | 12491 const intptr_t id = ring->GetIdForObject(raw()); |
12433 if (IsClosure()) { | 12492 if (IsClosure()) { |
12434 const Function& closureFunc = Function::Handle(Closure::function(*this)); | 12493 const Function& closureFunc = Function::Handle(Closure::function(*this)); |
12435 jsobj.AddProperty("closureFunc", closureFunc); | 12494 jsobj.AddProperty("closureFunc", closureFunc); |
12436 jsobj.AddProperty("type", ref ? "@Closure" : "Closure"); | 12495 jsobj.AddProperty("type", ref ? "@Closure" : "Closure"); |
12437 } else { | 12496 } else { |
12438 jsobj.AddProperty("type", JSONType(ref)); | 12497 jsobj.AddProperty("type", JSONType(ref)); |
12439 } | 12498 } |
12440 jsobj.AddPropertyF("id", "objects/%" Pd "", id); | 12499 jsobj.AddPropertyF("id", "objects/%" Pd "", id); |
12441 jsobj.AddProperty("class", cls); | 12500 jsobj.AddProperty("class", cls); |
12442 jsobj.AddProperty("preview", ToUserCString(40)); | 12501 jsobj.AddProperty("preview", ToUserCString(40)); |
(...skipping 429 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
12872 | 12931 |
12873 | 12932 |
12874 const char* AbstractType::ToCString() const { | 12933 const char* AbstractType::ToCString() const { |
12875 // AbstractType is an abstract class. | 12934 // AbstractType is an abstract class. |
12876 UNREACHABLE(); | 12935 UNREACHABLE(); |
12877 return "AbstractType"; | 12936 return "AbstractType"; |
12878 } | 12937 } |
12879 | 12938 |
12880 | 12939 |
12881 void AbstractType::PrintToJSONStream(JSONStream* stream, bool ref) const { | 12940 void AbstractType::PrintToJSONStream(JSONStream* stream, bool ref) const { |
12882 JSONObject jsobj(stream); | 12941 UNREACHABLE(); |
12883 } | 12942 } |
12884 | 12943 |
12885 | 12944 |
12886 RawType* Type::NullType() { | 12945 RawType* Type::NullType() { |
12887 return Isolate::Current()->object_store()->null_type(); | 12946 return Isolate::Current()->object_store()->null_type(); |
12888 } | 12947 } |
12889 | 12948 |
12890 | 12949 |
12891 RawType* Type::DynamicType() { | 12950 RawType* Type::DynamicType() { |
12892 return Object::dynamic_type(); | 12951 return Object::dynamic_type(); |
(...skipping 520 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
13413 OS::SNPrint(chars, len, format, class_name, args_cstr); | 13472 OS::SNPrint(chars, len, format, class_name, args_cstr); |
13414 return chars; | 13473 return chars; |
13415 } | 13474 } |
13416 } else { | 13475 } else { |
13417 return "Unresolved Type"; | 13476 return "Unresolved Type"; |
13418 } | 13477 } |
13419 } | 13478 } |
13420 | 13479 |
13421 | 13480 |
13422 void Type::PrintToJSONStream(JSONStream* stream, bool ref) const { | 13481 void Type::PrintToJSONStream(JSONStream* stream, bool ref) const { |
| 13482 ASSERT(IsCanonical()); |
13423 JSONObject jsobj(stream); | 13483 JSONObject jsobj(stream); |
| 13484 jsobj.AddProperty("type", JSONType(ref)); |
| 13485 const Class& type_cls = Class::Handle(type_class()); |
| 13486 intptr_t id = type_cls.FindCanonicalTypeIndex(*this); |
| 13487 ASSERT(id >= 0); |
| 13488 intptr_t cid = type_cls.id(); |
| 13489 jsobj.AddPropertyF("id", "classes/%" Pd "/types/%" Pd "", cid, id); |
| 13490 const char* name = String::Handle(Name()).ToCString(); |
| 13491 const char* user_name = String::Handle(UserVisibleName()).ToCString(); |
| 13492 jsobj.AddProperty("name", name); |
| 13493 jsobj.AddProperty("user_name", user_name); |
| 13494 if (ref) { |
| 13495 return; |
| 13496 } |
| 13497 jsobj.AddProperty("type_class", type_cls); |
| 13498 jsobj.AddProperty("type_arguments", TypeArguments::Handle(arguments())); |
13424 } | 13499 } |
13425 | 13500 |
13426 | 13501 |
13427 bool TypeRef::IsInstantiated(GrowableObjectArray* trail) const { | 13502 bool TypeRef::IsInstantiated(GrowableObjectArray* trail) const { |
13428 if (TestAndAddToTrail(&trail)) { | 13503 if (TestAndAddToTrail(&trail)) { |
13429 return true; | 13504 return true; |
13430 } | 13505 } |
13431 return AbstractType::Handle(type()).IsInstantiated(trail); | 13506 return AbstractType::Handle(type()).IsInstantiated(trail); |
13432 } | 13507 } |
13433 | 13508 |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
13582 type()).arguments() == TypeArguments::null()) ? "" : "<...>"; | 13657 type()).arguments() == TypeArguments::null()) ? "" : "<...>"; |
13583 intptr_t len = OS::SNPrint(NULL, 0, format, type_cstr, args_cstr) + 1; | 13658 intptr_t len = OS::SNPrint(NULL, 0, format, type_cstr, args_cstr) + 1; |
13584 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); | 13659 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); |
13585 OS::SNPrint(chars, len, format, type_cstr, args_cstr); | 13660 OS::SNPrint(chars, len, format, type_cstr, args_cstr); |
13586 return chars; | 13661 return chars; |
13587 } | 13662 } |
13588 | 13663 |
13589 | 13664 |
13590 void TypeRef::PrintToJSONStream(JSONStream* stream, bool ref) const { | 13665 void TypeRef::PrintToJSONStream(JSONStream* stream, bool ref) const { |
13591 JSONObject jsobj(stream); | 13666 JSONObject jsobj(stream); |
| 13667 ObjectIdRing* ring = Isolate::Current()->object_id_ring(); |
| 13668 const intptr_t id = ring->GetIdForObject(raw()); |
| 13669 jsobj.AddProperty("type", JSONType(ref)); |
| 13670 jsobj.AddPropertyF("id", "objects/%" Pd "", id); |
| 13671 const char* name = String::Handle(Name()).ToCString(); |
| 13672 const char* user_name = String::Handle(UserVisibleName()).ToCString(); |
| 13673 jsobj.AddProperty("name", name); |
| 13674 jsobj.AddProperty("user_name", user_name); |
| 13675 if (ref) { |
| 13676 return; |
| 13677 } |
| 13678 jsobj.AddProperty("ref_type", AbstractType::Handle(type())); |
13592 } | 13679 } |
13593 | 13680 |
13594 | 13681 |
13595 void TypeParameter::set_is_finalized() const { | 13682 void TypeParameter::set_is_finalized() const { |
13596 ASSERT(!IsFinalized()); | 13683 ASSERT(!IsFinalized()); |
13597 set_type_state(RawTypeParameter::kFinalizedUninstantiated); | 13684 set_type_state(RawTypeParameter::kFinalizedUninstantiated); |
13598 } | 13685 } |
13599 | 13686 |
13600 | 13687 |
13601 bool TypeParameter::IsEquivalent(const Instance& other, | 13688 bool TypeParameter::IsEquivalent(const Instance& other, |
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
13786 intptr_t len = OS::SNPrint( | 13873 intptr_t len = OS::SNPrint( |
13787 NULL, 0, format, name_cstr, index(), cls_cstr, bound_cstr) + 1; | 13874 NULL, 0, format, name_cstr, index(), cls_cstr, bound_cstr) + 1; |
13788 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); | 13875 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); |
13789 OS::SNPrint(chars, len, format, name_cstr, index(), cls_cstr, bound_cstr); | 13876 OS::SNPrint(chars, len, format, name_cstr, index(), cls_cstr, bound_cstr); |
13790 return chars; | 13877 return chars; |
13791 } | 13878 } |
13792 | 13879 |
13793 | 13880 |
13794 void TypeParameter::PrintToJSONStream(JSONStream* stream, bool ref) const { | 13881 void TypeParameter::PrintToJSONStream(JSONStream* stream, bool ref) const { |
13795 JSONObject jsobj(stream); | 13882 JSONObject jsobj(stream); |
| 13883 ObjectIdRing* ring = Isolate::Current()->object_id_ring(); |
| 13884 const intptr_t id = ring->GetIdForObject(raw()); |
| 13885 jsobj.AddProperty("type", JSONType(ref)); |
| 13886 jsobj.AddPropertyF("id", "objects/%" Pd "", id); |
| 13887 const char* name = String::Handle(Name()).ToCString(); |
| 13888 const char* user_name = String::Handle(UserVisibleName()).ToCString(); |
| 13889 jsobj.AddProperty("name", name); |
| 13890 jsobj.AddProperty("user_name", user_name); |
| 13891 const Class& cls = Class::Handle(parameterized_class()); |
| 13892 jsobj.AddProperty("parameterized_class", cls); |
| 13893 if (ref) { |
| 13894 return; |
| 13895 } |
| 13896 jsobj.AddProperty("index", index()); |
| 13897 const AbstractType& upper_bound = AbstractType::Handle(bound()); |
| 13898 jsobj.AddProperty("upper_bound", upper_bound); |
13796 } | 13899 } |
13797 | 13900 |
13798 | 13901 |
13799 bool BoundedType::IsMalformed() const { | 13902 bool BoundedType::IsMalformed() const { |
13800 return AbstractType::Handle(type()).IsMalformed(); | 13903 return AbstractType::Handle(type()).IsMalformed(); |
13801 } | 13904 } |
13802 | 13905 |
13803 | 13906 |
13804 bool BoundedType::IsMalbounded() const { | 13907 bool BoundedType::IsMalbounded() const { |
13805 return AbstractType::Handle(type()).IsMalbounded(); | 13908 return AbstractType::Handle(type()).IsMalbounded(); |
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
13967 NULL, 0, format, type_cstr, bound_cstr, type_param_cstr, cls_cstr) + 1; | 14070 NULL, 0, format, type_cstr, bound_cstr, type_param_cstr, cls_cstr) + 1; |
13968 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); | 14071 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); |
13969 OS::SNPrint( | 14072 OS::SNPrint( |
13970 chars, len, format, type_cstr, bound_cstr, type_param_cstr, cls_cstr); | 14073 chars, len, format, type_cstr, bound_cstr, type_param_cstr, cls_cstr); |
13971 return chars; | 14074 return chars; |
13972 } | 14075 } |
13973 | 14076 |
13974 | 14077 |
13975 void BoundedType::PrintToJSONStream(JSONStream* stream, bool ref) const { | 14078 void BoundedType::PrintToJSONStream(JSONStream* stream, bool ref) const { |
13976 JSONObject jsobj(stream); | 14079 JSONObject jsobj(stream); |
| 14080 ObjectIdRing* ring = Isolate::Current()->object_id_ring(); |
| 14081 const intptr_t id = ring->GetIdForObject(raw()); |
| 14082 jsobj.AddProperty("type", JSONType(ref)); |
| 14083 jsobj.AddPropertyF("id", "objects/%" Pd "", id); |
| 14084 const char* name = String::Handle(Name()).ToCString(); |
| 14085 const char* user_name = String::Handle(UserVisibleName()).ToCString(); |
| 14086 jsobj.AddProperty("name", name); |
| 14087 jsobj.AddProperty("user_name", user_name); |
| 14088 if (ref) { |
| 14089 return; |
| 14090 } |
| 14091 jsobj.AddProperty("bounded_type", AbstractType::Handle(type())); |
| 14092 jsobj.AddProperty("upper_bound", AbstractType::Handle(bound())); |
13977 } | 14093 } |
13978 | 14094 |
13979 | 14095 |
13980 intptr_t MixinAppType::token_pos() const { | 14096 intptr_t MixinAppType::token_pos() const { |
13981 return AbstractType::Handle(MixinTypeAt(0)).token_pos(); | 14097 return AbstractType::Handle(MixinTypeAt(0)).token_pos(); |
13982 } | 14098 } |
13983 | 14099 |
13984 | 14100 |
13985 intptr_t MixinAppType::Depth() const { | 14101 intptr_t MixinAppType::Depth() const { |
13986 return Array::Handle(mixin_types()).Length(); | 14102 return Array::Handle(mixin_types()).Length(); |
(...skipping 13 matching lines...) Expand all Loading... |
14000 MixinTypeAt(0)).Name()).ToCString(); | 14116 MixinTypeAt(0)).Name()).ToCString(); |
14001 intptr_t len = OS::SNPrint( | 14117 intptr_t len = OS::SNPrint( |
14002 NULL, 0, format, super_type_cstr, first_mixin_type_cstr) + 1; | 14118 NULL, 0, format, super_type_cstr, first_mixin_type_cstr) + 1; |
14003 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); | 14119 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); |
14004 OS::SNPrint(chars, len, format, super_type_cstr, first_mixin_type_cstr); | 14120 OS::SNPrint(chars, len, format, super_type_cstr, first_mixin_type_cstr); |
14005 return chars; | 14121 return chars; |
14006 } | 14122 } |
14007 | 14123 |
14008 | 14124 |
14009 void MixinAppType::PrintToJSONStream(JSONStream* stream, bool ref) const { | 14125 void MixinAppType::PrintToJSONStream(JSONStream* stream, bool ref) const { |
14010 JSONObject jsobj(stream); | 14126 UNREACHABLE(); |
14011 } | 14127 } |
14012 | 14128 |
14013 | 14129 |
14014 RawAbstractType* MixinAppType::MixinTypeAt(intptr_t depth) const { | 14130 RawAbstractType* MixinAppType::MixinTypeAt(intptr_t depth) const { |
14015 return AbstractType::RawCast(Array::Handle(mixin_types()).At(depth)); | 14131 return AbstractType::RawCast(Array::Handle(mixin_types()).At(depth)); |
14016 } | 14132 } |
14017 | 14133 |
14018 | 14134 |
14019 void MixinAppType::set_super_type(const AbstractType& value) const { | 14135 void MixinAppType::set_super_type(const AbstractType& value) const { |
14020 StorePointer(&raw_ptr()->super_type_, value.raw()); | 14136 StorePointer(&raw_ptr()->super_type_, value.raw()); |
(...skipping 2600 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
16621 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); | 16737 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); |
16622 OS::SNPrint(chars, len, format, Length()); | 16738 OS::SNPrint(chars, len, format, Length()); |
16623 return chars; | 16739 return chars; |
16624 } | 16740 } |
16625 | 16741 |
16626 | 16742 |
16627 void Array::PrintToJSONStream(JSONStream* stream, bool ref) const { | 16743 void Array::PrintToJSONStream(JSONStream* stream, bool ref) const { |
16628 JSONObject jsobj(stream); | 16744 JSONObject jsobj(stream); |
16629 Class& cls = Class::Handle(this->clazz()); | 16745 Class& cls = Class::Handle(this->clazz()); |
16630 ObjectIdRing* ring = Isolate::Current()->object_id_ring(); | 16746 ObjectIdRing* ring = Isolate::Current()->object_id_ring(); |
16631 intptr_t id = ring->GetIdForObject(raw()); | 16747 const intptr_t id = ring->GetIdForObject(raw()); |
16632 jsobj.AddProperty("type", JSONType(ref)); | 16748 jsobj.AddProperty("type", JSONType(ref)); |
16633 jsobj.AddPropertyF("id", "objects/%" Pd "", id); | 16749 jsobj.AddPropertyF("id", "objects/%" Pd "", id); |
16634 jsobj.AddProperty("class", cls); | 16750 jsobj.AddProperty("class", cls); |
16635 jsobj.AddProperty("length", Length()); | 16751 jsobj.AddProperty("length", Length()); |
16636 if (ref) { | 16752 if (ref) { |
16637 return; | 16753 return; |
16638 } | 16754 } |
16639 { | 16755 { |
16640 JSONArray jsarr(&jsobj, "elements"); | 16756 JSONArray jsarr(&jsobj, "elements"); |
16641 for (intptr_t index = 0; index < Length(); index++) { | 16757 for (intptr_t index = 0; index < Length(); index++) { |
(...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
16961 buffer[pos] = '\0'; | 17077 buffer[pos] = '\0'; |
16962 return buffer; | 17078 return buffer; |
16963 } | 17079 } |
16964 | 17080 |
16965 | 17081 |
16966 void GrowableObjectArray::PrintToJSONStream(JSONStream* stream, | 17082 void GrowableObjectArray::PrintToJSONStream(JSONStream* stream, |
16967 bool ref) const { | 17083 bool ref) const { |
16968 JSONObject jsobj(stream); | 17084 JSONObject jsobj(stream); |
16969 Class& cls = Class::Handle(this->clazz()); | 17085 Class& cls = Class::Handle(this->clazz()); |
16970 ObjectIdRing* ring = Isolate::Current()->object_id_ring(); | 17086 ObjectIdRing* ring = Isolate::Current()->object_id_ring(); |
16971 intptr_t id = ring->GetIdForObject(raw()); | 17087 const intptr_t id = ring->GetIdForObject(raw()); |
16972 jsobj.AddProperty("type", JSONType(ref)); | 17088 jsobj.AddProperty("type", JSONType(ref)); |
16973 jsobj.AddPropertyF("id", "objects/%" Pd "", id); | 17089 jsobj.AddPropertyF("id", "objects/%" Pd "", id); |
16974 jsobj.AddProperty("class", cls); | 17090 jsobj.AddProperty("class", cls); |
16975 jsobj.AddProperty("length", Length()); | 17091 jsobj.AddProperty("length", Length()); |
16976 if (ref) { | 17092 if (ref) { |
16977 return; | 17093 return; |
16978 } | 17094 } |
16979 { | 17095 { |
16980 JSONArray jsarr(&jsobj, "elements"); | 17096 JSONArray jsarr(&jsobj, "elements"); |
16981 for (intptr_t index = 0; index < Length(); index++) { | 17097 for (intptr_t index = 0; index < Length(); index++) { |
(...skipping 857 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
17839 return "_MirrorReference"; | 17955 return "_MirrorReference"; |
17840 } | 17956 } |
17841 | 17957 |
17842 | 17958 |
17843 void MirrorReference::PrintToJSONStream(JSONStream* stream, bool ref) const { | 17959 void MirrorReference::PrintToJSONStream(JSONStream* stream, bool ref) const { |
17844 Instance::PrintToJSONStream(stream, ref); | 17960 Instance::PrintToJSONStream(stream, ref); |
17845 } | 17961 } |
17846 | 17962 |
17847 | 17963 |
17848 } // namespace dart | 17964 } // namespace dart |
OLD | NEW |