| 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 1568 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1579 static void AddNameProperties(JSONObject* jsobj, | 1579 static void AddNameProperties(JSONObject* jsobj, |
| 1580 const String& name, | 1580 const String& name, |
| 1581 const String& vm_name) { | 1581 const String& vm_name) { |
| 1582 jsobj->AddProperty("name", name.ToCString()); | 1582 jsobj->AddProperty("name", name.ToCString()); |
| 1583 if (!name.Equals(vm_name)) { | 1583 if (!name.Equals(vm_name)) { |
| 1584 jsobj->AddProperty("_vmName", vm_name.ToCString()); | 1584 jsobj->AddProperty("_vmName", vm_name.ToCString()); |
| 1585 } | 1585 } |
| 1586 } | 1586 } |
| 1587 | 1587 |
| 1588 | 1588 |
| 1589 static void AddTypeProperties(JSONObject* jsobj, | 1589 void Object::AddCommonObjectProperties(JSONObject* jsobj, |
| 1590 const char* user_type, | 1590 const char* protocol_type, |
| 1591 const char* vm_type, | 1591 bool ref) const { |
| 1592 bool ref) { | 1592 const char* vm_type = JSONType(); |
| 1593 bool same_type = (strcmp(user_type, vm_type) == 0); | 1593 bool same_type = (strcmp(protocol_type, vm_type) == 0); |
| 1594 if (ref) { | 1594 if (ref) { |
| 1595 jsobj->AddPropertyF("type", "@%s", user_type); | 1595 jsobj->AddPropertyF("type", "@%s", protocol_type); |
| 1596 } else { | 1596 } else { |
| 1597 jsobj->AddProperty("type", user_type); | 1597 jsobj->AddProperty("type", protocol_type); |
| 1598 } | 1598 } |
| 1599 if (!same_type) { | 1599 if (!same_type) { |
| 1600 jsobj->AddProperty("_vmType", vm_type); | 1600 jsobj->AddProperty("_vmType", vm_type); |
| 1601 } | 1601 } |
| 1602 if (!ref || IsInstance()) { |
| 1603 // TODO(turnidge): Provide the type arguments here too? |
| 1604 const Class& cls = Class::Handle(this->clazz()); |
| 1605 jsobj->AddProperty("class", cls); |
| 1606 } |
| 1607 if (!ref) { |
| 1608 if (raw()->IsHeapObject()) { |
| 1609 jsobj->AddProperty("size", raw()->Size()); |
| 1610 } else { |
| 1611 jsobj->AddProperty("size", (intptr_t)0); |
| 1612 } |
| 1613 } |
| 1602 } | 1614 } |
| 1603 | 1615 |
| 1604 | 1616 |
| 1605 void Object::PrintJSON(JSONStream* stream, bool ref) const { | 1617 void Object::PrintJSON(JSONStream* stream, bool ref) const { |
| 1606 if (IsNull()) { | 1618 if (IsNull()) { |
| 1607 JSONObject jsobj(stream); | 1619 JSONObject jsobj(stream); |
| 1608 AddTypeProperties(&jsobj, "Instance", JSONType(), ref); | 1620 AddCommonObjectProperties(&jsobj, "Instance", ref); |
| 1609 jsobj.AddProperty("kind", "Null"); | 1621 jsobj.AddProperty("kind", "Null"); |
| 1610 jsobj.AddFixedServiceId("objects/null"); | 1622 jsobj.AddFixedServiceId("objects/null"); |
| 1611 jsobj.AddProperty("valueAsString", "null"); | 1623 jsobj.AddProperty("valueAsString", "null"); |
| 1612 if (!ref) { | |
| 1613 const Class& cls = Class::Handle(this->clazz()); | |
| 1614 jsobj.AddProperty("class", cls); | |
| 1615 jsobj.AddProperty("size", raw()->Size()); | |
| 1616 } | |
| 1617 } else { | 1624 } else { |
| 1618 PrintJSONImpl(stream, ref); | 1625 PrintJSONImpl(stream, ref); |
| 1619 } | 1626 } |
| 1620 } | 1627 } |
| 1621 | 1628 |
| 1622 | 1629 |
| 1623 void Object::PrintJSONImpl(JSONStream* stream, bool ref) const { | 1630 void Object::PrintJSONImpl(JSONStream* stream, bool ref) const { |
| 1624 JSONObject jsobj(stream); | 1631 JSONObject jsobj(stream); |
| 1625 AddTypeProperties(&jsobj, "Object", JSONType(), ref); | 1632 AddCommonObjectProperties(&jsobj, "Object", ref); |
| 1626 jsobj.AddServiceId(*this); | 1633 jsobj.AddServiceId(*this); |
| 1627 if (ref) { | 1634 if (ref) { |
| 1628 return; | 1635 return; |
| 1629 } | 1636 } |
| 1630 Class& cls = Class::Handle(this->clazz()); | |
| 1631 jsobj.AddProperty("class", cls); | |
| 1632 jsobj.AddProperty("size", raw()->Size()); | |
| 1633 } | 1637 } |
| 1634 | 1638 |
| 1635 | 1639 |
| 1636 RawString* Object::DictionaryName() const { | 1640 RawString* Object::DictionaryName() const { |
| 1637 return String::null(); | 1641 return String::null(); |
| 1638 } | 1642 } |
| 1639 | 1643 |
| 1640 | 1644 |
| 1641 void Object::InitializeObject(uword address, intptr_t class_id, intptr_t size) { | 1645 void Object::InitializeObject(uword address, intptr_t class_id, intptr_t size) { |
| 1642 // TODO(iposva): Get a proper halt instruction from the assembler which | 1646 // TODO(iposva): Get a proper halt instruction from the assembler which |
| (...skipping 2461 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4104 intptr_t len = OS::SNPrint(NULL, 0, format, library_name, class_name) + 1; | 4108 intptr_t len = OS::SNPrint(NULL, 0, format, library_name, class_name) + 1; |
| 4105 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); | 4109 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); |
| 4106 OS::SNPrint(chars, len, format, library_name, class_name); | 4110 OS::SNPrint(chars, len, format, library_name, class_name); |
| 4107 return chars; | 4111 return chars; |
| 4108 } | 4112 } |
| 4109 | 4113 |
| 4110 | 4114 |
| 4111 void Class::PrintJSONImpl(JSONStream* stream, bool ref) const { | 4115 void Class::PrintJSONImpl(JSONStream* stream, bool ref) const { |
| 4112 JSONObject jsobj(stream); | 4116 JSONObject jsobj(stream); |
| 4113 if ((raw() == Class::null()) || (id() == kFreeListElement)) { | 4117 if ((raw() == Class::null()) || (id() == kFreeListElement)) { |
| 4114 // TODO(turnidge): This is weird. See if there is another way to | 4118 // TODO(turnidge): This is weird and needs to be changed. |
| 4115 // handle this. | |
| 4116 jsobj.AddProperty("type", "null"); | 4119 jsobj.AddProperty("type", "null"); |
| 4117 return; | 4120 return; |
| 4118 } | 4121 } |
| 4119 AddTypeProperties(&jsobj, "Class", JSONType(), ref); | 4122 AddCommonObjectProperties(&jsobj, "Class", ref); |
| 4120 jsobj.AddFixedServiceId("classes/%" Pd "", id()); | 4123 jsobj.AddFixedServiceId("classes/%" Pd "", id()); |
| 4121 const String& user_name = String::Handle(PrettyName()); | 4124 const String& user_name = String::Handle(PrettyName()); |
| 4122 const String& vm_name = String::Handle(Name()); | 4125 const String& vm_name = String::Handle(Name()); |
| 4123 AddNameProperties(&jsobj, user_name, vm_name); | 4126 AddNameProperties(&jsobj, user_name, vm_name); |
| 4124 if (ref) { | 4127 if (ref) { |
| 4125 return; | 4128 return; |
| 4126 } | 4129 } |
| 4127 | 4130 |
| 4128 const Error& err = Error::Handle(EnsureIsFinalized(Isolate::Current())); | 4131 const Error& err = Error::Handle(EnsureIsFinalized(Isolate::Current())); |
| 4129 if (!err.IsNull()) { | 4132 if (!err.IsNull()) { |
| (...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4437 | 4440 |
| 4438 void TypeArguments::PrintJSONImpl(JSONStream* stream, bool ref) const { | 4441 void TypeArguments::PrintJSONImpl(JSONStream* stream, bool ref) const { |
| 4439 JSONObject jsobj(stream); | 4442 JSONObject jsobj(stream); |
| 4440 // The index in the canonical_type_arguments table cannot be used as part of | 4443 // The index in the canonical_type_arguments table cannot be used as part of |
| 4441 // the object id (as in typearguments/id), because the indices are not | 4444 // the object id (as in typearguments/id), because the indices are not |
| 4442 // preserved when the table grows and the entries get rehashed. Use the ring. | 4445 // preserved when the table grows and the entries get rehashed. Use the ring. |
| 4443 Isolate* isolate = Isolate::Current(); | 4446 Isolate* isolate = Isolate::Current(); |
| 4444 ObjectStore* object_store = isolate->object_store(); | 4447 ObjectStore* object_store = isolate->object_store(); |
| 4445 const Array& table = Array::Handle(object_store->canonical_type_arguments()); | 4448 const Array& table = Array::Handle(object_store->canonical_type_arguments()); |
| 4446 ASSERT(table.Length() > 0); | 4449 ASSERT(table.Length() > 0); |
| 4447 AddTypeProperties(&jsobj, "TypeArguments", JSONType(), ref); | 4450 AddCommonObjectProperties(&jsobj, "TypeArguments", ref); |
| 4448 jsobj.AddServiceId(*this); | 4451 jsobj.AddServiceId(*this); |
| 4449 const String& user_name = String::Handle(PrettyName()); | 4452 const String& user_name = String::Handle(PrettyName()); |
| 4450 const String& vm_name = String::Handle(Name()); | 4453 const String& vm_name = String::Handle(Name()); |
| 4451 AddNameProperties(&jsobj, user_name, vm_name); | 4454 AddNameProperties(&jsobj, user_name, vm_name); |
| 4452 if (ref) { | 4455 if (ref) { |
| 4453 return; | 4456 return; |
| 4454 } | 4457 } |
| 4455 { | 4458 { |
| 4456 JSONArray jsarr(&jsobj, "types"); | 4459 JSONArray jsarr(&jsobj, "types"); |
| 4457 AbstractType& type_arg = AbstractType::Handle(); | 4460 AbstractType& type_arg = AbstractType::Handle(); |
| (...skipping 2424 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6882 } | 6885 } |
| 6883 | 6886 |
| 6884 | 6887 |
| 6885 void Function::PrintJSONImpl(JSONStream* stream, bool ref) const { | 6888 void Function::PrintJSONImpl(JSONStream* stream, bool ref) const { |
| 6886 Class& cls = Class::Handle(Owner()); | 6889 Class& cls = Class::Handle(Owner()); |
| 6887 ASSERT(!cls.IsNull()); | 6890 ASSERT(!cls.IsNull()); |
| 6888 Error& err = Error::Handle(); | 6891 Error& err = Error::Handle(); |
| 6889 err ^= cls.EnsureIsFinalized(Isolate::Current()); | 6892 err ^= cls.EnsureIsFinalized(Isolate::Current()); |
| 6890 ASSERT(err.IsNull()); | 6893 ASSERT(err.IsNull()); |
| 6891 JSONObject jsobj(stream); | 6894 JSONObject jsobj(stream); |
| 6892 AddTypeProperties(&jsobj, "Function", JSONType(), ref); | 6895 AddCommonObjectProperties(&jsobj, "Function", ref); |
| 6893 AddFunctionServiceId(jsobj, *this, cls); | 6896 AddFunctionServiceId(jsobj, *this, cls); |
| 6894 const String& user_name = String::Handle(PrettyName()); | 6897 const String& user_name = String::Handle(PrettyName()); |
| 6895 const String& vm_name = String::Handle(name()); | 6898 const String& vm_name = String::Handle(name()); |
| 6896 AddNameProperties(&jsobj, user_name, vm_name); | 6899 AddNameProperties(&jsobj, user_name, vm_name); |
| 6897 const Function& parent = Function::Handle(parent_function()); | 6900 const Function& parent = Function::Handle(parent_function()); |
| 6898 if (!parent.IsNull()) { | 6901 if (!parent.IsNull()) { |
| 6899 jsobj.AddProperty("owner", parent); | 6902 jsobj.AddProperty("owner", parent); |
| 6900 } else if (cls.IsTopLevel()) { | 6903 } else if (cls.IsTopLevel()) { |
| 6901 const Library& library = Library::Handle(cls.library()); | 6904 const Library& library = Library::Handle(cls.library()); |
| 6902 jsobj.AddProperty("owner", library); | 6905 jsobj.AddProperty("owner", library); |
| (...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7230 OS::SNPrint(chars, len, kFormat, cls_name, field_name, kF0, kF1, kF2); | 7233 OS::SNPrint(chars, len, kFormat, cls_name, field_name, kF0, kF1, kF2); |
| 7231 return chars; | 7234 return chars; |
| 7232 } | 7235 } |
| 7233 | 7236 |
| 7234 void Field::PrintJSONImpl(JSONStream* stream, bool ref) const { | 7237 void Field::PrintJSONImpl(JSONStream* stream, bool ref) const { |
| 7235 JSONObject jsobj(stream); | 7238 JSONObject jsobj(stream); |
| 7236 Class& cls = Class::Handle(owner()); | 7239 Class& cls = Class::Handle(owner()); |
| 7237 intptr_t id = cls.FindFieldIndex(*this); | 7240 intptr_t id = cls.FindFieldIndex(*this); |
| 7238 ASSERT(id >= 0); | 7241 ASSERT(id >= 0); |
| 7239 intptr_t cid = cls.id(); | 7242 intptr_t cid = cls.id(); |
| 7240 AddTypeProperties(&jsobj, "Field", JSONType(), ref); | 7243 AddCommonObjectProperties(&jsobj, "Field", ref); |
| 7241 jsobj.AddFixedServiceId("classes/%" Pd "/fields/%" Pd "", cid, id); | 7244 jsobj.AddFixedServiceId("classes/%" Pd "/fields/%" Pd "", cid, id); |
| 7242 const String& user_name = String::Handle(PrettyName()); | 7245 const String& user_name = String::Handle(PrettyName()); |
| 7243 const String& vm_name = String::Handle(name()); | 7246 const String& vm_name = String::Handle(name()); |
| 7244 AddNameProperties(&jsobj, user_name, vm_name); | 7247 AddNameProperties(&jsobj, user_name, vm_name); |
| 7245 if (cls.IsTopLevel()) { | 7248 if (cls.IsTopLevel()) { |
| 7246 const Library& library = Library::Handle(cls.library()); | 7249 const Library& library = Library::Handle(cls.library()); |
| 7247 jsobj.AddProperty("owner", library); | 7250 jsobj.AddProperty("owner", library); |
| 7248 } else { | 7251 } else { |
| 7249 jsobj.AddProperty("owner", cls); | 7252 jsobj.AddProperty("owner", cls); |
| 7250 } | 7253 } |
| (...skipping 763 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8014 } | 8017 } |
| 8015 | 8018 |
| 8016 | 8019 |
| 8017 const char* TokenStream::ToCString() const { | 8020 const char* TokenStream::ToCString() const { |
| 8018 return "TokenStream"; | 8021 return "TokenStream"; |
| 8019 } | 8022 } |
| 8020 | 8023 |
| 8021 | 8024 |
| 8022 void TokenStream::PrintJSONImpl(JSONStream* stream, bool ref) const { | 8025 void TokenStream::PrintJSONImpl(JSONStream* stream, bool ref) const { |
| 8023 JSONObject jsobj(stream); | 8026 JSONObject jsobj(stream); |
| 8024 AddTypeProperties(&jsobj, "Object", JSONType(), ref); | 8027 AddCommonObjectProperties(&jsobj, "Object", ref); |
| 8025 // TODO(johnmccutchan): Generate a stable id. TokenStreams hang off | 8028 // TODO(johnmccutchan): Generate a stable id. TokenStreams hang off |
| 8026 // a Script object but do not have a back reference to generate a stable id. | 8029 // a Script object but do not have a back reference to generate a stable id. |
| 8027 jsobj.AddServiceId(*this); | 8030 jsobj.AddServiceId(*this); |
| 8028 if (ref) { | 8031 if (ref) { |
| 8029 return; | 8032 return; |
| 8030 } | 8033 } |
| 8031 Class& cls = Class::Handle(this->clazz()); | |
| 8032 jsobj.AddProperty("class", cls); | |
| 8033 jsobj.AddProperty("size", raw()->Size()); | |
| 8034 const String& private_key = String::Handle(PrivateKey()); | 8034 const String& private_key = String::Handle(PrivateKey()); |
| 8035 jsobj.AddProperty("privateKey", private_key); | 8035 jsobj.AddProperty("privateKey", private_key); |
| 8036 // TODO(johnmccutchan): Add support for printing LiteralTokens and add | 8036 // TODO(johnmccutchan): Add support for printing LiteralTokens and add |
| 8037 // them to members array. | 8037 // them to members array. |
| 8038 JSONArray members(&jsobj, "members"); | 8038 JSONArray members(&jsobj, "members"); |
| 8039 } | 8039 } |
| 8040 | 8040 |
| 8041 | 8041 |
| 8042 TokenStream::Iterator::Iterator(const TokenStream& tokens, | 8042 TokenStream::Iterator::Iterator(const TokenStream& tokens, |
| 8043 intptr_t token_pos, | 8043 intptr_t token_pos, |
| (...skipping 504 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8548 } | 8548 } |
| 8549 } | 8549 } |
| 8550 } | 8550 } |
| 8551 return Library::null(); | 8551 return Library::null(); |
| 8552 } | 8552 } |
| 8553 | 8553 |
| 8554 | 8554 |
| 8555 // See also Dart_ScriptGetTokenInfo. | 8555 // See also Dart_ScriptGetTokenInfo. |
| 8556 void Script::PrintJSONImpl(JSONStream* stream, bool ref) const { | 8556 void Script::PrintJSONImpl(JSONStream* stream, bool ref) const { |
| 8557 JSONObject jsobj(stream); | 8557 JSONObject jsobj(stream); |
| 8558 AddTypeProperties(&jsobj, "Script", JSONType(), ref); | 8558 AddCommonObjectProperties(&jsobj, "Script", ref); |
| 8559 const String& uri = String::Handle(url()); | 8559 const String& uri = String::Handle(url()); |
| 8560 ASSERT(!uri.IsNull()); | 8560 ASSERT(!uri.IsNull()); |
| 8561 const String& encoded_uri = String::Handle(String::EncodeIRI(uri)); | 8561 const String& encoded_uri = String::Handle(String::EncodeIRI(uri)); |
| 8562 ASSERT(!encoded_uri.IsNull()); | 8562 ASSERT(!encoded_uri.IsNull()); |
| 8563 const Library& lib = Library::Handle(FindLibrary()); | 8563 const Library& lib = Library::Handle(FindLibrary()); |
| 8564 // TODO(rmacnak): This can fail for eval scripts. Use a ring-id for those. | 8564 // TODO(rmacnak): This can fail for eval scripts. Use a ring-id for those. |
| 8565 intptr_t lib_index = (lib.IsNull()) ? -1 : lib.index(); | 8565 intptr_t lib_index = (lib.IsNull()) ? -1 : lib.index(); |
| 8566 jsobj.AddFixedServiceId("libraries/%" Pd "/scripts/%s", | 8566 jsobj.AddFixedServiceId("libraries/%" Pd "/scripts/%s", |
| 8567 lib_index, encoded_uri.ToCString()); | 8567 lib_index, encoded_uri.ToCString()); |
| 8568 jsobj.AddPropertyStr("uri", uri); | 8568 jsobj.AddPropertyStr("uri", uri); |
| (...skipping 1330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9899 OS::SNPrint(chars, len, kFormat, name.ToCString()); | 9899 OS::SNPrint(chars, len, kFormat, name.ToCString()); |
| 9900 return chars; | 9900 return chars; |
| 9901 } | 9901 } |
| 9902 | 9902 |
| 9903 | 9903 |
| 9904 void Library::PrintJSONImpl(JSONStream* stream, bool ref) const { | 9904 void Library::PrintJSONImpl(JSONStream* stream, bool ref) const { |
| 9905 const char* library_name = String::Handle(name()).ToCString(); | 9905 const char* library_name = String::Handle(name()).ToCString(); |
| 9906 intptr_t id = index(); | 9906 intptr_t id = index(); |
| 9907 ASSERT(id >= 0); | 9907 ASSERT(id >= 0); |
| 9908 JSONObject jsobj(stream); | 9908 JSONObject jsobj(stream); |
| 9909 AddTypeProperties(&jsobj, "Library", JSONType(), ref); | 9909 AddCommonObjectProperties(&jsobj, "Library", ref); |
| 9910 jsobj.AddFixedServiceId("libraries/%" Pd "", id); | 9910 jsobj.AddFixedServiceId("libraries/%" Pd "", id); |
| 9911 jsobj.AddProperty("name", library_name); | 9911 jsobj.AddProperty("name", library_name); |
| 9912 const String& library_url = String::Handle(url()); | 9912 const String& library_url = String::Handle(url()); |
| 9913 jsobj.AddPropertyStr("uri", library_url); | 9913 jsobj.AddPropertyStr("uri", library_url); |
| 9914 if (ref) { | 9914 if (ref) { |
| 9915 return; | 9915 return; |
| 9916 } | 9916 } |
| 9917 jsobj.AddProperty("debuggable", IsDebuggable()); | 9917 jsobj.AddProperty("debuggable", IsDebuggable()); |
| 9918 { | 9918 { |
| 9919 JSONArray jsarr(&jsobj, "classes"); | 9919 JSONArray jsarr(&jsobj, "classes"); |
| (...skipping 839 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10759 KindAsStr(iter.Kind()), | 10759 KindAsStr(iter.Kind()), |
| 10760 iter.DeoptId(), | 10760 iter.DeoptId(), |
| 10761 iter.TokenPos(), | 10761 iter.TokenPos(), |
| 10762 iter.TryIndex()); | 10762 iter.TryIndex()); |
| 10763 } | 10763 } |
| 10764 return buffer; | 10764 return buffer; |
| 10765 } | 10765 } |
| 10766 | 10766 |
| 10767 | 10767 |
| 10768 void PcDescriptors::PrintToJSONObject(JSONObject* jsobj, bool ref) const { | 10768 void PcDescriptors::PrintToJSONObject(JSONObject* jsobj, bool ref) const { |
| 10769 AddTypeProperties(jsobj, "Object", JSONType(), ref); | 10769 AddCommonObjectProperties(jsobj, "Object", ref); |
| 10770 // TODO(johnmccutchan): Generate a stable id. PcDescriptors hang off a Code | 10770 // TODO(johnmccutchan): Generate a stable id. PcDescriptors hang off a Code |
| 10771 // object but do not have a back reference to generate an ID. | 10771 // object but do not have a back reference to generate an ID. |
| 10772 jsobj->AddServiceId(*this); | 10772 jsobj->AddServiceId(*this); |
| 10773 if (ref) { | 10773 if (ref) { |
| 10774 return; | 10774 return; |
| 10775 } | 10775 } |
| 10776 Class& cls = Class::Handle(this->clazz()); | |
| 10777 jsobj->AddProperty("class", cls); | |
| 10778 jsobj->AddProperty("size", raw()->Size()); | |
| 10779 JSONArray members(jsobj, "members"); | 10776 JSONArray members(jsobj, "members"); |
| 10780 Iterator iter(*this, RawPcDescriptors::kAnyKind); | 10777 Iterator iter(*this, RawPcDescriptors::kAnyKind); |
| 10781 while (iter.MoveNext()) { | 10778 while (iter.MoveNext()) { |
| 10782 JSONObject descriptor(&members); | 10779 JSONObject descriptor(&members); |
| 10783 descriptor.AddPropertyF("pcOffset", "%" Px "", iter.PcOffset()); | 10780 descriptor.AddPropertyF("pcOffset", "%" Px "", iter.PcOffset()); |
| 10784 descriptor.AddProperty("kind", KindAsStr(iter.Kind())); | 10781 descriptor.AddProperty("kind", KindAsStr(iter.Kind())); |
| 10785 descriptor.AddProperty("deoptId", iter.DeoptId()); | 10782 descriptor.AddProperty("deoptId", iter.DeoptId()); |
| 10786 // TODO(turnidge): Use AddLocation instead. | 10783 // TODO(turnidge): Use AddLocation instead. |
| 10787 descriptor.AddProperty("tokenPos", iter.TokenPos()); | 10784 descriptor.AddProperty("tokenPos", iter.TokenPos()); |
| 10788 descriptor.AddProperty("tryIndex", iter.TryIndex()); | 10785 descriptor.AddProperty("tryIndex", iter.TryIndex()); |
| (...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11041 (len - num_chars), | 11038 (len - num_chars), |
| 11042 i, var_name, info); | 11039 i, var_name, info); |
| 11043 } | 11040 } |
| 11044 return buffer; | 11041 return buffer; |
| 11045 } | 11042 } |
| 11046 | 11043 |
| 11047 | 11044 |
| 11048 void LocalVarDescriptors::PrintJSONImpl(JSONStream* stream, | 11045 void LocalVarDescriptors::PrintJSONImpl(JSONStream* stream, |
| 11049 bool ref) const { | 11046 bool ref) const { |
| 11050 JSONObject jsobj(stream); | 11047 JSONObject jsobj(stream); |
| 11051 AddTypeProperties(&jsobj, "Object", JSONType(), ref); | 11048 AddCommonObjectProperties(&jsobj, "Object", ref); |
| 11052 // TODO(johnmccutchan): Generate a stable id. LocalVarDescriptors hang off | 11049 // TODO(johnmccutchan): Generate a stable id. LocalVarDescriptors hang off |
| 11053 // a Code object but do not have a back reference to generate an ID. | 11050 // a Code object but do not have a back reference to generate an ID. |
| 11054 jsobj.AddServiceId(*this); | 11051 jsobj.AddServiceId(*this); |
| 11055 if (ref) { | 11052 if (ref) { |
| 11056 return; | 11053 return; |
| 11057 } | 11054 } |
| 11058 Class& cls = Class::Handle(this->clazz()); | |
| 11059 jsobj.AddProperty("class", cls); | |
| 11060 jsobj.AddProperty("size", raw()->Size()); | |
| 11061 JSONArray members(&jsobj, "members"); | 11055 JSONArray members(&jsobj, "members"); |
| 11062 String& var_name = String::Handle(); | 11056 String& var_name = String::Handle(); |
| 11063 for (intptr_t i = 0; i < Length(); i++) { | 11057 for (intptr_t i = 0; i < Length(); i++) { |
| 11064 RawLocalVarDescriptors::VarInfo info; | 11058 RawLocalVarDescriptors::VarInfo info; |
| 11065 var_name = GetName(i); | 11059 var_name = GetName(i); |
| 11066 GetInfo(i, &info); | 11060 GetInfo(i, &info); |
| 11067 JSONObject var(&members); | 11061 JSONObject var(&members); |
| 11068 var.AddProperty("name", var_name.ToCString()); | 11062 var.AddProperty("name", var_name.ToCString()); |
| 11069 var.AddProperty("index", static_cast<intptr_t>(info.index())); | 11063 var.AddProperty("index", static_cast<intptr_t>(info.index())); |
| 11070 var.AddProperty("beginPos", static_cast<intptr_t>(info.begin_pos)); | 11064 var.AddProperty("beginPos", static_cast<intptr_t>(info.begin_pos)); |
| (...skipping 1650 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 12721 | 12715 |
| 12722 | 12716 |
| 12723 bool Code::IsFunctionCode() const { | 12717 bool Code::IsFunctionCode() const { |
| 12724 const Object& obj = Object::Handle(owner()); | 12718 const Object& obj = Object::Handle(owner()); |
| 12725 return obj.IsFunction(); | 12719 return obj.IsFunction(); |
| 12726 } | 12720 } |
| 12727 | 12721 |
| 12728 | 12722 |
| 12729 void Code::PrintJSONImpl(JSONStream* stream, bool ref) const { | 12723 void Code::PrintJSONImpl(JSONStream* stream, bool ref) const { |
| 12730 JSONObject jsobj(stream); | 12724 JSONObject jsobj(stream); |
| 12731 AddTypeProperties(&jsobj, "Code", JSONType(), ref); | 12725 AddCommonObjectProperties(&jsobj, "Code", ref); |
| 12732 jsobj.AddFixedServiceId("code/%" Px64"-%" Px "", | 12726 jsobj.AddFixedServiceId("code/%" Px64"-%" Px "", |
| 12733 compile_timestamp(), | 12727 compile_timestamp(), |
| 12734 EntryPoint()); | 12728 EntryPoint()); |
| 12735 const String& user_name = String::Handle(PrettyName()); | 12729 const String& user_name = String::Handle(PrettyName()); |
| 12736 const String& vm_name = String::Handle(Name()); | 12730 const String& vm_name = String::Handle(Name()); |
| 12737 AddNameProperties(&jsobj, user_name, vm_name); | 12731 AddNameProperties(&jsobj, user_name, vm_name); |
| 12738 const bool is_stub = IsStubCode() || IsAllocationStubCode(); | 12732 const bool is_stub = IsStubCode() || IsAllocationStubCode(); |
| 12739 if (is_stub) { | 12733 if (is_stub) { |
| 12740 jsobj.AddProperty("kind", "Stub"); | 12734 jsobj.AddProperty("kind", "Stub"); |
| 12741 } else { | 12735 } else { |
| (...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 13020 } | 13014 } |
| 13021 IndentN(indent); | 13015 IndentN(indent); |
| 13022 OS::PrintErr("}\n"); | 13016 OS::PrintErr("}\n"); |
| 13023 } | 13017 } |
| 13024 | 13018 |
| 13025 | 13019 |
| 13026 void Context::PrintJSONImpl(JSONStream* stream, bool ref) const { | 13020 void Context::PrintJSONImpl(JSONStream* stream, bool ref) const { |
| 13027 JSONObject jsobj(stream); | 13021 JSONObject jsobj(stream); |
| 13028 // TODO(turnidge): Should the user level type for Context be Context | 13022 // TODO(turnidge): Should the user level type for Context be Context |
| 13029 // or Object? | 13023 // or Object? |
| 13030 AddTypeProperties(&jsobj, "Context", JSONType(), ref); | 13024 AddCommonObjectProperties(&jsobj, "Context", ref); |
| 13031 jsobj.AddServiceId(*this); | 13025 jsobj.AddServiceId(*this); |
| 13032 | 13026 |
| 13033 jsobj.AddProperty("length", num_variables()); | 13027 jsobj.AddProperty("length", num_variables()); |
| 13034 | 13028 |
| 13035 if (ref) { | 13029 if (ref) { |
| 13036 return; | 13030 return; |
| 13037 } | 13031 } |
| 13038 | 13032 |
| 13039 Class& cls = Class::Handle(this->clazz()); | |
| 13040 jsobj.AddProperty("class", cls); | |
| 13041 | |
| 13042 jsobj.AddProperty("size", raw()->Size()); | |
| 13043 | |
| 13044 const Context& parent_context = Context::Handle(parent()); | 13033 const Context& parent_context = Context::Handle(parent()); |
| 13045 jsobj.AddProperty("parent", parent_context); | 13034 jsobj.AddProperty("parent", parent_context); |
| 13046 | 13035 |
| 13047 JSONArray jsarr(&jsobj, "variables"); | 13036 JSONArray jsarr(&jsobj, "variables"); |
| 13048 for (intptr_t i = 0; i < num_variables(); i++) { | 13037 Object& var = Object::Handle(); |
| 13049 const Object& var = Object::Handle(At(i)); | 13038 for (intptr_t index = 0; index < num_variables(); index++) { |
| 13039 var = At(index); |
| 13050 JSONObject jselement(&jsarr); | 13040 JSONObject jselement(&jsarr); |
| 13051 jselement.AddProperty("index", i); | |
| 13052 jselement.AddProperty("value", var); | 13041 jselement.AddProperty("value", var); |
| 13053 } | 13042 } |
| 13054 } | 13043 } |
| 13055 | 13044 |
| 13056 | 13045 |
| 13057 RawContextScope* ContextScope::New(intptr_t num_variables) { | 13046 RawContextScope* ContextScope::New(intptr_t num_variables) { |
| 13058 ASSERT(Object::context_scope_class() != Class::null()); | 13047 ASSERT(Object::context_scope_class() != Class::null()); |
| 13059 if (num_variables < 0 || num_variables > kMaxElements) { | 13048 if (num_variables < 0 || num_variables > kMaxElements) { |
| 13060 // This should be caught before we reach here. | 13049 // This should be caught before we reach here. |
| 13061 FATAL1("Fatal error in ContextScope::New: invalid num_variables %" Pd "\n", | 13050 FATAL1("Fatal error in ContextScope::New: invalid num_variables %" Pd "\n", |
| (...skipping 377 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 13439 } | 13428 } |
| 13440 | 13429 |
| 13441 | 13430 |
| 13442 const char* ApiError::ToCString() const { | 13431 const char* ApiError::ToCString() const { |
| 13443 return "ApiError"; | 13432 return "ApiError"; |
| 13444 } | 13433 } |
| 13445 | 13434 |
| 13446 | 13435 |
| 13447 void ApiError::PrintJSONImpl(JSONStream* stream, bool ref) const { | 13436 void ApiError::PrintJSONImpl(JSONStream* stream, bool ref) const { |
| 13448 JSONObject jsobj(stream); | 13437 JSONObject jsobj(stream); |
| 13449 AddTypeProperties(&jsobj, "Error", JSONType(), ref); | 13438 AddCommonObjectProperties(&jsobj, "Error", ref); |
| 13439 jsobj.AddProperty("kind", "InternalError"); |
| 13440 jsobj.AddServiceId(*this); |
| 13450 jsobj.AddProperty("message", ToErrorCString()); | 13441 jsobj.AddProperty("message", ToErrorCString()); |
| 13451 } | 13442 } |
| 13452 | 13443 |
| 13453 | 13444 |
| 13454 RawLanguageError* LanguageError::New() { | 13445 RawLanguageError* LanguageError::New() { |
| 13455 ASSERT(Object::language_error_class() != Class::null()); | 13446 ASSERT(Object::language_error_class() != Class::null()); |
| 13456 RawObject* raw = Object::Allocate(LanguageError::kClassId, | 13447 RawObject* raw = Object::Allocate(LanguageError::kClassId, |
| 13457 LanguageError::InstanceSize(), | 13448 LanguageError::InstanceSize(), |
| 13458 Heap::kOld); | 13449 Heap::kOld); |
| 13459 return reinterpret_cast<RawLanguageError*>(raw); | 13450 return reinterpret_cast<RawLanguageError*>(raw); |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 13576 } | 13567 } |
| 13577 | 13568 |
| 13578 | 13569 |
| 13579 const char* LanguageError::ToCString() const { | 13570 const char* LanguageError::ToCString() const { |
| 13580 return "LanguageError"; | 13571 return "LanguageError"; |
| 13581 } | 13572 } |
| 13582 | 13573 |
| 13583 | 13574 |
| 13584 void LanguageError::PrintJSONImpl(JSONStream* stream, bool ref) const { | 13575 void LanguageError::PrintJSONImpl(JSONStream* stream, bool ref) const { |
| 13585 JSONObject jsobj(stream); | 13576 JSONObject jsobj(stream); |
| 13586 AddTypeProperties(&jsobj, "Error", JSONType(), ref); | 13577 AddCommonObjectProperties(&jsobj, "Error", ref); |
| 13578 jsobj.AddProperty("kind", "LanguageError"); |
| 13579 jsobj.AddServiceId(*this); |
| 13587 jsobj.AddProperty("message", ToErrorCString()); | 13580 jsobj.AddProperty("message", ToErrorCString()); |
| 13588 } | 13581 } |
| 13589 | 13582 |
| 13590 | 13583 |
| 13591 RawUnhandledException* UnhandledException::New(const Instance& exception, | 13584 RawUnhandledException* UnhandledException::New(const Instance& exception, |
| 13592 const Instance& stacktrace, | 13585 const Instance& stacktrace, |
| 13593 Heap::Space space) { | 13586 Heap::Space space) { |
| 13594 ASSERT(Object::unhandled_exception_class() != Class::null()); | 13587 ASSERT(Object::unhandled_exception_class() != Class::null()); |
| 13595 UnhandledException& result = UnhandledException::Handle(); | 13588 UnhandledException& result = UnhandledException::Handle(); |
| 13596 { | 13589 { |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 13667 | 13660 |
| 13668 const char* UnhandledException::ToCString() const { | 13661 const char* UnhandledException::ToCString() const { |
| 13669 return "UnhandledException"; | 13662 return "UnhandledException"; |
| 13670 } | 13663 } |
| 13671 | 13664 |
| 13672 | 13665 |
| 13673 | 13666 |
| 13674 void UnhandledException::PrintJSONImpl(JSONStream* stream, | 13667 void UnhandledException::PrintJSONImpl(JSONStream* stream, |
| 13675 bool ref) const { | 13668 bool ref) const { |
| 13676 JSONObject jsobj(stream); | 13669 JSONObject jsobj(stream); |
| 13677 AddTypeProperties(&jsobj, "Error", JSONType(), ref); | 13670 AddCommonObjectProperties(&jsobj, "Error", ref); |
| 13671 jsobj.AddProperty("kind", "UnhandledException"); |
| 13672 jsobj.AddServiceId(*this); |
| 13678 jsobj.AddProperty("message", ToErrorCString()); | 13673 jsobj.AddProperty("message", ToErrorCString()); |
| 13679 | 13674 if (ref) { |
| 13675 return; |
| 13676 } |
| 13680 Instance& instance = Instance::Handle(); | 13677 Instance& instance = Instance::Handle(); |
| 13681 instance = exception(); | 13678 instance = exception(); |
| 13682 jsobj.AddProperty("exception", instance); | 13679 jsobj.AddProperty("exception", instance); |
| 13683 instance = stacktrace(); | 13680 instance = stacktrace(); |
| 13684 jsobj.AddProperty("stacktrace", instance); | 13681 jsobj.AddProperty("stacktrace", instance); |
| 13685 } | 13682 } |
| 13686 | 13683 |
| 13687 | 13684 |
| 13688 RawUnwindError* UnwindError::New(const String& message, Heap::Space space) { | 13685 RawUnwindError* UnwindError::New(const String& message, Heap::Space space) { |
| 13689 ASSERT(Object::unwind_error_class() != Class::null()); | 13686 ASSERT(Object::unwind_error_class() != Class::null()); |
| (...skipping 21 matching lines...) Expand all Loading... |
| 13711 } | 13708 } |
| 13712 | 13709 |
| 13713 | 13710 |
| 13714 const char* UnwindError::ToCString() const { | 13711 const char* UnwindError::ToCString() const { |
| 13715 return "UnwindError"; | 13712 return "UnwindError"; |
| 13716 } | 13713 } |
| 13717 | 13714 |
| 13718 | 13715 |
| 13719 void UnwindError::PrintJSONImpl(JSONStream* stream, bool ref) const { | 13716 void UnwindError::PrintJSONImpl(JSONStream* stream, bool ref) const { |
| 13720 JSONObject jsobj(stream); | 13717 JSONObject jsobj(stream); |
| 13721 AddTypeProperties(&jsobj, "Error", JSONType(), ref); | 13718 AddCommonObjectProperties(&jsobj, "Error", ref); |
| 13719 jsobj.AddProperty("kind", "TerminationError"); |
| 13720 jsobj.AddServiceId(*this); |
| 13722 jsobj.AddProperty("message", ToErrorCString()); | 13721 jsobj.AddProperty("message", ToErrorCString()); |
| 13723 } | 13722 } |
| 13724 | 13723 |
| 13725 | 13724 |
| 13726 RawObject* Instance::Evaluate(const String& expr, | 13725 RawObject* Instance::Evaluate(const String& expr, |
| 13727 const Array& param_names, | 13726 const Array& param_names, |
| 13728 const Array& param_values) const { | 13727 const Array& param_values) const { |
| 13729 const Class& cls = Class::Handle(clazz()); | 13728 const Class& cls = Class::Handle(clazz()); |
| 13730 const Function& eval_func = | 13729 const Function& eval_func = |
| 13731 Function::Handle(EvaluateHelper(cls, expr, param_names, false)); | 13730 Function::Handle(EvaluateHelper(cls, expr, param_names, false)); |
| (...skipping 422 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 14154 intptr_t len = OS::SNPrint(NULL, 0, kFormat, type_name.ToCString()) + 1; | 14153 intptr_t len = OS::SNPrint(NULL, 0, kFormat, type_name.ToCString()) + 1; |
| 14155 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); | 14154 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); |
| 14156 OS::SNPrint(chars, len, kFormat, type_name.ToCString()); | 14155 OS::SNPrint(chars, len, kFormat, type_name.ToCString()); |
| 14157 return chars; | 14156 return chars; |
| 14158 } | 14157 } |
| 14159 } | 14158 } |
| 14160 | 14159 |
| 14161 | 14160 |
| 14162 void Instance::PrintSharedInstanceJSON(JSONObject* jsobj, | 14161 void Instance::PrintSharedInstanceJSON(JSONObject* jsobj, |
| 14163 bool ref) const { | 14162 bool ref) const { |
| 14164 AddTypeProperties(jsobj, "Instance", JSONType(), ref); | 14163 AddCommonObjectProperties(jsobj, "Instance", ref); |
| 14165 Class& cls = Class::Handle(this->clazz()); | |
| 14166 jsobj->AddProperty("class", cls); | |
| 14167 // TODO(turnidge): Provide the type arguments here too. | |
| 14168 if (ref) { | 14164 if (ref) { |
| 14169 return; | 14165 return; |
| 14170 } | 14166 } |
| 14171 | 14167 |
| 14172 if (raw()->IsHeapObject()) { | |
| 14173 jsobj->AddProperty("size", raw()->Size()); | |
| 14174 } else { | |
| 14175 jsobj->AddProperty("size", (intptr_t)0); | |
| 14176 } | |
| 14177 | |
| 14178 // Walk the superclass chain, adding all instance fields. | 14168 // Walk the superclass chain, adding all instance fields. |
| 14169 Class& cls = Class::Handle(this->clazz()); |
| 14179 { | 14170 { |
| 14180 Instance& fieldValue = Instance::Handle(); | 14171 Instance& fieldValue = Instance::Handle(); |
| 14181 JSONArray jsarr(jsobj, "fields"); | 14172 JSONArray jsarr(jsobj, "fields"); |
| 14182 while (!cls.IsNull()) { | 14173 while (!cls.IsNull()) { |
| 14183 const Array& field_array = Array::Handle(cls.fields()); | 14174 const Array& field_array = Array::Handle(cls.fields()); |
| 14184 Field& field = Field::Handle(); | 14175 Field& field = Field::Handle(); |
| 14185 if (!field_array.IsNull()) { | 14176 if (!field_array.IsNull()) { |
| 14186 for (intptr_t i = 0; i < field_array.Length(); i++) { | 14177 for (intptr_t i = 0; i < field_array.Length(); i++) { |
| 14187 field ^= field_array.At(i); | 14178 field ^= field_array.At(i); |
| 14188 if (!field.is_static()) { | 14179 if (!field.is_static()) { |
| (...skipping 1333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 15522 JSONObject jsobj(stream); | 15513 JSONObject jsobj(stream); |
| 15523 PrintSharedInstanceJSON(&jsobj, ref); | 15514 PrintSharedInstanceJSON(&jsobj, ref); |
| 15524 jsobj.AddProperty("kind", "TypeRef"); | 15515 jsobj.AddProperty("kind", "TypeRef"); |
| 15525 jsobj.AddServiceId(*this); | 15516 jsobj.AddServiceId(*this); |
| 15526 const String& user_name = String::Handle(PrettyName()); | 15517 const String& user_name = String::Handle(PrettyName()); |
| 15527 const String& vm_name = String::Handle(Name()); | 15518 const String& vm_name = String::Handle(Name()); |
| 15528 AddNameProperties(&jsobj, user_name, vm_name); | 15519 AddNameProperties(&jsobj, user_name, vm_name); |
| 15529 if (ref) { | 15520 if (ref) { |
| 15530 return; | 15521 return; |
| 15531 } | 15522 } |
| 15532 jsobj.AddProperty("type", AbstractType::Handle(type())); | 15523 jsobj.AddProperty("targetType", AbstractType::Handle(type())); |
| 15533 } | 15524 } |
| 15534 | 15525 |
| 15535 | 15526 |
| 15536 void TypeParameter::set_is_finalized() const { | 15527 void TypeParameter::set_is_finalized() const { |
| 15537 ASSERT(!IsFinalized()); | 15528 ASSERT(!IsFinalized()); |
| 15538 set_type_state(RawTypeParameter::kFinalizedUninstantiated); | 15529 set_type_state(RawTypeParameter::kFinalizedUninstantiated); |
| 15539 } | 15530 } |
| 15540 | 15531 |
| 15541 | 15532 |
| 15542 bool TypeParameter::IsEquivalent(const Instance& other, | 15533 bool TypeParameter::IsEquivalent(const Instance& other, |
| (...skipping 429 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 15972 JSONObject jsobj(stream); | 15963 JSONObject jsobj(stream); |
| 15973 PrintSharedInstanceJSON(&jsobj, ref); | 15964 PrintSharedInstanceJSON(&jsobj, ref); |
| 15974 jsobj.AddProperty("kind", "BoundedType"); | 15965 jsobj.AddProperty("kind", "BoundedType"); |
| 15975 jsobj.AddServiceId(*this); | 15966 jsobj.AddServiceId(*this); |
| 15976 const String& user_name = String::Handle(PrettyName()); | 15967 const String& user_name = String::Handle(PrettyName()); |
| 15977 const String& vm_name = String::Handle(Name()); | 15968 const String& vm_name = String::Handle(Name()); |
| 15978 AddNameProperties(&jsobj, user_name, vm_name); | 15969 AddNameProperties(&jsobj, user_name, vm_name); |
| 15979 if (ref) { | 15970 if (ref) { |
| 15980 return; | 15971 return; |
| 15981 } | 15972 } |
| 15982 jsobj.AddProperty("type", AbstractType::Handle(type())); | 15973 jsobj.AddProperty("targetType", AbstractType::Handle(type())); |
| 15983 jsobj.AddProperty("bound", AbstractType::Handle(bound())); | 15974 jsobj.AddProperty("bound", AbstractType::Handle(bound())); |
| 15984 } | 15975 } |
| 15985 | 15976 |
| 15986 | 15977 |
| 15987 intptr_t MixinAppType::token_pos() const { | 15978 intptr_t MixinAppType::token_pos() const { |
| 15988 return AbstractType::Handle(MixinTypeAt(0)).token_pos(); | 15979 return AbstractType::Handle(MixinTypeAt(0)).token_pos(); |
| 15989 } | 15980 } |
| 15990 | 15981 |
| 15991 | 15982 |
| 15992 intptr_t MixinAppType::Depth() const { | 15983 intptr_t MixinAppType::Depth() const { |
| (...skipping 3374 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 19367 jsobj.AddProperty("kind", "List"); | 19358 jsobj.AddProperty("kind", "List"); |
| 19368 jsobj.AddServiceId(*this); | 19359 jsobj.AddServiceId(*this); |
| 19369 jsobj.AddProperty("length", Length()); | 19360 jsobj.AddProperty("length", Length()); |
| 19370 if (ref) { | 19361 if (ref) { |
| 19371 return; | 19362 return; |
| 19372 } | 19363 } |
| 19373 { | 19364 { |
| 19374 JSONArray jsarr(&jsobj, "elements"); | 19365 JSONArray jsarr(&jsobj, "elements"); |
| 19375 Object& element = Object::Handle(); | 19366 Object& element = Object::Handle(); |
| 19376 for (intptr_t index = 0; index < Length(); index++) { | 19367 for (intptr_t index = 0; index < Length(); index++) { |
| 19377 JSONObject jselement(&jsarr); | |
| 19378 jselement.AddProperty("index", index); | |
| 19379 | |
| 19380 element = At(index); | 19368 element = At(index); |
| 19381 jselement.AddProperty("value", element); | 19369 jsarr.AddValue(element); |
| 19382 } | 19370 } |
| 19383 } | 19371 } |
| 19384 } | 19372 } |
| 19385 | 19373 |
| 19386 | 19374 |
| 19387 RawArray* Array::Grow(const Array& source, | 19375 RawArray* Array::Grow(const Array& source, |
| 19388 intptr_t new_length, | 19376 intptr_t new_length, |
| 19389 Heap::Space space) { | 19377 Heap::Space space) { |
| 19390 Isolate* isolate = Isolate::Current(); | 19378 Isolate* isolate = Isolate::Current(); |
| 19391 const Array& result = Array::Handle(isolate, Array::New(new_length, space)); | 19379 const Array& result = Array::Handle(isolate, Array::New(new_length, space)); |
| (...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 19614 jsobj.AddProperty("kind", "List"); | 19602 jsobj.AddProperty("kind", "List"); |
| 19615 jsobj.AddServiceId(*this); | 19603 jsobj.AddServiceId(*this); |
| 19616 jsobj.AddProperty("length", Length()); | 19604 jsobj.AddProperty("length", Length()); |
| 19617 if (ref) { | 19605 if (ref) { |
| 19618 return; | 19606 return; |
| 19619 } | 19607 } |
| 19620 { | 19608 { |
| 19621 JSONArray jsarr(&jsobj, "elements"); | 19609 JSONArray jsarr(&jsobj, "elements"); |
| 19622 Object& element = Object::Handle(); | 19610 Object& element = Object::Handle(); |
| 19623 for (intptr_t index = 0; index < Length(); index++) { | 19611 for (intptr_t index = 0; index < Length(); index++) { |
| 19624 JSONObject jselement(&jsarr); | |
| 19625 jselement.AddProperty("index", index); | |
| 19626 | |
| 19627 element = At(index); | 19612 element = At(index); |
| 19628 jselement.AddProperty("value", element); | 19613 jsarr.AddValue(element); |
| 19629 } | 19614 } |
| 19630 } | 19615 } |
| 19631 } | 19616 } |
| 19632 | 19617 |
| 19633 | 19618 |
| 19634 // Equivalent to Dart's operator "==" and hashCode. | 19619 // Equivalent to Dart's operator "==" and hashCode. |
| 19635 class DefaultHashTraits { | 19620 class DefaultHashTraits { |
| 19636 public: | 19621 public: |
| 19637 static bool IsMatch(const Object& a, const Object& b) { | 19622 static bool IsMatch(const Object& a, const Object& b) { |
| 19638 if (a.IsNull() || b.IsNull()) { | 19623 if (a.IsNull() || b.IsNull()) { |
| (...skipping 1184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 20823 return tag_label.ToCString(); | 20808 return tag_label.ToCString(); |
| 20824 } | 20809 } |
| 20825 | 20810 |
| 20826 | 20811 |
| 20827 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const { | 20812 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const { |
| 20828 Instance::PrintJSONImpl(stream, ref); | 20813 Instance::PrintJSONImpl(stream, ref); |
| 20829 } | 20814 } |
| 20830 | 20815 |
| 20831 | 20816 |
| 20832 } // namespace dart | 20817 } // namespace dart |
| OLD | NEW |