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