| 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 6371 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6382 // and stubs like 'megamorphic_miss'. | 6382 // and stubs like 'megamorphic_miss'. |
| 6383 if (id < 0) { | 6383 if (id < 0) { |
| 6384 ObjectIdRing* ring = Isolate::Current()->object_id_ring(); | 6384 ObjectIdRing* ring = Isolate::Current()->object_id_ring(); |
| 6385 id = ring->GetIdForObject(raw()); | 6385 id = ring->GetIdForObject(raw()); |
| 6386 jsobj.AddPropertyF("id", "objects/%" Pd "", id); | 6386 jsobj.AddPropertyF("id", "objects/%" Pd "", id); |
| 6387 } else { | 6387 } else { |
| 6388 jsobj.AddPropertyF("id", "classes/%" Pd "/%s/%" Pd "", cid, selector, id); | 6388 jsobj.AddPropertyF("id", "classes/%" Pd "/%s/%" Pd "", cid, selector, id); |
| 6389 } | 6389 } |
| 6390 jsobj.AddProperty("name", internal_name); | 6390 jsobj.AddProperty("name", internal_name); |
| 6391 jsobj.AddProperty("user_name", user_name); | 6391 jsobj.AddProperty("user_name", user_name); |
| 6392 jsobj.AddProperty("class", cls); | 6392 if (cls.IsTopLevel()) { |
| 6393 const Library& library = Library::Handle(cls.library()); |
| 6394 jsobj.AddProperty("owner", library); |
| 6395 } else { |
| 6396 jsobj.AddProperty("owner", cls); |
| 6397 } |
| 6393 const Function& parent = Function::Handle(parent_function()); | 6398 const Function& parent = Function::Handle(parent_function()); |
| 6394 if (!parent.IsNull()) { | 6399 if (!parent.IsNull()) { |
| 6395 jsobj.AddProperty("parent", parent); | 6400 jsobj.AddProperty("parent", parent); |
| 6396 } | 6401 } |
| 6397 const char* kind_string = Function::KindToCString(kind()); | 6402 const char* kind_string = Function::KindToCString(kind()); |
| 6398 jsobj.AddProperty("kind", kind_string); | 6403 jsobj.AddProperty("kind", kind_string); |
| 6399 if (ref) { | 6404 if (ref) { |
| 6400 return; | 6405 return; |
| 6401 } | 6406 } |
| 6402 jsobj.AddProperty("is_static", is_static()); | 6407 jsobj.AddProperty("is_static", is_static()); |
| (...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6705 intptr_t cid = cls.id(); | 6710 intptr_t cid = cls.id(); |
| 6706 jsobj.AddProperty("type", JSONType(ref)); | 6711 jsobj.AddProperty("type", JSONType(ref)); |
| 6707 jsobj.AddPropertyF("id", "classes/%" Pd "/fields/%" Pd "", cid, id); | 6712 jsobj.AddPropertyF("id", "classes/%" Pd "/fields/%" Pd "", cid, id); |
| 6708 jsobj.AddProperty("name", internal_field_name); | 6713 jsobj.AddProperty("name", internal_field_name); |
| 6709 jsobj.AddProperty("user_name", field_name); | 6714 jsobj.AddProperty("user_name", field_name); |
| 6710 if (is_static()) { | 6715 if (is_static()) { |
| 6711 const Instance& valueObj = Instance::Handle(value()); | 6716 const Instance& valueObj = Instance::Handle(value()); |
| 6712 jsobj.AddProperty("value", valueObj); | 6717 jsobj.AddProperty("value", valueObj); |
| 6713 } | 6718 } |
| 6714 | 6719 |
| 6715 jsobj.AddProperty("owner", cls); | 6720 if (cls.IsTopLevel()) { |
| 6721 const Library& library = Library::Handle(cls.library()); |
| 6722 jsobj.AddProperty("owner", library); |
| 6723 } else { |
| 6724 jsobj.AddProperty("owner", cls); |
| 6725 } |
| 6716 | 6726 |
| 6717 AbstractType& declared_type = AbstractType::Handle(type()); | 6727 AbstractType& declared_type = AbstractType::Handle(type()); |
| 6718 jsobj.AddProperty("declared_type", declared_type); | 6728 jsobj.AddProperty("declared_type", declared_type); |
| 6719 jsobj.AddProperty("static", is_static()); | 6729 jsobj.AddProperty("static", is_static()); |
| 6720 jsobj.AddProperty("final", is_final()); | 6730 jsobj.AddProperty("final", is_final()); |
| 6721 jsobj.AddProperty("const", is_const()); | 6731 jsobj.AddProperty("const", is_const()); |
| 6722 if (ref) { | 6732 if (ref) { |
| 6723 return; | 6733 return; |
| 6724 } | 6734 } |
| 6725 jsobj.AddProperty("guard_nullable", is_nullable()); | 6735 jsobj.AddProperty("guard_nullable", is_nullable()); |
| 6726 if (guarded_cid() == kIllegalCid) { | 6736 if (guarded_cid() == kIllegalCid) { |
| 6727 jsobj.AddProperty("guard_class", "unknown"); | 6737 jsobj.AddProperty("guard_class", "unknown"); |
| 6728 } else if (guarded_cid() == kDynamicCid) { | 6738 } else if (guarded_cid() == kDynamicCid) { |
| 6729 jsobj.AddProperty("guard_class", "dynamic"); | 6739 jsobj.AddProperty("guard_class", "dynamic"); |
| 6730 } else { | 6740 } else { |
| 6731 ClassTable* table = Isolate::Current()->class_table(); | 6741 ClassTable* table = Isolate::Current()->class_table(); |
| 6732 ASSERT(table->IsValidIndex(guarded_cid())); | 6742 ASSERT(table->IsValidIndex(guarded_cid())); |
| 6733 cls ^= table->At(guarded_cid()); | 6743 cls ^= table->At(guarded_cid()); |
| 6734 jsobj.AddProperty("guard_class", cls); | 6744 jsobj.AddProperty("guard_class", cls); |
| 6735 } | 6745 } |
| 6736 if (guarded_list_length() == kUnknownFixedLength) { | 6746 if (guarded_list_length() == kUnknownFixedLength) { |
| 6737 jsobj.AddProperty("guard_length", "unknown"); | 6747 jsobj.AddProperty("guard_length", "unknown"); |
| 6738 } else if (guarded_list_length() == kNoFixedLength) { | 6748 } else if (guarded_list_length() == kNoFixedLength) { |
| 6739 jsobj.AddProperty("guard_length", "variable"); | 6749 jsobj.AddProperty("guard_length", "variable"); |
| 6740 } else { | 6750 } else { |
| 6741 jsobj.AddProperty("guard_length", guarded_list_length()); | 6751 jsobj.AddProperty("guard_length", guarded_list_length()); |
| 6742 } | 6752 } |
| 6753 const Class& origin_cls = Class::Handle(origin()); |
| 6754 const Script& script = Script::Handle(origin_cls.script()); |
| 6755 if (!script.IsNull()) { |
| 6756 jsobj.AddProperty("script", script); |
| 6757 jsobj.AddProperty("token_pos", token_pos()); |
| 6758 } |
| 6743 } | 6759 } |
| 6744 | 6760 |
| 6745 | 6761 |
| 6746 RawArray* Field::dependent_code() const { | 6762 RawArray* Field::dependent_code() const { |
| 6747 return raw_ptr()->dependent_code_; | 6763 return raw_ptr()->dependent_code_; |
| 6748 } | 6764 } |
| 6749 | 6765 |
| 6750 | 6766 |
| 6751 void Field::set_dependent_code(const Array& array) const { | 6767 void Field::set_dependent_code(const Array& array) const { |
| 6752 StorePointer(&raw_ptr()->dependent_code_, array.raw()); | 6768 StorePointer(&raw_ptr()->dependent_code_, array.raw()); |
| (...skipping 11448 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 18201 return "_MirrorReference"; | 18217 return "_MirrorReference"; |
| 18202 } | 18218 } |
| 18203 | 18219 |
| 18204 | 18220 |
| 18205 void MirrorReference::PrintToJSONStream(JSONStream* stream, bool ref) const { | 18221 void MirrorReference::PrintToJSONStream(JSONStream* stream, bool ref) const { |
| 18206 Instance::PrintToJSONStream(stream, ref); | 18222 Instance::PrintToJSONStream(stream, ref); |
| 18207 } | 18223 } |
| 18208 | 18224 |
| 18209 | 18225 |
| 18210 } // namespace dart | 18226 } // namespace dart |
| OLD | NEW |