| 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 1591 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1602 jsobj->AddProperty("_vmType", vm_type); | 1602 jsobj->AddProperty("_vmType", vm_type); |
| 1603 } | 1603 } |
| 1604 } | 1604 } |
| 1605 } | 1605 } |
| 1606 | 1606 |
| 1607 | 1607 |
| 1608 void Object::PrintJSON(JSONStream* stream, bool ref) const { | 1608 void Object::PrintJSON(JSONStream* stream, bool ref) const { |
| 1609 if (IsNull()) { | 1609 if (IsNull()) { |
| 1610 JSONObject jsobj(stream); | 1610 JSONObject jsobj(stream); |
| 1611 AddTypeProperties(&jsobj, "null", JSONType(), ref); | 1611 AddTypeProperties(&jsobj, "null", JSONType(), ref); |
| 1612 jsobj.AddProperty("id", "objects/null"); | 1612 jsobj.AddFixedServiceId("objects/null"); |
| 1613 jsobj.AddProperty("valueAsString", "null"); | 1613 jsobj.AddProperty("valueAsString", "null"); |
| 1614 if (!ref) { | 1614 if (!ref) { |
| 1615 const Class& cls = Class::Handle(this->clazz()); | 1615 const Class& cls = Class::Handle(this->clazz()); |
| 1616 jsobj.AddProperty("class", cls); | 1616 jsobj.AddProperty("class", cls); |
| 1617 jsobj.AddProperty("size", raw()->Size()); | 1617 jsobj.AddProperty("size", raw()->Size()); |
| 1618 } | 1618 } |
| 1619 } else { | 1619 } else { |
| 1620 PrintJSONImpl(stream, ref); | 1620 PrintJSONImpl(stream, ref); |
| 1621 } | 1621 } |
| 1622 } | 1622 } |
| 1623 | 1623 |
| 1624 | 1624 |
| 1625 void Object::PrintJSONImpl(JSONStream* stream, bool ref) const { | 1625 void Object::PrintJSONImpl(JSONStream* stream, bool ref) const { |
| 1626 JSONObject jsobj(stream); | 1626 JSONObject jsobj(stream); |
| 1627 AddTypeProperties(&jsobj, "Object", JSONType(), ref); | 1627 AddTypeProperties(&jsobj, "Object", JSONType(), ref); |
| 1628 jsobj.AddServiceId("id", *this); | 1628 jsobj.AddServiceId(*this); |
| 1629 if (ref) { | 1629 if (ref) { |
| 1630 return; | 1630 return; |
| 1631 } | 1631 } |
| 1632 Class& cls = Class::Handle(this->clazz()); | 1632 Class& cls = Class::Handle(this->clazz()); |
| 1633 jsobj.AddProperty("class", cls); | 1633 jsobj.AddProperty("class", cls); |
| 1634 jsobj.AddProperty("size", raw()->Size()); | 1634 jsobj.AddProperty("size", raw()->Size()); |
| 1635 } | 1635 } |
| 1636 | 1636 |
| 1637 | 1637 |
| 1638 RawString* Object::DictionaryName() const { | 1638 RawString* Object::DictionaryName() const { |
| (...skipping 2467 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4106 | 4106 |
| 4107 void Class::PrintJSONImpl(JSONStream* stream, bool ref) const { | 4107 void Class::PrintJSONImpl(JSONStream* stream, bool ref) const { |
| 4108 JSONObject jsobj(stream); | 4108 JSONObject jsobj(stream); |
| 4109 if ((raw() == Class::null()) || (id() == kFreeListElement)) { | 4109 if ((raw() == Class::null()) || (id() == kFreeListElement)) { |
| 4110 // TODO(turnidge): This is weird. See if there is another way to | 4110 // TODO(turnidge): This is weird. See if there is another way to |
| 4111 // handle this. | 4111 // handle this. |
| 4112 jsobj.AddProperty("type", "null"); | 4112 jsobj.AddProperty("type", "null"); |
| 4113 return; | 4113 return; |
| 4114 } | 4114 } |
| 4115 AddTypeProperties(&jsobj, "Class", JSONType(), ref); | 4115 AddTypeProperties(&jsobj, "Class", JSONType(), ref); |
| 4116 jsobj.AddPropertyF("id", "classes/%" Pd "", id()); | 4116 jsobj.AddFixedServiceId("classes/%" Pd "", id()); |
| 4117 const String& user_name = String::Handle(PrettyName()); | 4117 const String& user_name = String::Handle(PrettyName()); |
| 4118 const String& vm_name = String::Handle(Name()); | 4118 const String& vm_name = String::Handle(Name()); |
| 4119 AddNameProperties(&jsobj, user_name, vm_name); | 4119 AddNameProperties(&jsobj, user_name, vm_name); |
| 4120 if (ref) { | 4120 if (ref) { |
| 4121 return; | 4121 return; |
| 4122 } | 4122 } |
| 4123 | 4123 |
| 4124 const Error& err = Error::Handle(EnsureIsFinalized(Isolate::Current())); | 4124 const Error& err = Error::Handle(EnsureIsFinalized(Isolate::Current())); |
| 4125 if (!err.IsNull()) { | 4125 if (!err.IsNull()) { |
| 4126 jsobj.AddProperty("error", err); | 4126 jsobj.AddProperty("error", err); |
| (...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4436 void TypeArguments::PrintJSONImpl(JSONStream* stream, bool ref) const { | 4436 void TypeArguments::PrintJSONImpl(JSONStream* stream, bool ref) const { |
| 4437 JSONObject jsobj(stream); | 4437 JSONObject jsobj(stream); |
| 4438 // The index in the canonical_type_arguments table cannot be used as part of | 4438 // The index in the canonical_type_arguments table cannot be used as part of |
| 4439 // the object id (as in typearguments/id), because the indices are not | 4439 // the object id (as in typearguments/id), because the indices are not |
| 4440 // preserved when the table grows and the entries get rehashed. Use the ring. | 4440 // preserved when the table grows and the entries get rehashed. Use the ring. |
| 4441 Isolate* isolate = Isolate::Current(); | 4441 Isolate* isolate = Isolate::Current(); |
| 4442 ObjectStore* object_store = isolate->object_store(); | 4442 ObjectStore* object_store = isolate->object_store(); |
| 4443 const Array& table = Array::Handle(object_store->canonical_type_arguments()); | 4443 const Array& table = Array::Handle(object_store->canonical_type_arguments()); |
| 4444 ASSERT(table.Length() > 0); | 4444 ASSERT(table.Length() > 0); |
| 4445 AddTypeProperties(&jsobj, "TypeArguments", JSONType(), ref); | 4445 AddTypeProperties(&jsobj, "TypeArguments", JSONType(), ref); |
| 4446 jsobj.AddServiceId("id", *this); | 4446 jsobj.AddServiceId(*this); |
| 4447 const String& user_name = String::Handle(PrettyName()); | 4447 const String& user_name = String::Handle(PrettyName()); |
| 4448 const String& vm_name = String::Handle(Name()); | 4448 const String& vm_name = String::Handle(Name()); |
| 4449 AddNameProperties(&jsobj, user_name, vm_name); | 4449 AddNameProperties(&jsobj, user_name, vm_name); |
| 4450 if (ref) { | 4450 if (ref) { |
| 4451 return; | 4451 return; |
| 4452 } | 4452 } |
| 4453 { | 4453 { |
| 4454 JSONArray jsarr(&jsobj, "types"); | 4454 JSONArray jsarr(&jsobj, "types"); |
| 4455 AbstractType& type_arg = AbstractType::Handle(); | 4455 AbstractType& type_arg = AbstractType::Handle(); |
| 4456 for (intptr_t i = 0; i < Length(); i++) { | 4456 for (intptr_t i = 0; i < Length(); i++) { |
| (...skipping 2384 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6841 selector = "closures"; | 6841 selector = "closures"; |
| 6842 } else if (f.IsImplicitClosureFunction()) { | 6842 } else if (f.IsImplicitClosureFunction()) { |
| 6843 id = cls.FindImplicitClosureFunctionIndex(f); | 6843 id = cls.FindImplicitClosureFunctionIndex(f); |
| 6844 selector = "implicit_closures"; | 6844 selector = "implicit_closures"; |
| 6845 } else if (f.IsNoSuchMethodDispatcher() || f.IsInvokeFieldDispatcher()) { | 6845 } else if (f.IsNoSuchMethodDispatcher() || f.IsInvokeFieldDispatcher()) { |
| 6846 id = cls.FindInvocationDispatcherFunctionIndex(f); | 6846 id = cls.FindInvocationDispatcherFunctionIndex(f); |
| 6847 selector = "dispatchers"; | 6847 selector = "dispatchers"; |
| 6848 } | 6848 } |
| 6849 if (id != -1) { | 6849 if (id != -1) { |
| 6850 ASSERT(selector != NULL); | 6850 ASSERT(selector != NULL); |
| 6851 jsobj.AddPropertyF("id", "classes/%" Pd "/%s/%" Pd "", | 6851 jsobj.AddFixedServiceId("classes/%" Pd "/%s/%" Pd "", |
| 6852 cls.id(), selector, id); | 6852 cls.id(), selector, id); |
| 6853 return; | 6853 return; |
| 6854 } | 6854 } |
| 6855 // Regular functions known to their owner use their name (percent-encoded). | 6855 // Regular functions known to their owner use their name (percent-encoded). |
| 6856 String& name = String::Handle(f.name()); | 6856 String& name = String::Handle(f.name()); |
| 6857 if (cls.LookupFunction(name) == f.raw()) { | 6857 if (cls.LookupFunction(name) == f.raw()) { |
| 6858 name = String::EncodeIRI(name); | 6858 name = String::EncodeIRI(name); |
| 6859 jsobj.AddPropertyF("id", "classes/%" Pd "/functions/%s", | 6859 jsobj.AddFixedServiceId("classes/%" Pd "/functions/%s", |
| 6860 cls.id(), name.ToCString()); | 6860 cls.id(), name.ToCString()); |
| 6861 return; | 6861 return; |
| 6862 } | 6862 } |
| 6863 // Oddball functions (not known to their owner) fall back to use the object | 6863 // Oddball functions (not known to their owner) fall back to use the object |
| 6864 // id ring. Current known examples are signature functions of closures | 6864 // id ring. Current known examples are signature functions of closures |
| 6865 // and stubs like 'megamorphic_miss'. | 6865 // and stubs like 'megamorphic_miss'. |
| 6866 jsobj.AddServiceId("id", f); | 6866 jsobj.AddServiceId(f); |
| 6867 } | 6867 } |
| 6868 | 6868 |
| 6869 | 6869 |
| 6870 void Function::PrintJSONImpl(JSONStream* stream, bool ref) const { | 6870 void Function::PrintJSONImpl(JSONStream* stream, bool ref) const { |
| 6871 Class& cls = Class::Handle(Owner()); | 6871 Class& cls = Class::Handle(Owner()); |
| 6872 ASSERT(!cls.IsNull()); | 6872 ASSERT(!cls.IsNull()); |
| 6873 Error& err = Error::Handle(); | 6873 Error& err = Error::Handle(); |
| 6874 err ^= cls.EnsureIsFinalized(Isolate::Current()); | 6874 err ^= cls.EnsureIsFinalized(Isolate::Current()); |
| 6875 ASSERT(err.IsNull()); | 6875 ASSERT(err.IsNull()); |
| 6876 JSONObject jsobj(stream); | 6876 JSONObject jsobj(stream); |
| (...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7218 return chars; | 7218 return chars; |
| 7219 } | 7219 } |
| 7220 | 7220 |
| 7221 void Field::PrintJSONImpl(JSONStream* stream, bool ref) const { | 7221 void Field::PrintJSONImpl(JSONStream* stream, bool ref) const { |
| 7222 JSONObject jsobj(stream); | 7222 JSONObject jsobj(stream); |
| 7223 Class& cls = Class::Handle(owner()); | 7223 Class& cls = Class::Handle(owner()); |
| 7224 intptr_t id = cls.FindFieldIndex(*this); | 7224 intptr_t id = cls.FindFieldIndex(*this); |
| 7225 ASSERT(id >= 0); | 7225 ASSERT(id >= 0); |
| 7226 intptr_t cid = cls.id(); | 7226 intptr_t cid = cls.id(); |
| 7227 AddTypeProperties(&jsobj, "Field", JSONType(), ref); | 7227 AddTypeProperties(&jsobj, "Field", JSONType(), ref); |
| 7228 jsobj.AddPropertyF("id", "classes/%" Pd "/fields/%" Pd "", cid, id); | 7228 jsobj.AddFixedServiceId("classes/%" Pd "/fields/%" Pd "", cid, id); |
| 7229 const String& user_name = String::Handle(PrettyName()); | 7229 const String& user_name = String::Handle(PrettyName()); |
| 7230 const String& vm_name = String::Handle(name()); | 7230 const String& vm_name = String::Handle(name()); |
| 7231 AddNameProperties(&jsobj, user_name, vm_name); | 7231 AddNameProperties(&jsobj, user_name, vm_name); |
| 7232 if (is_static()) { | 7232 if (is_static()) { |
| 7233 const Instance& valueObj = Instance::Handle(value()); | 7233 const Instance& valueObj = Instance::Handle(value()); |
| 7234 jsobj.AddProperty("value", valueObj); | 7234 jsobj.AddProperty("value", valueObj); |
| 7235 } | 7235 } |
| 7236 | 7236 |
| 7237 if (cls.IsTopLevel()) { | 7237 if (cls.IsTopLevel()) { |
| 7238 const Library& library = Library::Handle(cls.library()); | 7238 const Library& library = Library::Handle(cls.library()); |
| (...skipping 766 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8005 const char* TokenStream::ToCString() const { | 8005 const char* TokenStream::ToCString() const { |
| 8006 return "TokenStream"; | 8006 return "TokenStream"; |
| 8007 } | 8007 } |
| 8008 | 8008 |
| 8009 | 8009 |
| 8010 void TokenStream::PrintJSONImpl(JSONStream* stream, bool ref) const { | 8010 void TokenStream::PrintJSONImpl(JSONStream* stream, bool ref) const { |
| 8011 JSONObject jsobj(stream); | 8011 JSONObject jsobj(stream); |
| 8012 AddTypeProperties(&jsobj, "Object", JSONType(), ref); | 8012 AddTypeProperties(&jsobj, "Object", JSONType(), ref); |
| 8013 // TODO(johnmccutchan): Generate a stable id. TokenStreams hang off | 8013 // TODO(johnmccutchan): Generate a stable id. TokenStreams hang off |
| 8014 // a Script object but do not have a back reference to generate a stable id. | 8014 // a Script object but do not have a back reference to generate a stable id. |
| 8015 jsobj.AddServiceId("id", *this); | 8015 jsobj.AddServiceId(*this); |
| 8016 if (ref) { | 8016 if (ref) { |
| 8017 return; | 8017 return; |
| 8018 } | 8018 } |
| 8019 Class& cls = Class::Handle(this->clazz()); | 8019 Class& cls = Class::Handle(this->clazz()); |
| 8020 jsobj.AddProperty("class", cls); | 8020 jsobj.AddProperty("class", cls); |
| 8021 jsobj.AddProperty("size", raw()->Size()); | 8021 jsobj.AddProperty("size", raw()->Size()); |
| 8022 const String& private_key = String::Handle(PrivateKey()); | 8022 const String& private_key = String::Handle(PrivateKey()); |
| 8023 jsobj.AddProperty("privateKey", private_key); | 8023 jsobj.AddProperty("privateKey", private_key); |
| 8024 // TODO(johnmccutchan): Add support for printing LiteralTokens and add | 8024 // TODO(johnmccutchan): Add support for printing LiteralTokens and add |
| 8025 // them to members array. | 8025 // them to members array. |
| (...skipping 518 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8544 void Script::PrintJSONImpl(JSONStream* stream, bool ref) const { | 8544 void Script::PrintJSONImpl(JSONStream* stream, bool ref) const { |
| 8545 JSONObject jsobj(stream); | 8545 JSONObject jsobj(stream); |
| 8546 AddTypeProperties(&jsobj, "Script", JSONType(), ref); | 8546 AddTypeProperties(&jsobj, "Script", JSONType(), ref); |
| 8547 const String& uri = String::Handle(url()); | 8547 const String& uri = String::Handle(url()); |
| 8548 ASSERT(!uri.IsNull()); | 8548 ASSERT(!uri.IsNull()); |
| 8549 const String& encoded_uri = String::Handle(String::EncodeIRI(uri)); | 8549 const String& encoded_uri = String::Handle(String::EncodeIRI(uri)); |
| 8550 ASSERT(!encoded_uri.IsNull()); | 8550 ASSERT(!encoded_uri.IsNull()); |
| 8551 const Library& lib = Library::Handle(FindLibrary()); | 8551 const Library& lib = Library::Handle(FindLibrary()); |
| 8552 // TODO(rmacnak): This can fail for eval scripts. Use a ring-id for those. | 8552 // TODO(rmacnak): This can fail for eval scripts. Use a ring-id for those. |
| 8553 intptr_t lib_index = (lib.IsNull()) ? -1 : lib.index(); | 8553 intptr_t lib_index = (lib.IsNull()) ? -1 : lib.index(); |
| 8554 jsobj.AddPropertyF("id", "libraries/%" Pd "/scripts/%s", | 8554 jsobj.AddFixedServiceId("libraries/%" Pd "/scripts/%s", |
| 8555 lib_index, encoded_uri.ToCString()); | 8555 lib_index, encoded_uri.ToCString()); |
| 8556 jsobj.AddPropertyStr("uri", uri); | 8556 jsobj.AddPropertyStr("uri", uri); |
| 8557 jsobj.AddProperty("kind", GetKindAsCString()); | 8557 jsobj.AddProperty("kind", GetKindAsCString()); |
| 8558 if (ref) { | 8558 if (ref) { |
| 8559 return; | 8559 return; |
| 8560 } | 8560 } |
| 8561 jsobj.AddProperty("library", lib); | 8561 jsobj.AddProperty("library", lib); |
| 8562 const String& source = String::Handle(Source()); | 8562 const String& source = String::Handle(Source()); |
| 8563 jsobj.AddProperty("lineOffset", line_offset()); | 8563 jsobj.AddProperty("lineOffset", line_offset()); |
| 8564 jsobj.AddProperty("columnOffset", col_offset()); | 8564 jsobj.AddProperty("columnOffset", col_offset()); |
| (...skipping 1323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9888 return chars; | 9888 return chars; |
| 9889 } | 9889 } |
| 9890 | 9890 |
| 9891 | 9891 |
| 9892 void Library::PrintJSONImpl(JSONStream* stream, bool ref) const { | 9892 void Library::PrintJSONImpl(JSONStream* stream, bool ref) const { |
| 9893 const char* library_name = String::Handle(name()).ToCString(); | 9893 const char* library_name = String::Handle(name()).ToCString(); |
| 9894 intptr_t id = index(); | 9894 intptr_t id = index(); |
| 9895 ASSERT(id >= 0); | 9895 ASSERT(id >= 0); |
| 9896 JSONObject jsobj(stream); | 9896 JSONObject jsobj(stream); |
| 9897 AddTypeProperties(&jsobj, "Library", JSONType(), ref); | 9897 AddTypeProperties(&jsobj, "Library", JSONType(), ref); |
| 9898 jsobj.AddPropertyF("id", "libraries/%" Pd "", id); | 9898 jsobj.AddFixedServiceId("libraries/%" Pd "", id); |
| 9899 jsobj.AddProperty("name", library_name); | 9899 jsobj.AddProperty("name", library_name); |
| 9900 const String& library_url = String::Handle(url()); | 9900 const String& library_url = String::Handle(url()); |
| 9901 jsobj.AddPropertyStr("uri", library_url); | 9901 jsobj.AddPropertyStr("uri", library_url); |
| 9902 if (ref) { | 9902 if (ref) { |
| 9903 return; | 9903 return; |
| 9904 } | 9904 } |
| 9905 { | 9905 { |
| 9906 JSONArray jsarr(&jsobj, "classes"); | 9906 JSONArray jsarr(&jsobj, "classes"); |
| 9907 ClassDictionaryIterator class_iter(*this); | 9907 ClassDictionaryIterator class_iter(*this); |
| 9908 Class& klass = Class::Handle(); | 9908 Class& klass = Class::Handle(); |
| (...skipping 787 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10696 iter.TryIndex()); | 10696 iter.TryIndex()); |
| 10697 } | 10697 } |
| 10698 return buffer; | 10698 return buffer; |
| 10699 } | 10699 } |
| 10700 | 10700 |
| 10701 | 10701 |
| 10702 void PcDescriptors::PrintToJSONObject(JSONObject* jsobj, bool ref) const { | 10702 void PcDescriptors::PrintToJSONObject(JSONObject* jsobj, bool ref) const { |
| 10703 AddTypeProperties(jsobj, "Object", JSONType(), ref); | 10703 AddTypeProperties(jsobj, "Object", JSONType(), ref); |
| 10704 // TODO(johnmccutchan): Generate a stable id. PcDescriptors hang off a Code | 10704 // TODO(johnmccutchan): Generate a stable id. PcDescriptors hang off a Code |
| 10705 // object but do not have a back reference to generate an ID. | 10705 // object but do not have a back reference to generate an ID. |
| 10706 jsobj->AddServiceId("id", *this); | 10706 jsobj->AddServiceId(*this); |
| 10707 if (ref) { | 10707 if (ref) { |
| 10708 return; | 10708 return; |
| 10709 } | 10709 } |
| 10710 Class& cls = Class::Handle(this->clazz()); | 10710 Class& cls = Class::Handle(this->clazz()); |
| 10711 jsobj->AddProperty("class", cls); | 10711 jsobj->AddProperty("class", cls); |
| 10712 jsobj->AddProperty("size", raw()->Size()); | 10712 jsobj->AddProperty("size", raw()->Size()); |
| 10713 JSONArray members(jsobj, "members"); | 10713 JSONArray members(jsobj, "members"); |
| 10714 Iterator iter(*this, RawPcDescriptors::kAnyKind); | 10714 Iterator iter(*this, RawPcDescriptors::kAnyKind); |
| 10715 while (iter.MoveNext()) { | 10715 while (iter.MoveNext()) { |
| 10716 JSONObject descriptor(&members); | 10716 JSONObject descriptor(&members); |
| (...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10977 return buffer; | 10977 return buffer; |
| 10978 } | 10978 } |
| 10979 | 10979 |
| 10980 | 10980 |
| 10981 void LocalVarDescriptors::PrintJSONImpl(JSONStream* stream, | 10981 void LocalVarDescriptors::PrintJSONImpl(JSONStream* stream, |
| 10982 bool ref) const { | 10982 bool ref) const { |
| 10983 JSONObject jsobj(stream); | 10983 JSONObject jsobj(stream); |
| 10984 AddTypeProperties(&jsobj, "Object", JSONType(), ref); | 10984 AddTypeProperties(&jsobj, "Object", JSONType(), ref); |
| 10985 // TODO(johnmccutchan): Generate a stable id. LocalVarDescriptors hang off | 10985 // TODO(johnmccutchan): Generate a stable id. LocalVarDescriptors hang off |
| 10986 // a Code object but do not have a back reference to generate an ID. | 10986 // a Code object but do not have a back reference to generate an ID. |
| 10987 jsobj.AddServiceId("id", *this); | 10987 jsobj.AddServiceId(*this); |
| 10988 if (ref) { | 10988 if (ref) { |
| 10989 return; | 10989 return; |
| 10990 } | 10990 } |
| 10991 Class& cls = Class::Handle(this->clazz()); | 10991 Class& cls = Class::Handle(this->clazz()); |
| 10992 jsobj.AddProperty("class", cls); | 10992 jsobj.AddProperty("class", cls); |
| 10993 jsobj.AddProperty("size", raw()->Size()); | 10993 jsobj.AddProperty("size", raw()->Size()); |
| 10994 JSONArray members(&jsobj, "members"); | 10994 JSONArray members(&jsobj, "members"); |
| 10995 String& var_name = String::Handle(); | 10995 String& var_name = String::Handle(); |
| 10996 for (intptr_t i = 0; i < Length(); i++) { | 10996 for (intptr_t i = 0; i < Length(); i++) { |
| 10997 RawLocalVarDescriptors::VarInfo info; | 10997 RawLocalVarDescriptors::VarInfo info; |
| (...skipping 1638 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 12636 | 12636 |
| 12637 bool Code::IsFunctionCode() const { | 12637 bool Code::IsFunctionCode() const { |
| 12638 const Object& obj = Object::Handle(owner()); | 12638 const Object& obj = Object::Handle(owner()); |
| 12639 return obj.IsFunction(); | 12639 return obj.IsFunction(); |
| 12640 } | 12640 } |
| 12641 | 12641 |
| 12642 | 12642 |
| 12643 void Code::PrintJSONImpl(JSONStream* stream, bool ref) const { | 12643 void Code::PrintJSONImpl(JSONStream* stream, bool ref) const { |
| 12644 JSONObject jsobj(stream); | 12644 JSONObject jsobj(stream); |
| 12645 AddTypeProperties(&jsobj, "Code", JSONType(), ref); | 12645 AddTypeProperties(&jsobj, "Code", JSONType(), ref); |
| 12646 jsobj.AddPropertyF("id", "code/%" Px64"-%" Px "", compile_timestamp(), | 12646 jsobj.AddFixedServiceId("code/%" Px64"-%" Px "", |
| 12647 EntryPoint()); | 12647 compile_timestamp(), |
| 12648 EntryPoint()); |
| 12648 const String& user_name = String::Handle(PrettyName()); | 12649 const String& user_name = String::Handle(PrettyName()); |
| 12649 const String& vm_name = String::Handle(Name()); | 12650 const String& vm_name = String::Handle(Name()); |
| 12650 AddNameProperties(&jsobj, user_name, vm_name); | 12651 AddNameProperties(&jsobj, user_name, vm_name); |
| 12651 const bool is_stub = IsStubCode() || IsAllocationStubCode(); | 12652 const bool is_stub = IsStubCode() || IsAllocationStubCode(); |
| 12652 if (is_stub) { | 12653 if (is_stub) { |
| 12653 jsobj.AddProperty("kind", "Stub"); | 12654 jsobj.AddProperty("kind", "Stub"); |
| 12654 } else { | 12655 } else { |
| 12655 jsobj.AddProperty("kind", "Dart"); | 12656 jsobj.AddProperty("kind", "Dart"); |
| 12656 } | 12657 } |
| 12657 jsobj.AddProperty("_optimized", is_optimized()); | 12658 jsobj.AddProperty("_optimized", is_optimized()); |
| (...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 12934 IndentN(indent); | 12935 IndentN(indent); |
| 12935 OS::PrintErr("}\n"); | 12936 OS::PrintErr("}\n"); |
| 12936 } | 12937 } |
| 12937 | 12938 |
| 12938 | 12939 |
| 12939 void Context::PrintJSONImpl(JSONStream* stream, bool ref) const { | 12940 void Context::PrintJSONImpl(JSONStream* stream, bool ref) const { |
| 12940 JSONObject jsobj(stream); | 12941 JSONObject jsobj(stream); |
| 12941 // TODO(turnidge): Should the user level type for Context be Context | 12942 // TODO(turnidge): Should the user level type for Context be Context |
| 12942 // or Object? | 12943 // or Object? |
| 12943 AddTypeProperties(&jsobj, "Context", JSONType(), ref); | 12944 AddTypeProperties(&jsobj, "Context", JSONType(), ref); |
| 12944 jsobj.AddServiceId("id", *this); | 12945 jsobj.AddServiceId(*this); |
| 12945 | 12946 |
| 12946 jsobj.AddProperty("length", num_variables()); | 12947 jsobj.AddProperty("length", num_variables()); |
| 12947 | 12948 |
| 12948 if (ref) { | 12949 if (ref) { |
| 12949 return; | 12950 return; |
| 12950 } | 12951 } |
| 12951 | 12952 |
| 12952 Class& cls = Class::Handle(this->clazz()); | 12953 Class& cls = Class::Handle(this->clazz()); |
| 12953 jsobj.AddProperty("class", cls); | 12954 jsobj.AddProperty("class", cls); |
| 12954 | 12955 |
| (...skipping 398 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 13353 | 13354 |
| 13354 | 13355 |
| 13355 const char* ApiError::ToCString() const { | 13356 const char* ApiError::ToCString() const { |
| 13356 return "ApiError"; | 13357 return "ApiError"; |
| 13357 } | 13358 } |
| 13358 | 13359 |
| 13359 | 13360 |
| 13360 void ApiError::PrintJSONImpl(JSONStream* stream, bool ref) const { | 13361 void ApiError::PrintJSONImpl(JSONStream* stream, bool ref) const { |
| 13361 JSONObject jsobj(stream); | 13362 JSONObject jsobj(stream); |
| 13362 AddTypeProperties(&jsobj, "Error", JSONType(), ref); | 13363 AddTypeProperties(&jsobj, "Error", JSONType(), ref); |
| 13363 jsobj.AddProperty("id", ""); | |
| 13364 jsobj.AddProperty("message", ToErrorCString()); | 13364 jsobj.AddProperty("message", ToErrorCString()); |
| 13365 } | 13365 } |
| 13366 | 13366 |
| 13367 | 13367 |
| 13368 RawLanguageError* LanguageError::New() { | 13368 RawLanguageError* LanguageError::New() { |
| 13369 ASSERT(Object::language_error_class() != Class::null()); | 13369 ASSERT(Object::language_error_class() != Class::null()); |
| 13370 RawObject* raw = Object::Allocate(LanguageError::kClassId, | 13370 RawObject* raw = Object::Allocate(LanguageError::kClassId, |
| 13371 LanguageError::InstanceSize(), | 13371 LanguageError::InstanceSize(), |
| 13372 Heap::kOld); | 13372 Heap::kOld); |
| 13373 return reinterpret_cast<RawLanguageError*>(raw); | 13373 return reinterpret_cast<RawLanguageError*>(raw); |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 13491 | 13491 |
| 13492 | 13492 |
| 13493 const char* LanguageError::ToCString() const { | 13493 const char* LanguageError::ToCString() const { |
| 13494 return "LanguageError"; | 13494 return "LanguageError"; |
| 13495 } | 13495 } |
| 13496 | 13496 |
| 13497 | 13497 |
| 13498 void LanguageError::PrintJSONImpl(JSONStream* stream, bool ref) const { | 13498 void LanguageError::PrintJSONImpl(JSONStream* stream, bool ref) const { |
| 13499 JSONObject jsobj(stream); | 13499 JSONObject jsobj(stream); |
| 13500 AddTypeProperties(&jsobj, "Error", JSONType(), ref); | 13500 AddTypeProperties(&jsobj, "Error", JSONType(), ref); |
| 13501 jsobj.AddProperty("id", ""); | |
| 13502 jsobj.AddProperty("message", ToErrorCString()); | 13501 jsobj.AddProperty("message", ToErrorCString()); |
| 13503 } | 13502 } |
| 13504 | 13503 |
| 13505 | 13504 |
| 13506 RawUnhandledException* UnhandledException::New(const Instance& exception, | 13505 RawUnhandledException* UnhandledException::New(const Instance& exception, |
| 13507 const Instance& stacktrace, | 13506 const Instance& stacktrace, |
| 13508 Heap::Space space) { | 13507 Heap::Space space) { |
| 13509 ASSERT(Object::unhandled_exception_class() != Class::null()); | 13508 ASSERT(Object::unhandled_exception_class() != Class::null()); |
| 13510 UnhandledException& result = UnhandledException::Handle(); | 13509 UnhandledException& result = UnhandledException::Handle(); |
| 13511 { | 13510 { |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 13583 const char* UnhandledException::ToCString() const { | 13582 const char* UnhandledException::ToCString() const { |
| 13584 return "UnhandledException"; | 13583 return "UnhandledException"; |
| 13585 } | 13584 } |
| 13586 | 13585 |
| 13587 | 13586 |
| 13588 | 13587 |
| 13589 void UnhandledException::PrintJSONImpl(JSONStream* stream, | 13588 void UnhandledException::PrintJSONImpl(JSONStream* stream, |
| 13590 bool ref) const { | 13589 bool ref) const { |
| 13591 JSONObject jsobj(stream); | 13590 JSONObject jsobj(stream); |
| 13592 AddTypeProperties(&jsobj, "Error", JSONType(), ref); | 13591 AddTypeProperties(&jsobj, "Error", JSONType(), ref); |
| 13593 jsobj.AddProperty("id", ""); | |
| 13594 jsobj.AddProperty("message", ToErrorCString()); | 13592 jsobj.AddProperty("message", ToErrorCString()); |
| 13595 | 13593 |
| 13596 Instance& instance = Instance::Handle(); | 13594 Instance& instance = Instance::Handle(); |
| 13597 instance = exception(); | 13595 instance = exception(); |
| 13598 jsobj.AddProperty("exception", instance); | 13596 jsobj.AddProperty("exception", instance); |
| 13599 instance = stacktrace(); | 13597 instance = stacktrace(); |
| 13600 jsobj.AddProperty("stacktrace", instance); | 13598 jsobj.AddProperty("stacktrace", instance); |
| 13601 } | 13599 } |
| 13602 | 13600 |
| 13603 | 13601 |
| (...skipping 24 matching lines...) Expand all Loading... |
| 13628 | 13626 |
| 13629 | 13627 |
| 13630 const char* UnwindError::ToCString() const { | 13628 const char* UnwindError::ToCString() const { |
| 13631 return "UnwindError"; | 13629 return "UnwindError"; |
| 13632 } | 13630 } |
| 13633 | 13631 |
| 13634 | 13632 |
| 13635 void UnwindError::PrintJSONImpl(JSONStream* stream, bool ref) const { | 13633 void UnwindError::PrintJSONImpl(JSONStream* stream, bool ref) const { |
| 13636 JSONObject jsobj(stream); | 13634 JSONObject jsobj(stream); |
| 13637 AddTypeProperties(&jsobj, "Error", JSONType(), ref); | 13635 AddTypeProperties(&jsobj, "Error", JSONType(), ref); |
| 13638 jsobj.AddProperty("id", ""); | |
| 13639 jsobj.AddProperty("message", ToErrorCString()); | 13636 jsobj.AddProperty("message", ToErrorCString()); |
| 13640 } | 13637 } |
| 13641 | 13638 |
| 13642 | 13639 |
| 13643 RawObject* Instance::Evaluate(const String& expr, | 13640 RawObject* Instance::Evaluate(const String& expr, |
| 13644 const Array& param_names, | 13641 const Array& param_names, |
| 13645 const Array& param_values) const { | 13642 const Array& param_values) const { |
| 13646 const Class& cls = Class::Handle(clazz()); | 13643 const Class& cls = Class::Handle(clazz()); |
| 13647 const Function& eval_func = | 13644 const Function& eval_func = |
| 13648 Function::Handle(EvaluateHelper(cls, expr, param_names, false)); | 13645 Function::Handle(EvaluateHelper(cls, expr, param_names, false)); |
| (...skipping 475 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 14124 } | 14121 } |
| 14125 } | 14122 } |
| 14126 | 14123 |
| 14127 | 14124 |
| 14128 void Instance::PrintJSONImpl(JSONStream* stream, bool ref) const { | 14125 void Instance::PrintJSONImpl(JSONStream* stream, bool ref) const { |
| 14129 JSONObject jsobj(stream); | 14126 JSONObject jsobj(stream); |
| 14130 | 14127 |
| 14131 // Handle certain special instance values. | 14128 // Handle certain special instance values. |
| 14132 if (raw() == Object::sentinel().raw()) { | 14129 if (raw() == Object::sentinel().raw()) { |
| 14133 jsobj.AddProperty("type", "Sentinel"); | 14130 jsobj.AddProperty("type", "Sentinel"); |
| 14134 jsobj.AddProperty("id", "objects/not-initialized"); | 14131 jsobj.AddFixedServiceId("objects/not-initialized"); |
| 14135 jsobj.AddProperty("valueAsString", "<not initialized>"); | 14132 jsobj.AddProperty("valueAsString", "<not initialized>"); |
| 14136 return; | 14133 return; |
| 14137 } else if (raw() == Object::transition_sentinel().raw()) { | 14134 } else if (raw() == Object::transition_sentinel().raw()) { |
| 14138 jsobj.AddProperty("type", "Sentinel"); | 14135 jsobj.AddProperty("type", "Sentinel"); |
| 14139 jsobj.AddProperty("id", "objects/being-initialized"); | 14136 jsobj.AddFixedServiceId("objects/being-initialized"); |
| 14140 jsobj.AddProperty("valueAsString", "<being initialized>"); | 14137 jsobj.AddProperty("valueAsString", "<being initialized>"); |
| 14141 return; | 14138 return; |
| 14142 } | 14139 } |
| 14143 | 14140 |
| 14144 AddTypeProperties(&jsobj, "Instance", JSONType(), ref); | 14141 AddTypeProperties(&jsobj, "Instance", JSONType(), ref); |
| 14145 PrintSharedInstanceJSON(&jsobj, ref); | 14142 PrintSharedInstanceJSON(&jsobj, ref); |
| 14146 jsobj.AddServiceId("id", *this); | 14143 jsobj.AddServiceId(*this); |
| 14147 if (IsClosure()) { | 14144 if (IsClosure()) { |
| 14148 jsobj.AddProperty("function", Function::Handle(Closure::function(*this))); | 14145 jsobj.AddProperty("function", Function::Handle(Closure::function(*this))); |
| 14149 jsobj.AddProperty("context", Context::Handle(Closure::context(*this))); | 14146 jsobj.AddProperty("context", Context::Handle(Closure::context(*this))); |
| 14150 } | 14147 } |
| 14151 if (ref) { | 14148 if (ref) { |
| 14152 return; | 14149 return; |
| 14153 } | 14150 } |
| 14154 } | 14151 } |
| 14155 | 14152 |
| 14156 | 14153 |
| (...skipping 1082 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 15239 | 15236 |
| 15240 void Type::PrintJSONImpl(JSONStream* stream, bool ref) const { | 15237 void Type::PrintJSONImpl(JSONStream* stream, bool ref) const { |
| 15241 JSONObject jsobj(stream); | 15238 JSONObject jsobj(stream); |
| 15242 AddTypeProperties(&jsobj, "Type", JSONType(), ref); | 15239 AddTypeProperties(&jsobj, "Type", JSONType(), ref); |
| 15243 PrintSharedInstanceJSON(&jsobj, ref); | 15240 PrintSharedInstanceJSON(&jsobj, ref); |
| 15244 if (IsCanonical()) { | 15241 if (IsCanonical()) { |
| 15245 const Class& type_cls = Class::Handle(type_class()); | 15242 const Class& type_cls = Class::Handle(type_class()); |
| 15246 intptr_t id = type_cls.FindCanonicalTypeIndex(*this); | 15243 intptr_t id = type_cls.FindCanonicalTypeIndex(*this); |
| 15247 ASSERT(id >= 0); | 15244 ASSERT(id >= 0); |
| 15248 intptr_t cid = type_cls.id(); | 15245 intptr_t cid = type_cls.id(); |
| 15249 jsobj.AddPropertyF("id", "classes/%" Pd "/types/%" Pd "", cid, id); | 15246 jsobj.AddFixedServiceId("classes/%" Pd "/types/%" Pd "", cid, id); |
| 15250 jsobj.AddProperty("typeClass", type_cls); | 15247 jsobj.AddProperty("typeClass", type_cls); |
| 15251 } else { | 15248 } else { |
| 15252 jsobj.AddServiceId("id", *this); | 15249 jsobj.AddServiceId(*this); |
| 15253 } | 15250 } |
| 15254 const String& user_name = String::Handle(PrettyName()); | 15251 const String& user_name = String::Handle(PrettyName()); |
| 15255 const String& vm_name = String::Handle(Name()); | 15252 const String& vm_name = String::Handle(Name()); |
| 15256 AddNameProperties(&jsobj, user_name, vm_name); | 15253 AddNameProperties(&jsobj, user_name, vm_name); |
| 15257 if (ref) { | 15254 if (ref) { |
| 15258 return; | 15255 return; |
| 15259 } | 15256 } |
| 15260 const TypeArguments& typeArgs = TypeArguments::Handle(arguments()); | 15257 const TypeArguments& typeArgs = TypeArguments::Handle(arguments()); |
| 15261 if (!typeArgs.IsNull()) { | 15258 if (!typeArgs.IsNull()) { |
| 15262 jsobj.AddProperty("typeArguments", typeArgs); | 15259 jsobj.AddProperty("typeArguments", typeArgs); |
| (...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 15425 OS::SNPrint(chars, len, format, type_cstr); | 15422 OS::SNPrint(chars, len, format, type_cstr); |
| 15426 return chars; | 15423 return chars; |
| 15427 } | 15424 } |
| 15428 } | 15425 } |
| 15429 | 15426 |
| 15430 | 15427 |
| 15431 void TypeRef::PrintJSONImpl(JSONStream* stream, bool ref) const { | 15428 void TypeRef::PrintJSONImpl(JSONStream* stream, bool ref) const { |
| 15432 JSONObject jsobj(stream); | 15429 JSONObject jsobj(stream); |
| 15433 AddTypeProperties(&jsobj, "TypeRef", JSONType(), ref); | 15430 AddTypeProperties(&jsobj, "TypeRef", JSONType(), ref); |
| 15434 PrintSharedInstanceJSON(&jsobj, ref); | 15431 PrintSharedInstanceJSON(&jsobj, ref); |
| 15435 jsobj.AddServiceId("id", *this); | 15432 jsobj.AddServiceId(*this); |
| 15436 const String& user_name = String::Handle(PrettyName()); | 15433 const String& user_name = String::Handle(PrettyName()); |
| 15437 const String& vm_name = String::Handle(Name()); | 15434 const String& vm_name = String::Handle(Name()); |
| 15438 AddNameProperties(&jsobj, user_name, vm_name); | 15435 AddNameProperties(&jsobj, user_name, vm_name); |
| 15439 if (ref) { | 15436 if (ref) { |
| 15440 return; | 15437 return; |
| 15441 } | 15438 } |
| 15442 jsobj.AddProperty("refType", AbstractType::Handle(type())); | 15439 jsobj.AddProperty("refType", AbstractType::Handle(type())); |
| 15443 } | 15440 } |
| 15444 | 15441 |
| 15445 | 15442 |
| (...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 15659 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); | 15656 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); |
| 15660 OS::SNPrint(chars, len, format, name_cstr, index(), cls_cstr, bound_cstr); | 15657 OS::SNPrint(chars, len, format, name_cstr, index(), cls_cstr, bound_cstr); |
| 15661 return chars; | 15658 return chars; |
| 15662 } | 15659 } |
| 15663 | 15660 |
| 15664 | 15661 |
| 15665 void TypeParameter::PrintJSONImpl(JSONStream* stream, bool ref) const { | 15662 void TypeParameter::PrintJSONImpl(JSONStream* stream, bool ref) const { |
| 15666 JSONObject jsobj(stream); | 15663 JSONObject jsobj(stream); |
| 15667 AddTypeProperties(&jsobj, "TypeParameter", JSONType(), ref); | 15664 AddTypeProperties(&jsobj, "TypeParameter", JSONType(), ref); |
| 15668 PrintSharedInstanceJSON(&jsobj, ref); | 15665 PrintSharedInstanceJSON(&jsobj, ref); |
| 15669 jsobj.AddServiceId("id", *this); | 15666 jsobj.AddServiceId(*this); |
| 15670 const String& user_name = String::Handle(PrettyName()); | 15667 const String& user_name = String::Handle(PrettyName()); |
| 15671 const String& vm_name = String::Handle(Name()); | 15668 const String& vm_name = String::Handle(Name()); |
| 15672 AddNameProperties(&jsobj, user_name, vm_name); | 15669 AddNameProperties(&jsobj, user_name, vm_name); |
| 15673 const Class& param_cls = Class::Handle(parameterized_class()); | 15670 const Class& param_cls = Class::Handle(parameterized_class()); |
| 15674 jsobj.AddProperty("parameterizedClass", param_cls); | 15671 jsobj.AddProperty("parameterizedClass", param_cls); |
| 15675 if (ref) { | 15672 if (ref) { |
| 15676 return; | 15673 return; |
| 15677 } | 15674 } |
| 15678 jsobj.AddProperty("index", index()); | 15675 jsobj.AddProperty("index", index()); |
| 15679 const AbstractType& upper_bound = AbstractType::Handle(bound()); | 15676 const AbstractType& upper_bound = AbstractType::Handle(bound()); |
| (...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 15875 OS::SNPrint( | 15872 OS::SNPrint( |
| 15876 chars, len, format, type_cstr, bound_cstr, type_param_cstr, cls_cstr); | 15873 chars, len, format, type_cstr, bound_cstr, type_param_cstr, cls_cstr); |
| 15877 return chars; | 15874 return chars; |
| 15878 } | 15875 } |
| 15879 | 15876 |
| 15880 | 15877 |
| 15881 void BoundedType::PrintJSONImpl(JSONStream* stream, bool ref) const { | 15878 void BoundedType::PrintJSONImpl(JSONStream* stream, bool ref) const { |
| 15882 JSONObject jsobj(stream); | 15879 JSONObject jsobj(stream); |
| 15883 AddTypeProperties(&jsobj, "BoundedType", JSONType(), ref); | 15880 AddTypeProperties(&jsobj, "BoundedType", JSONType(), ref); |
| 15884 PrintSharedInstanceJSON(&jsobj, ref); | 15881 PrintSharedInstanceJSON(&jsobj, ref); |
| 15885 jsobj.AddServiceId("id", *this); | 15882 jsobj.AddServiceId(*this); |
| 15886 const String& user_name = String::Handle(PrettyName()); | 15883 const String& user_name = String::Handle(PrettyName()); |
| 15887 const String& vm_name = String::Handle(Name()); | 15884 const String& vm_name = String::Handle(Name()); |
| 15888 AddNameProperties(&jsobj, user_name, vm_name); | 15885 AddNameProperties(&jsobj, user_name, vm_name); |
| 15889 if (ref) { | 15886 if (ref) { |
| 15890 return; | 15887 return; |
| 15891 } | 15888 } |
| 15892 jsobj.AddProperty("boundedType", AbstractType::Handle(type())); | 15889 jsobj.AddProperty("boundedType", AbstractType::Handle(type())); |
| 15893 jsobj.AddProperty("upperBound", AbstractType::Handle(bound())); | 15890 jsobj.AddProperty("upperBound", AbstractType::Handle(bound())); |
| 15894 } | 15891 } |
| 15895 | 15892 |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 15978 // Integer is an interface. No instances of Integer should exist. | 15975 // Integer is an interface. No instances of Integer should exist. |
| 15979 UNREACHABLE(); | 15976 UNREACHABLE(); |
| 15980 return "Integer"; | 15977 return "Integer"; |
| 15981 } | 15978 } |
| 15982 | 15979 |
| 15983 | 15980 |
| 15984 void Integer::PrintJSONImpl(JSONStream* stream, bool ref) const { | 15981 void Integer::PrintJSONImpl(JSONStream* stream, bool ref) const { |
| 15985 JSONObject jsobj(stream); | 15982 JSONObject jsobj(stream); |
| 15986 AddTypeProperties(&jsobj, "int", JSONType(), ref); | 15983 AddTypeProperties(&jsobj, "int", JSONType(), ref); |
| 15987 PrintSharedInstanceJSON(&jsobj, ref); | 15984 PrintSharedInstanceJSON(&jsobj, ref); |
| 15988 jsobj.AddServiceId("id", *this); | 15985 jsobj.AddServiceId(*this); |
| 15989 jsobj.AddProperty("valueAsString", ToCString()); | 15986 jsobj.AddProperty("valueAsString", ToCString()); |
| 15990 } | 15987 } |
| 15991 | 15988 |
| 15992 | 15989 |
| 15993 // Throw JavascriptIntegerOverflow exception. | 15990 // Throw JavascriptIntegerOverflow exception. |
| 15994 static void ThrowJavascriptIntegerOverflow(const Integer& i) { | 15991 static void ThrowJavascriptIntegerOverflow(const Integer& i) { |
| 15995 const Array& exc_args = Array::Handle(Array::New(1)); | 15992 const Array& exc_args = Array::Handle(Array::New(1)); |
| 15996 const String& i_str = String::Handle(String::New(i.ToCString())); | 15993 const String& i_str = String::Handle(String::New(i.ToCString())); |
| 15997 exc_args.SetAt(0, i_str); | 15994 exc_args.SetAt(0, i_str); |
| 15998 Exceptions::ThrowByType(Exceptions::kJavascriptIntegerOverflowError, | 15995 Exceptions::ThrowByType(Exceptions::kJavascriptIntegerOverflowError, |
| (...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 16407 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); | 16404 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); |
| 16408 OS::SNPrint(chars, len, kFormat, Value()); | 16405 OS::SNPrint(chars, len, kFormat, Value()); |
| 16409 return chars; | 16406 return chars; |
| 16410 } | 16407 } |
| 16411 | 16408 |
| 16412 | 16409 |
| 16413 void Smi::PrintJSONImpl(JSONStream* stream, bool ref) const { | 16410 void Smi::PrintJSONImpl(JSONStream* stream, bool ref) const { |
| 16414 JSONObject jsobj(stream); | 16411 JSONObject jsobj(stream); |
| 16415 AddTypeProperties(&jsobj, "int", JSONType(), ref); | 16412 AddTypeProperties(&jsobj, "int", JSONType(), ref); |
| 16416 PrintSharedInstanceJSON(&jsobj, ref); | 16413 PrintSharedInstanceJSON(&jsobj, ref); |
| 16417 jsobj.AddPropertyF("id", "objects/int-%" Pd "", Value()); | 16414 jsobj.AddFixedServiceId("objects/int-%" Pd "", Value()); |
| 16418 jsobj.AddPropertyF("valueAsString", "%" Pd "", Value()); | 16415 jsobj.AddPropertyF("valueAsString", "%" Pd "", Value()); |
| 16419 } | 16416 } |
| 16420 | 16417 |
| 16421 | 16418 |
| 16422 RawClass* Smi::Class() { | 16419 RawClass* Smi::Class() { |
| 16423 return Isolate::Current()->object_store()->smi_class(); | 16420 return Isolate::Current()->object_store()->smi_class(); |
| 16424 } | 16421 } |
| 16425 | 16422 |
| 16426 | 16423 |
| 16427 void Mint::set_value(int64_t value) const { | 16424 void Mint::set_value(int64_t value) const { |
| (...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 16671 return buffer; | 16668 return buffer; |
| 16672 } | 16669 } |
| 16673 | 16670 |
| 16674 | 16671 |
| 16675 void Double::PrintJSONImpl(JSONStream* stream, bool ref) const { | 16672 void Double::PrintJSONImpl(JSONStream* stream, bool ref) const { |
| 16676 JSONObject jsobj(stream); | 16673 JSONObject jsobj(stream); |
| 16677 // Suppress the fact that the internal vm name for this type is | 16674 // Suppress the fact that the internal vm name for this type is |
| 16678 // "Double". Return "double" instead. | 16675 // "Double". Return "double" instead. |
| 16679 AddTypeProperties(&jsobj, "double", "double", ref); | 16676 AddTypeProperties(&jsobj, "double", "double", ref); |
| 16680 PrintSharedInstanceJSON(&jsobj, ref); | 16677 PrintSharedInstanceJSON(&jsobj, ref); |
| 16681 jsobj.AddServiceId("id", *this); | 16678 jsobj.AddServiceId(*this); |
| 16682 jsobj.AddProperty("valueAsString", ToCString()); | 16679 jsobj.AddProperty("valueAsString", ToCString()); |
| 16683 } | 16680 } |
| 16684 | 16681 |
| 16685 | 16682 |
| 16686 bool Bigint::Neg() const { | 16683 bool Bigint::Neg() const { |
| 16687 return Bool::Handle(neg()).value(); | 16684 return Bool::Handle(neg()).value(); |
| 16688 } | 16685 } |
| 16689 | 16686 |
| 16690 | 16687 |
| 16691 void Bigint::SetNeg(bool value) const { | 16688 void Bigint::SetNeg(bool value) const { |
| (...skipping 1564 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 18256 } | 18253 } |
| 18257 | 18254 |
| 18258 | 18255 |
| 18259 void String::PrintJSONImpl(JSONStream* stream, bool ref) const { | 18256 void String::PrintJSONImpl(JSONStream* stream, bool ref) const { |
| 18260 JSONObject jsobj(stream); | 18257 JSONObject jsobj(stream); |
| 18261 if (raw() == Symbols::OptimizedOut().raw()) { | 18258 if (raw() == Symbols::OptimizedOut().raw()) { |
| 18262 // TODO(turnidge): This is a hack. The user could have this | 18259 // TODO(turnidge): This is a hack. The user could have this |
| 18263 // special string in their program. Fixing this involves updating | 18260 // special string in their program. Fixing this involves updating |
| 18264 // the debugging api a bit. | 18261 // the debugging api a bit. |
| 18265 jsobj.AddProperty("type", "Sentinel"); | 18262 jsobj.AddProperty("type", "Sentinel"); |
| 18266 jsobj.AddProperty("id", "objects/optimized-out"); | 18263 jsobj.AddFixedServiceId("objects/optimized-out"); |
| 18267 jsobj.AddProperty("valueAsString", "<optimized out>"); | 18264 jsobj.AddProperty("valueAsString", "<optimized out>"); |
| 18268 return; | 18265 return; |
| 18269 } | 18266 } |
| 18270 AddTypeProperties(&jsobj, "String", JSONType(), ref); | 18267 AddTypeProperties(&jsobj, "String", JSONType(), ref); |
| 18271 PrintSharedInstanceJSON(&jsobj, ref); | 18268 PrintSharedInstanceJSON(&jsobj, ref); |
| 18272 jsobj.AddServiceId("id", *this); | 18269 jsobj.AddServiceId(*this); |
| 18273 if (ref) { | 18270 if (ref) { |
| 18274 bool did_truncate = jsobj.AddPropertyStr("valueAsString", *this, 128); | 18271 bool did_truncate = jsobj.AddPropertyStr("valueAsString", *this, 128); |
| 18275 if (did_truncate) { | 18272 if (did_truncate) { |
| 18276 jsobj.AddProperty("valueAsStringIsTruncated", did_truncate); | 18273 jsobj.AddProperty("valueAsStringIsTruncated", did_truncate); |
| 18277 } | 18274 } |
| 18278 } else { | 18275 } else { |
| 18279 bool did_truncate = jsobj.AddPropertyStr("valueAsString", *this); | 18276 bool did_truncate = jsobj.AddPropertyStr("valueAsString", *this); |
| 18280 ASSERT(!did_truncate); | 18277 ASSERT(!did_truncate); |
| 18281 } | 18278 } |
| 18282 } | 18279 } |
| (...skipping 890 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 19173 } | 19170 } |
| 19174 | 19171 |
| 19175 | 19172 |
| 19176 void Bool::PrintJSONImpl(JSONStream* stream, bool ref) const { | 19173 void Bool::PrintJSONImpl(JSONStream* stream, bool ref) const { |
| 19177 const char* str = ToCString(); | 19174 const char* str = ToCString(); |
| 19178 JSONObject jsobj(stream); | 19175 JSONObject jsobj(stream); |
| 19179 // Suppress the fact that the internal vm name for this type is | 19176 // Suppress the fact that the internal vm name for this type is |
| 19180 // "Bool". Return "bool" instead. | 19177 // "Bool". Return "bool" instead. |
| 19181 AddTypeProperties(&jsobj, "bool", "bool", ref); | 19178 AddTypeProperties(&jsobj, "bool", "bool", ref); |
| 19182 PrintSharedInstanceJSON(&jsobj, ref); | 19179 PrintSharedInstanceJSON(&jsobj, ref); |
| 19183 jsobj.AddPropertyF("id", "objects/bool-%s", str); | 19180 jsobj.AddFixedServiceId("objects/bool-%s", str); |
| 19184 jsobj.AddPropertyF("valueAsString", "%s", str); | 19181 jsobj.AddPropertyF("valueAsString", "%s", str); |
| 19185 } | 19182 } |
| 19186 | 19183 |
| 19187 | 19184 |
| 19188 bool Array::CanonicalizeEquals(const Instance& other) const { | 19185 bool Array::CanonicalizeEquals(const Instance& other) const { |
| 19189 if (this->raw() == other.raw()) { | 19186 if (this->raw() == other.raw()) { |
| 19190 // Both handles point to the same raw instance. | 19187 // Both handles point to the same raw instance. |
| 19191 return true; | 19188 return true; |
| 19192 } | 19189 } |
| 19193 | 19190 |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 19285 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); | 19282 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); |
| 19286 OS::SNPrint(chars, len, format, Length()); | 19283 OS::SNPrint(chars, len, format, Length()); |
| 19287 return chars; | 19284 return chars; |
| 19288 } | 19285 } |
| 19289 | 19286 |
| 19290 | 19287 |
| 19291 void Array::PrintJSONImpl(JSONStream* stream, bool ref) const { | 19288 void Array::PrintJSONImpl(JSONStream* stream, bool ref) const { |
| 19292 JSONObject jsobj(stream); | 19289 JSONObject jsobj(stream); |
| 19293 AddTypeProperties(&jsobj, "List", JSONType(), ref); | 19290 AddTypeProperties(&jsobj, "List", JSONType(), ref); |
| 19294 PrintSharedInstanceJSON(&jsobj, ref); | 19291 PrintSharedInstanceJSON(&jsobj, ref); |
| 19295 jsobj.AddServiceId("id", *this); | 19292 jsobj.AddServiceId(*this); |
| 19296 jsobj.AddProperty("length", Length()); | 19293 jsobj.AddProperty("length", Length()); |
| 19297 if (ref) { | 19294 if (ref) { |
| 19298 return; | 19295 return; |
| 19299 } | 19296 } |
| 19300 { | 19297 { |
| 19301 JSONArray jsarr(&jsobj, "elements"); | 19298 JSONArray jsarr(&jsobj, "elements"); |
| 19302 for (intptr_t index = 0; index < Length(); index++) { | 19299 for (intptr_t index = 0; index < Length(); index++) { |
| 19303 JSONObject jselement(&jsarr); | 19300 JSONObject jselement(&jsarr); |
| 19304 jselement.AddProperty("index", index); | 19301 jselement.AddProperty("index", index); |
| 19305 | 19302 |
| (...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 19536 OS::SNPrint(chars, len, format, Length()); | 19533 OS::SNPrint(chars, len, format, Length()); |
| 19537 return chars; | 19534 return chars; |
| 19538 } | 19535 } |
| 19539 | 19536 |
| 19540 | 19537 |
| 19541 void GrowableObjectArray::PrintJSONImpl(JSONStream* stream, | 19538 void GrowableObjectArray::PrintJSONImpl(JSONStream* stream, |
| 19542 bool ref) const { | 19539 bool ref) const { |
| 19543 JSONObject jsobj(stream); | 19540 JSONObject jsobj(stream); |
| 19544 AddTypeProperties(&jsobj, "List", JSONType(), ref); | 19541 AddTypeProperties(&jsobj, "List", JSONType(), ref); |
| 19545 PrintSharedInstanceJSON(&jsobj, ref); | 19542 PrintSharedInstanceJSON(&jsobj, ref); |
| 19546 jsobj.AddServiceId("id", *this); | 19543 jsobj.AddServiceId(*this); |
| 19547 jsobj.AddProperty("length", Length()); | 19544 jsobj.AddProperty("length", Length()); |
| 19548 if (ref) { | 19545 if (ref) { |
| 19549 return; | 19546 return; |
| 19550 } | 19547 } |
| 19551 { | 19548 { |
| 19552 JSONArray jsarr(&jsobj, "elements"); | 19549 JSONArray jsarr(&jsobj, "elements"); |
| 19553 for (intptr_t index = 0; index < Length(); index++) { | 19550 for (intptr_t index = 0; index < Length(); index++) { |
| 19554 JSONObject jselement(&jsarr); | 19551 JSONObject jselement(&jsarr); |
| 19555 jselement.AddProperty("index", index); | 19552 jselement.AddProperty("index", index); |
| 19556 | 19553 |
| (...skipping 1027 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 20584 | 20581 |
| 20585 const char* WeakProperty::ToCString() const { | 20582 const char* WeakProperty::ToCString() const { |
| 20586 return "_WeakProperty"; | 20583 return "_WeakProperty"; |
| 20587 } | 20584 } |
| 20588 | 20585 |
| 20589 | 20586 |
| 20590 void WeakProperty::PrintJSONImpl(JSONStream* stream, bool ref) const { | 20587 void WeakProperty::PrintJSONImpl(JSONStream* stream, bool ref) const { |
| 20591 JSONObject jsobj(stream); | 20588 JSONObject jsobj(stream); |
| 20592 AddTypeProperties(&jsobj, "Instance", JSONType(), ref); | 20589 AddTypeProperties(&jsobj, "Instance", JSONType(), ref); |
| 20593 PrintSharedInstanceJSON(&jsobj, ref); | 20590 PrintSharedInstanceJSON(&jsobj, ref); |
| 20594 jsobj.AddServiceId("id", *this); | 20591 jsobj.AddServiceId(*this); |
| 20595 if (ref) { | 20592 if (ref) { |
| 20596 return; | 20593 return; |
| 20597 } | 20594 } |
| 20598 | 20595 |
| 20599 const Object& key_handle = Object::Handle(key()); | 20596 const Object& key_handle = Object::Handle(key()); |
| 20600 jsobj.AddProperty("key", key_handle); | 20597 jsobj.AddProperty("key", key_handle); |
| 20601 const Object& value_handle = Object::Handle(value()); | 20598 const Object& value_handle = Object::Handle(value()); |
| 20602 jsobj.AddProperty("value", value_handle); | 20599 jsobj.AddProperty("value", value_handle); |
| 20603 } | 20600 } |
| 20604 | 20601 |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 20655 | 20652 |
| 20656 const char* MirrorReference::ToCString() const { | 20653 const char* MirrorReference::ToCString() const { |
| 20657 return "_MirrorReference"; | 20654 return "_MirrorReference"; |
| 20658 } | 20655 } |
| 20659 | 20656 |
| 20660 | 20657 |
| 20661 void MirrorReference::PrintJSONImpl(JSONStream* stream, bool ref) const { | 20658 void MirrorReference::PrintJSONImpl(JSONStream* stream, bool ref) const { |
| 20662 JSONObject jsobj(stream); | 20659 JSONObject jsobj(stream); |
| 20663 AddTypeProperties(&jsobj, "Instance", JSONType(), ref); | 20660 AddTypeProperties(&jsobj, "Instance", JSONType(), ref); |
| 20664 PrintSharedInstanceJSON(&jsobj, ref); | 20661 PrintSharedInstanceJSON(&jsobj, ref); |
| 20665 jsobj.AddServiceId("id", *this); | 20662 jsobj.AddServiceId(*this); |
| 20666 | 20663 |
| 20667 if (ref) { | 20664 if (ref) { |
| 20668 return; | 20665 return; |
| 20669 } | 20666 } |
| 20670 | 20667 |
| 20671 const Object& referent_handle = Object::Handle(referent()); | 20668 const Object& referent_handle = Object::Handle(referent()); |
| 20672 jsobj.AddProperty("referent", referent_handle); | 20669 jsobj.AddProperty("referent", referent_handle); |
| 20673 } | 20670 } |
| 20674 | 20671 |
| 20675 | 20672 |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 20800 return tag_label.ToCString(); | 20797 return tag_label.ToCString(); |
| 20801 } | 20798 } |
| 20802 | 20799 |
| 20803 | 20800 |
| 20804 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const { | 20801 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const { |
| 20805 Instance::PrintJSONImpl(stream, ref); | 20802 Instance::PrintJSONImpl(stream, ref); |
| 20806 } | 20803 } |
| 20807 | 20804 |
| 20808 | 20805 |
| 20809 } // namespace dart | 20806 } // namespace dart |
| OLD | NEW |