| 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 4102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4113 const Script& script = Script::Handle(this->script()); | 4113 const Script& script = Script::Handle(this->script()); |
| 4114 if (!script.IsNull()) { | 4114 if (!script.IsNull()) { |
| 4115 jsobj.AddProperty("script", script); | 4115 jsobj.AddProperty("script", script); |
| 4116 jsobj.AddProperty("tokenPos", token_pos()); | 4116 jsobj.AddProperty("tokenPos", token_pos()); |
| 4117 jsobj.AddProperty("endTokenPos", ComputeEndTokenPos()); | 4117 jsobj.AddProperty("endTokenPos", ComputeEndTokenPos()); |
| 4118 } | 4118 } |
| 4119 { | 4119 { |
| 4120 JSONArray interfaces_array(&jsobj, "interfaces"); | 4120 JSONArray interfaces_array(&jsobj, "interfaces"); |
| 4121 const Array& interface_array = Array::Handle(interfaces()); | 4121 const Array& interface_array = Array::Handle(interfaces()); |
| 4122 Type& interface_type = Type::Handle(); | 4122 Type& interface_type = Type::Handle(); |
| 4123 Class& interface_cls = Class::Handle(); | |
| 4124 if (!interface_array.IsNull()) { | 4123 if (!interface_array.IsNull()) { |
| 4125 for (intptr_t i = 0; i < interface_array.Length(); ++i) { | 4124 for (intptr_t i = 0; i < interface_array.Length(); ++i) { |
| 4126 // TODO(turnidge): Use the Type directly once regis has added | |
| 4127 // types to the vmservice. | |
| 4128 interface_type ^= interface_array.At(i); | 4125 interface_type ^= interface_array.At(i); |
| 4129 if (interface_type.HasResolvedTypeClass()) { | 4126 interfaces_array.AddValue(interface_type); |
| 4130 interface_cls = interface_type.type_class(); | |
| 4131 interfaces_array.AddValue(interface_cls); | |
| 4132 } | |
| 4133 } | 4127 } |
| 4134 } | 4128 } |
| 4135 } | 4129 } |
| 4136 { | 4130 { |
| 4137 JSONArray fields_array(&jsobj, "fields"); | 4131 JSONArray fields_array(&jsobj, "fields"); |
| 4138 const Array& field_array = Array::Handle(fields()); | 4132 const Array& field_array = Array::Handle(fields()); |
| 4139 Field& field = Field::Handle(); | 4133 Field& field = Field::Handle(); |
| 4140 if (!field_array.IsNull()) { | 4134 if (!field_array.IsNull()) { |
| 4141 for (intptr_t i = 0; i < field_array.Length(); ++i) { | 4135 for (intptr_t i = 0; i < field_array.Length(); ++i) { |
| 4142 field ^= field_array.At(i); | 4136 field ^= field_array.At(i); |
| (...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4423 ObjectStore* object_store = isolate->object_store(); | 4417 ObjectStore* object_store = isolate->object_store(); |
| 4424 const Array& table = Array::Handle(object_store->canonical_type_arguments()); | 4418 const Array& table = Array::Handle(object_store->canonical_type_arguments()); |
| 4425 ASSERT(table.Length() > 0); | 4419 ASSERT(table.Length() > 0); |
| 4426 ObjectIdRing* ring = Isolate::Current()->object_id_ring(); | 4420 ObjectIdRing* ring = Isolate::Current()->object_id_ring(); |
| 4427 const intptr_t id = ring->GetIdForObject(raw()); | 4421 const intptr_t id = ring->GetIdForObject(raw()); |
| 4428 AddTypeProperties(&jsobj, "TypeArguments", JSONType(), ref); | 4422 AddTypeProperties(&jsobj, "TypeArguments", JSONType(), ref); |
| 4429 jsobj.AddPropertyF("id", "objects/%" Pd "", id); | 4423 jsobj.AddPropertyF("id", "objects/%" Pd "", id); |
| 4430 const String& user_name = String::Handle(PrettyName()); | 4424 const String& user_name = String::Handle(PrettyName()); |
| 4431 const String& vm_name = String::Handle(Name()); | 4425 const String& vm_name = String::Handle(Name()); |
| 4432 AddNameProperties(&jsobj, user_name, vm_name); | 4426 AddNameProperties(&jsobj, user_name, vm_name); |
| 4433 jsobj.AddProperty("length", Length()); | |
| 4434 jsobj.AddProperty("numInstantiations", NumInstantiations()); | |
| 4435 if (ref) { | 4427 if (ref) { |
| 4436 return; | 4428 return; |
| 4437 } | 4429 } |
| 4438 { | 4430 { |
| 4439 JSONArray jsarr(&jsobj, "types"); | 4431 JSONArray jsarr(&jsobj, "types"); |
| 4440 AbstractType& type_arg = AbstractType::Handle(); | 4432 AbstractType& type_arg = AbstractType::Handle(); |
| 4441 for (intptr_t i = 0; i < Length(); i++) { | 4433 for (intptr_t i = 0; i < Length(); i++) { |
| 4442 type_arg = TypeAt(i); | 4434 type_arg = TypeAt(i); |
| 4443 jsarr.AddValue(type_arg); | 4435 jsarr.AddValue(type_arg); |
| 4444 } | 4436 } |
| 4445 } | 4437 } |
| 4446 if (!IsInstantiated()) { | 4438 if (!IsInstantiated()) { |
| 4447 JSONArray jsarr(&jsobj, "instantiations"); | 4439 JSONArray jsarr(&jsobj, "_instantiations"); |
| 4448 Array& prior_instantiations = Array::Handle(instantiations()); | 4440 Array& prior_instantiations = Array::Handle(instantiations()); |
| 4449 ASSERT(prior_instantiations.Length() > 0); // Always at least a sentinel. | 4441 ASSERT(prior_instantiations.Length() > 0); // Always at least a sentinel. |
| 4450 TypeArguments& type_args = TypeArguments::Handle(); | 4442 TypeArguments& type_args = TypeArguments::Handle(); |
| 4451 intptr_t i = 0; | 4443 intptr_t i = 0; |
| 4452 while (true) { | 4444 while (true) { |
| 4453 if (prior_instantiations.At(i) == Smi::New(StubCode::kNoInstantiator)) { | 4445 if (prior_instantiations.At(i) == Smi::New(StubCode::kNoInstantiator)) { |
| 4454 break; | 4446 break; |
| 4455 } | 4447 } |
| 4456 JSONObject instantiation(&jsarr); | 4448 JSONObject instantiation(&jsarr); |
| 4457 type_args ^= prior_instantiations.At(i); | 4449 type_args ^= prior_instantiations.At(i); |
| (...skipping 16265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 20723 return tag_label.ToCString(); | 20715 return tag_label.ToCString(); |
| 20724 } | 20716 } |
| 20725 | 20717 |
| 20726 | 20718 |
| 20727 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const { | 20719 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const { |
| 20728 Instance::PrintJSONImpl(stream, ref); | 20720 Instance::PrintJSONImpl(stream, ref); |
| 20729 } | 20721 } |
| 20730 | 20722 |
| 20731 | 20723 |
| 20732 } // namespace dart | 20724 } // namespace dart |
| OLD | NEW |