| OLD | NEW |
| 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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/debugger.h" | 5 #include "vm/debugger.h" |
| 6 #include "vm/disassembler.h" | 6 #include "vm/disassembler.h" |
| 7 #include "vm/object.h" | 7 #include "vm/object.h" |
| 8 #include "vm/object_store.h" | 8 #include "vm/object_store.h" |
| 9 #include "vm/stub_code.h" | 9 #include "vm/stub_code.h" |
| 10 #include "vm/symbols.h" | 10 #include "vm/symbols.h" |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 JSONObject jsobj(stream); | 80 JSONObject jsobj(stream); |
| 81 if ((raw() == Class::null()) || (id() == kFreeListElement)) { | 81 if ((raw() == Class::null()) || (id() == kFreeListElement)) { |
| 82 // TODO(turnidge): This is weird and needs to be changed. | 82 // TODO(turnidge): This is weird and needs to be changed. |
| 83 jsobj.AddProperty("type", "null"); | 83 jsobj.AddProperty("type", "null"); |
| 84 return; | 84 return; |
| 85 } | 85 } |
| 86 AddCommonObjectProperties(&jsobj, "Class", ref); | 86 AddCommonObjectProperties(&jsobj, "Class", ref); |
| 87 jsobj.AddFixedServiceId("classes/%" Pd "", id()); | 87 jsobj.AddFixedServiceId("classes/%" Pd "", id()); |
| 88 const String& scrubbed_name = String::Handle(ScrubbedName()); | 88 const String& scrubbed_name = String::Handle(ScrubbedName()); |
| 89 const String& vm_name = String::Handle(Name()); | 89 const String& vm_name = String::Handle(Name()); |
| 90 AddNameProperties(&jsobj, | 90 AddNameProperties(&jsobj, scrubbed_name.ToCString(), vm_name.ToCString()); |
| 91 scrubbed_name.ToCString(), | |
| 92 vm_name.ToCString()); | |
| 93 if (ref) { | 91 if (ref) { |
| 94 return; | 92 return; |
| 95 } | 93 } |
| 96 | 94 |
| 97 const Error& err = Error::Handle(EnsureIsFinalized(Thread::Current())); | 95 const Error& err = Error::Handle(EnsureIsFinalized(Thread::Current())); |
| 98 if (!err.IsNull()) { | 96 if (!err.IsNull()) { |
| 99 jsobj.AddProperty("error", err); | 97 jsobj.AddProperty("error", err); |
| 100 } | 98 } |
| 101 jsobj.AddProperty("abstract", is_abstract()); | 99 jsobj.AddProperty("abstract", is_abstract()); |
| 102 jsobj.AddProperty("const", is_const()); | 100 jsobj.AddProperty("const", is_const()); |
| (...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 253 selector = "closures"; | 251 selector = "closures"; |
| 254 } else if (f.IsImplicitClosureFunction()) { | 252 } else if (f.IsImplicitClosureFunction()) { |
| 255 id = cls.FindImplicitClosureFunctionIndex(f); | 253 id = cls.FindImplicitClosureFunctionIndex(f); |
| 256 selector = "implicit_closures"; | 254 selector = "implicit_closures"; |
| 257 } else if (f.IsNoSuchMethodDispatcher() || f.IsInvokeFieldDispatcher()) { | 255 } else if (f.IsNoSuchMethodDispatcher() || f.IsInvokeFieldDispatcher()) { |
| 258 id = cls.FindInvocationDispatcherFunctionIndex(f); | 256 id = cls.FindInvocationDispatcherFunctionIndex(f); |
| 259 selector = "dispatchers"; | 257 selector = "dispatchers"; |
| 260 } | 258 } |
| 261 if (id != -1) { | 259 if (id != -1) { |
| 262 ASSERT(selector != NULL); | 260 ASSERT(selector != NULL); |
| 263 jsobj.AddFixedServiceId("classes/%" Pd "/%s/%" Pd "", | 261 jsobj.AddFixedServiceId("classes/%" Pd "/%s/%" Pd "", cls.id(), selector, |
| 264 cls.id(), selector, id); | 262 id); |
| 265 return; | 263 return; |
| 266 } | 264 } |
| 267 // Regular functions known to their owner use their name (percent-encoded). | 265 // Regular functions known to their owner use their name (percent-encoded). |
| 268 String& name = String::Handle(f.name()); | 266 String& name = String::Handle(f.name()); |
| 269 if (cls.LookupFunction(name) == f.raw()) { | 267 if (cls.LookupFunction(name) == f.raw()) { |
| 270 const char* encoded_name = String::EncodeIRI(name); | 268 const char* encoded_name = String::EncodeIRI(name); |
| 271 jsobj.AddFixedServiceId("classes/%" Pd "/functions/%s", | 269 jsobj.AddFixedServiceId("classes/%" Pd "/functions/%s", cls.id(), |
| 272 cls.id(), encoded_name); | 270 encoded_name); |
| 273 return; | 271 return; |
| 274 } | 272 } |
| 275 // Oddball functions (not known to their owner) fall back to use the object | 273 // Oddball functions (not known to their owner) fall back to use the object |
| 276 // id ring. Current known examples are signature functions of closures | 274 // id ring. Current known examples are signature functions of closures |
| 277 // and stubs like 'megamorphic_miss'. | 275 // and stubs like 'megamorphic_miss'. |
| 278 jsobj.AddServiceId(f); | 276 jsobj.AddServiceId(f); |
| 279 } | 277 } |
| 280 | 278 |
| 281 | 279 |
| 282 void Function::PrintJSONImpl(JSONStream* stream, bool ref) const { | 280 void Function::PrintJSONImpl(JSONStream* stream, bool ref) const { |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 349 Object::PrintJSONImpl(stream, ref); | 347 Object::PrintJSONImpl(stream, ref); |
| 350 } | 348 } |
| 351 | 349 |
| 352 | 350 |
| 353 void Field::PrintJSONImpl(JSONStream* stream, bool ref) const { | 351 void Field::PrintJSONImpl(JSONStream* stream, bool ref) const { |
| 354 JSONObject jsobj(stream); | 352 JSONObject jsobj(stream); |
| 355 Class& cls = Class::Handle(Owner()); | 353 Class& cls = Class::Handle(Owner()); |
| 356 String& field_name = String::Handle(name()); | 354 String& field_name = String::Handle(name()); |
| 357 const char* encoded_field_name = String::EncodeIRI(field_name); | 355 const char* encoded_field_name = String::EncodeIRI(field_name); |
| 358 AddCommonObjectProperties(&jsobj, "Field", ref); | 356 AddCommonObjectProperties(&jsobj, "Field", ref); |
| 359 jsobj.AddFixedServiceId("classes/%" Pd "/fields/%s", | 357 jsobj.AddFixedServiceId("classes/%" Pd "/fields/%s", cls.id(), |
| 360 cls.id(), encoded_field_name); | 358 encoded_field_name); |
| 361 | 359 |
| 362 const String& user_name = String::Handle(UserVisibleName()); | 360 const String& user_name = String::Handle(UserVisibleName()); |
| 363 const String& vm_name = String::Handle(name()); | 361 const String& vm_name = String::Handle(name()); |
| 364 AddNameProperties(&jsobj, user_name.ToCString(), vm_name.ToCString()); | 362 AddNameProperties(&jsobj, user_name.ToCString(), vm_name.ToCString()); |
| 365 if (cls.IsTopLevel()) { | 363 if (cls.IsTopLevel()) { |
| 366 const Library& library = Library::Handle(cls.library()); | 364 const Library& library = Library::Handle(cls.library()); |
| 367 jsobj.AddProperty("owner", library); | 365 jsobj.AddProperty("owner", library); |
| 368 } else { | 366 } else { |
| 369 jsobj.AddProperty("owner", cls); | 367 jsobj.AddProperty("owner", cls); |
| 370 } | 368 } |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 435 JSONObject jsobj(stream); | 433 JSONObject jsobj(stream); |
| 436 AddCommonObjectProperties(&jsobj, "Script", ref); | 434 AddCommonObjectProperties(&jsobj, "Script", ref); |
| 437 const String& uri = String::Handle(url()); | 435 const String& uri = String::Handle(url()); |
| 438 ASSERT(!uri.IsNull()); | 436 ASSERT(!uri.IsNull()); |
| 439 const char* encoded_uri = String::EncodeIRI(uri); | 437 const char* encoded_uri = String::EncodeIRI(uri); |
| 440 const Library& lib = Library::Handle(FindLibrary()); | 438 const Library& lib = Library::Handle(FindLibrary()); |
| 441 if (lib.IsNull()) { | 439 if (lib.IsNull()) { |
| 442 jsobj.AddServiceId(*this); | 440 jsobj.AddServiceId(*this); |
| 443 } else { | 441 } else { |
| 444 jsobj.AddFixedServiceId("libraries/%" Pd "/scripts/%s/%" Px64 "", | 442 jsobj.AddFixedServiceId("libraries/%" Pd "/scripts/%s/%" Px64 "", |
| 445 lib.index(), encoded_uri, | 443 lib.index(), encoded_uri, load_timestamp()); |
| 446 load_timestamp()); | |
| 447 } | 444 } |
| 448 jsobj.AddPropertyStr("uri", uri); | 445 jsobj.AddPropertyStr("uri", uri); |
| 449 jsobj.AddProperty("_kind", GetKindAsCString()); | 446 jsobj.AddProperty("_kind", GetKindAsCString()); |
| 450 if (ref) { | 447 if (ref) { |
| 451 return; | 448 return; |
| 452 } | 449 } |
| 453 jsobj.AddPropertyTimeMillis("_loadTime", load_timestamp()); | 450 jsobj.AddPropertyTimeMillis("_loadTime", load_timestamp()); |
| 454 if (!lib.IsNull()) { | 451 if (!lib.IsNull()) { |
| 455 jsobj.AddProperty("library", lib); | 452 jsobj.AddProperty("library", lib); |
| 456 } | 453 } |
| (...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 649 } | 646 } |
| 650 | 647 |
| 651 { | 648 { |
| 652 JSONArray jsarr(&jsobj, "_entries"); | 649 JSONArray jsarr(&jsobj, "_entries"); |
| 653 uword imm; | 650 uword imm; |
| 654 Object& obj = Object::Handle(); | 651 Object& obj = Object::Handle(); |
| 655 for (intptr_t i = 0; i < Length(); i++) { | 652 for (intptr_t i = 0; i < Length(); i++) { |
| 656 JSONObject jsentry(stream); | 653 JSONObject jsentry(stream); |
| 657 jsentry.AddProperty("offset", OffsetFromIndex(i)); | 654 jsentry.AddProperty("offset", OffsetFromIndex(i)); |
| 658 switch (InfoAt(i)) { | 655 switch (InfoAt(i)) { |
| 659 case ObjectPool::kTaggedObject: | 656 case ObjectPool::kTaggedObject: |
| 660 obj = ObjectAt(i); | 657 obj = ObjectAt(i); |
| 661 jsentry.AddProperty("kind", "Object"); | 658 jsentry.AddProperty("kind", "Object"); |
| 662 jsentry.AddProperty("value", obj); | 659 jsentry.AddProperty("value", obj); |
| 663 break; | 660 break; |
| 664 case ObjectPool::kImmediate: | 661 case ObjectPool::kImmediate: |
| 665 imm = RawValueAt(i); | 662 imm = RawValueAt(i); |
| 666 jsentry.AddProperty("kind", "Immediate"); | 663 jsentry.AddProperty("kind", "Immediate"); |
| 667 jsentry.AddProperty64("value", imm); | 664 jsentry.AddProperty64("value", imm); |
| 668 break; | 665 break; |
| 669 case ObjectPool::kNativeEntry: | 666 case ObjectPool::kNativeEntry: |
| 670 imm = RawValueAt(i); | 667 imm = RawValueAt(i); |
| 671 jsentry.AddProperty("kind", "NativeEntry"); | 668 jsentry.AddProperty("kind", "NativeEntry"); |
| 672 jsentry.AddProperty64("value", imm); | 669 jsentry.AddProperty64("value", imm); |
| 673 break; | 670 break; |
| 674 default: | 671 default: |
| 675 UNREACHABLE(); | 672 UNREACHABLE(); |
| 676 } | 673 } |
| 677 } | 674 } |
| 678 } | 675 } |
| 679 } | 676 } |
| 680 | 677 |
| 681 | 678 |
| 682 void PcDescriptors::PrintToJSONObject(JSONObject* jsobj, bool ref) const { | 679 void PcDescriptors::PrintToJSONObject(JSONObject* jsobj, bool ref) const { |
| 683 AddCommonObjectProperties(jsobj, "Object", ref); | 680 AddCommonObjectProperties(jsobj, "Object", ref); |
| 684 // TODO(johnmccutchan): Generate a stable id. PcDescriptors hang off a Code | 681 // TODO(johnmccutchan): Generate a stable id. PcDescriptors hang off a Code |
| 685 // object but do not have a back reference to generate an ID. | 682 // object but do not have a back reference to generate an ID. |
| (...skipping 24 matching lines...) Expand all Loading... |
| 710 void CodeSourceMap::PrintJSONImpl(JSONStream* stream, bool ref) const { | 707 void CodeSourceMap::PrintJSONImpl(JSONStream* stream, bool ref) const { |
| 711 Object::PrintJSONImpl(stream, ref); | 708 Object::PrintJSONImpl(stream, ref); |
| 712 } | 709 } |
| 713 | 710 |
| 714 | 711 |
| 715 void Stackmap::PrintJSONImpl(JSONStream* stream, bool ref) const { | 712 void Stackmap::PrintJSONImpl(JSONStream* stream, bool ref) const { |
| 716 Object::PrintJSONImpl(stream, ref); | 713 Object::PrintJSONImpl(stream, ref); |
| 717 } | 714 } |
| 718 | 715 |
| 719 | 716 |
| 720 void LocalVarDescriptors::PrintJSONImpl(JSONStream* stream, | 717 void LocalVarDescriptors::PrintJSONImpl(JSONStream* stream, bool ref) const { |
| 721 bool ref) const { | |
| 722 JSONObject jsobj(stream); | 718 JSONObject jsobj(stream); |
| 723 AddCommonObjectProperties(&jsobj, "Object", ref); | 719 AddCommonObjectProperties(&jsobj, "Object", ref); |
| 724 // TODO(johnmccutchan): Generate a stable id. LocalVarDescriptors hang off | 720 // TODO(johnmccutchan): Generate a stable id. LocalVarDescriptors hang off |
| 725 // a Code object but do not have a back reference to generate an ID. | 721 // a Code object but do not have a back reference to generate an ID. |
| 726 jsobj.AddServiceId(*this); | 722 jsobj.AddServiceId(*this); |
| 727 if (ref) { | 723 if (ref) { |
| 728 return; | 724 return; |
| 729 } | 725 } |
| 730 JSONArray members(&jsobj, "members"); | 726 JSONArray members(&jsobj, "members"); |
| 731 String& var_name = String::Handle(); | 727 String& var_name = String::Handle(); |
| 732 for (intptr_t i = 0; i < Length(); i++) { | 728 for (intptr_t i = 0; i < Length(); i++) { |
| 733 RawLocalVarDescriptors::VarInfo info; | 729 RawLocalVarDescriptors::VarInfo info; |
| 734 var_name = GetName(i); | 730 var_name = GetName(i); |
| 735 GetInfo(i, &info); | 731 GetInfo(i, &info); |
| 736 JSONObject var(&members); | 732 JSONObject var(&members); |
| 737 var.AddProperty("name", var_name.ToCString()); | 733 var.AddProperty("name", var_name.ToCString()); |
| 738 var.AddProperty("index", static_cast<intptr_t>(info.index())); | 734 var.AddProperty("index", static_cast<intptr_t>(info.index())); |
| 739 var.AddProperty("declarationTokenPos", info.declaration_pos); | 735 var.AddProperty("declarationTokenPos", info.declaration_pos); |
| 740 var.AddProperty("scopeStartTokenPos", info.begin_pos); | 736 var.AddProperty("scopeStartTokenPos", info.begin_pos); |
| 741 var.AddProperty("scopeEndTokenPos", info.end_pos); | 737 var.AddProperty("scopeEndTokenPos", info.end_pos); |
| 742 var.AddProperty("scopeId", static_cast<intptr_t>(info.scope_id)); | 738 var.AddProperty("scopeId", static_cast<intptr_t>(info.scope_id)); |
| 743 var.AddProperty("kind", KindToCString(info.kind())); | 739 var.AddProperty("kind", KindToCString(info.kind())); |
| 744 } | 740 } |
| 745 } | 741 } |
| 746 | 742 |
| 747 | 743 |
| 748 void ExceptionHandlers::PrintJSONImpl(JSONStream* stream, | 744 void ExceptionHandlers::PrintJSONImpl(JSONStream* stream, bool ref) const { |
| 749 bool ref) const { | |
| 750 Object::PrintJSONImpl(stream, ref); | 745 Object::PrintJSONImpl(stream, ref); |
| 751 } | 746 } |
| 752 | 747 |
| 753 | 748 |
| 754 void SingleTargetCache::PrintJSONImpl(JSONStream* stream, bool ref) const { | 749 void SingleTargetCache::PrintJSONImpl(JSONStream* stream, bool ref) const { |
| 755 Object::PrintJSONImpl(stream, ref); | 750 Object::PrintJSONImpl(stream, ref); |
| 756 } | 751 } |
| 757 | 752 |
| 758 | 753 |
| 759 void UnlinkedCall::PrintJSONImpl(JSONStream* stream, bool ref) const { | 754 void UnlinkedCall::PrintJSONImpl(JSONStream* stream, bool ref) const { |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 800 } | 795 } |
| 801 cache_entry.AddProperty("target", func); | 796 cache_entry.AddProperty("target", func); |
| 802 cache_entry.AddProperty("count", count); | 797 cache_entry.AddProperty("count", count); |
| 803 } | 798 } |
| 804 } | 799 } |
| 805 | 800 |
| 806 | 801 |
| 807 void Code::PrintJSONImpl(JSONStream* stream, bool ref) const { | 802 void Code::PrintJSONImpl(JSONStream* stream, bool ref) const { |
| 808 JSONObject jsobj(stream); | 803 JSONObject jsobj(stream); |
| 809 AddCommonObjectProperties(&jsobj, "Code", ref); | 804 AddCommonObjectProperties(&jsobj, "Code", ref); |
| 810 jsobj.AddFixedServiceId("code/%" Px64"-%" Px "", | 805 jsobj.AddFixedServiceId("code/%" Px64 "-%" Px "", compile_timestamp(), |
| 811 compile_timestamp(), | |
| 812 PayloadStart()); | 806 PayloadStart()); |
| 813 const char* qualified_name = QualifiedName(); | 807 const char* qualified_name = QualifiedName(); |
| 814 const char* vm_name = Name(); | 808 const char* vm_name = Name(); |
| 815 AddNameProperties(&jsobj, qualified_name, vm_name); | 809 AddNameProperties(&jsobj, qualified_name, vm_name); |
| 816 const bool is_stub = IsStubCode() || IsAllocationStubCode(); | 810 const bool is_stub = IsStubCode() || IsAllocationStubCode(); |
| 817 if (is_stub) { | 811 if (is_stub) { |
| 818 jsobj.AddProperty("kind", "Stub"); | 812 jsobj.AddProperty("kind", "Stub"); |
| 819 } else { | 813 } else { |
| 820 jsobj.AddProperty("kind", "Dart"); | 814 jsobj.AddProperty("kind", "Dart"); |
| 821 } | 815 } |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 974 | 968 |
| 975 void LanguageError::PrintJSONImpl(JSONStream* stream, bool ref) const { | 969 void LanguageError::PrintJSONImpl(JSONStream* stream, bool ref) const { |
| 976 JSONObject jsobj(stream); | 970 JSONObject jsobj(stream); |
| 977 AddCommonObjectProperties(&jsobj, "Error", ref); | 971 AddCommonObjectProperties(&jsobj, "Error", ref); |
| 978 jsobj.AddProperty("kind", "LanguageError"); | 972 jsobj.AddProperty("kind", "LanguageError"); |
| 979 jsobj.AddServiceId(*this); | 973 jsobj.AddServiceId(*this); |
| 980 jsobj.AddProperty("message", ToErrorCString()); | 974 jsobj.AddProperty("message", ToErrorCString()); |
| 981 } | 975 } |
| 982 | 976 |
| 983 | 977 |
| 984 void UnhandledException::PrintJSONImpl(JSONStream* stream, | 978 void UnhandledException::PrintJSONImpl(JSONStream* stream, bool ref) const { |
| 985 bool ref) const { | |
| 986 JSONObject jsobj(stream); | 979 JSONObject jsobj(stream); |
| 987 AddCommonObjectProperties(&jsobj, "Error", ref); | 980 AddCommonObjectProperties(&jsobj, "Error", ref); |
| 988 jsobj.AddProperty("kind", "UnhandledException"); | 981 jsobj.AddProperty("kind", "UnhandledException"); |
| 989 jsobj.AddServiceId(*this); | 982 jsobj.AddServiceId(*this); |
| 990 jsobj.AddProperty("message", ToErrorCString()); | 983 jsobj.AddProperty("message", ToErrorCString()); |
| 991 if (ref) { | 984 if (ref) { |
| 992 return; | 985 return; |
| 993 } | 986 } |
| 994 Instance& instance = Instance::Handle(); | 987 Instance& instance = Instance::Handle(); |
| 995 instance = exception(); | 988 instance = exception(); |
| 996 jsobj.AddProperty("exception", instance); | 989 jsobj.AddProperty("exception", instance); |
| 997 instance = stacktrace(); | 990 instance = stacktrace(); |
| 998 jsobj.AddProperty("stacktrace", instance); | 991 jsobj.AddProperty("stacktrace", instance); |
| 999 } | 992 } |
| 1000 | 993 |
| 1001 | 994 |
| 1002 void UnwindError::PrintJSONImpl(JSONStream* stream, bool ref) const { | 995 void UnwindError::PrintJSONImpl(JSONStream* stream, bool ref) const { |
| 1003 JSONObject jsobj(stream); | 996 JSONObject jsobj(stream); |
| 1004 AddCommonObjectProperties(&jsobj, "Error", ref); | 997 AddCommonObjectProperties(&jsobj, "Error", ref); |
| 1005 jsobj.AddProperty("kind", "TerminationError"); | 998 jsobj.AddProperty("kind", "TerminationError"); |
| 1006 jsobj.AddServiceId(*this); | 999 jsobj.AddServiceId(*this); |
| 1007 jsobj.AddProperty("message", ToErrorCString()); | 1000 jsobj.AddProperty("message", ToErrorCString()); |
| 1008 jsobj.AddProperty("_is_user_initiated", is_user_initiated()); | 1001 jsobj.AddProperty("_is_user_initiated", is_user_initiated()); |
| 1009 jsobj.AddProperty("_is_vm_restart", is_vm_restart()); | 1002 jsobj.AddProperty("_is_vm_restart", is_vm_restart()); |
| 1010 } | 1003 } |
| 1011 | 1004 |
| 1012 | 1005 |
| 1013 void Instance::PrintSharedInstanceJSON(JSONObject* jsobj, | 1006 void Instance::PrintSharedInstanceJSON(JSONObject* jsobj, bool ref) const { |
| 1014 bool ref) const { | |
| 1015 AddCommonObjectProperties(jsobj, "Instance", ref); | 1007 AddCommonObjectProperties(jsobj, "Instance", ref); |
| 1016 if (ref) { | 1008 if (ref) { |
| 1017 return; | 1009 return; |
| 1018 } | 1010 } |
| 1019 | 1011 |
| 1020 // Add all fields in layout order, from superclass to subclass. | 1012 // Add all fields in layout order, from superclass to subclass. |
| 1021 GrowableArray<Class*> classes; | 1013 GrowableArray<Class*> classes; |
| 1022 Class& cls = Class::Handle(this->clazz()); | 1014 Class& cls = Class::Handle(this->clazz()); |
| 1023 do { | 1015 do { |
| 1024 classes.Add(&Class::Handle(cls.raw())); | 1016 classes.Add(&Class::Handle(cls.raw())); |
| (...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1304 JSONArray jsarr(&jsobj, "elements"); | 1296 JSONArray jsarr(&jsobj, "elements"); |
| 1305 Object& element = Object::Handle(); | 1297 Object& element = Object::Handle(); |
| 1306 for (intptr_t index = offset; index < limit; index++) { | 1298 for (intptr_t index = offset; index < limit; index++) { |
| 1307 element = At(index); | 1299 element = At(index); |
| 1308 jsarr.AddValue(element); | 1300 jsarr.AddValue(element); |
| 1309 } | 1301 } |
| 1310 } | 1302 } |
| 1311 } | 1303 } |
| 1312 | 1304 |
| 1313 | 1305 |
| 1314 void GrowableObjectArray::PrintJSONImpl(JSONStream* stream, | 1306 void GrowableObjectArray::PrintJSONImpl(JSONStream* stream, bool ref) const { |
| 1315 bool ref) const { | |
| 1316 JSONObject jsobj(stream); | 1307 JSONObject jsobj(stream); |
| 1317 PrintSharedInstanceJSON(&jsobj, ref); | 1308 PrintSharedInstanceJSON(&jsobj, ref); |
| 1318 jsobj.AddProperty("kind", "List"); | 1309 jsobj.AddProperty("kind", "List"); |
| 1319 jsobj.AddServiceId(*this); | 1310 jsobj.AddServiceId(*this); |
| 1320 jsobj.AddProperty("length", Length()); | 1311 jsobj.AddProperty("length", Length()); |
| 1321 if (ref) { | 1312 if (ref) { |
| 1322 return; | 1313 return; |
| 1323 } | 1314 } |
| 1324 intptr_t offset; | 1315 intptr_t offset; |
| 1325 intptr_t count; | 1316 intptr_t count; |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1426 if (offset > 0) { | 1417 if (offset > 0) { |
| 1427 jsobj.AddProperty("offset", offset); | 1418 jsobj.AddProperty("offset", offset); |
| 1428 } | 1419 } |
| 1429 if (count < Length()) { | 1420 if (count < Length()) { |
| 1430 jsobj.AddProperty("count", count); | 1421 jsobj.AddProperty("count", count); |
| 1431 } | 1422 } |
| 1432 if (count == 0) { | 1423 if (count == 0) { |
| 1433 jsobj.AddProperty("bytes", ""); | 1424 jsobj.AddProperty("bytes", ""); |
| 1434 } else { | 1425 } else { |
| 1435 NoSafepointScope no_safepoint; | 1426 NoSafepointScope no_safepoint; |
| 1436 jsobj.AddPropertyBase64("bytes", | 1427 jsobj.AddPropertyBase64("bytes", reinterpret_cast<const uint8_t*>(DataAddr( |
| 1437 reinterpret_cast<const uint8_t*>( | 1428 offset * ElementSizeInBytes())), |
| 1438 DataAddr(offset * ElementSizeInBytes())), | |
| 1439 count * ElementSizeInBytes()); | 1429 count * ElementSizeInBytes()); |
| 1440 } | 1430 } |
| 1441 } | 1431 } |
| 1442 | 1432 |
| 1443 | 1433 |
| 1444 void ExternalTypedData::PrintJSONImpl(JSONStream* stream, | 1434 void ExternalTypedData::PrintJSONImpl(JSONStream* stream, bool ref) const { |
| 1445 bool ref) const { | |
| 1446 JSONObject jsobj(stream); | 1435 JSONObject jsobj(stream); |
| 1447 PrintSharedInstanceJSON(&jsobj, ref); | 1436 PrintSharedInstanceJSON(&jsobj, ref); |
| 1448 const Class& cls = Class::Handle(clazz()); | 1437 const Class& cls = Class::Handle(clazz()); |
| 1449 const String& kind = String::Handle(cls.UserVisibleName()); | 1438 const String& kind = String::Handle(cls.UserVisibleName()); |
| 1450 jsobj.AddProperty("kind", kind.ToCString()); | 1439 jsobj.AddProperty("kind", kind.ToCString()); |
| 1451 jsobj.AddServiceId(*this); | 1440 jsobj.AddServiceId(*this); |
| 1452 jsobj.AddProperty("length", Length()); | 1441 jsobj.AddProperty("length", Length()); |
| 1453 if (ref) { | 1442 if (ref) { |
| 1454 return; | 1443 return; |
| 1455 } | 1444 } |
| 1456 intptr_t offset; | 1445 intptr_t offset; |
| 1457 intptr_t count; | 1446 intptr_t count; |
| 1458 stream->ComputeOffsetAndCount(Length(), &offset, &count); | 1447 stream->ComputeOffsetAndCount(Length(), &offset, &count); |
| 1459 if (offset > 0) { | 1448 if (offset > 0) { |
| 1460 jsobj.AddProperty("offset", offset); | 1449 jsobj.AddProperty("offset", offset); |
| 1461 } | 1450 } |
| 1462 if (count < Length()) { | 1451 if (count < Length()) { |
| 1463 jsobj.AddProperty("count", count); | 1452 jsobj.AddProperty("count", count); |
| 1464 } | 1453 } |
| 1465 if (count == 0) { | 1454 if (count == 0) { |
| 1466 jsobj.AddProperty("bytes", ""); | 1455 jsobj.AddProperty("bytes", ""); |
| 1467 } else { | 1456 } else { |
| 1468 NoSafepointScope no_safepoint; | 1457 NoSafepointScope no_safepoint; |
| 1469 jsobj.AddPropertyBase64("bytes", | 1458 jsobj.AddPropertyBase64("bytes", reinterpret_cast<const uint8_t*>(DataAddr( |
| 1470 reinterpret_cast<const uint8_t*>( | 1459 offset * ElementSizeInBytes())), |
| 1471 DataAddr(offset * ElementSizeInBytes())), | |
| 1472 count * ElementSizeInBytes()); | 1460 count * ElementSizeInBytes()); |
| 1473 } | 1461 } |
| 1474 } | 1462 } |
| 1475 | 1463 |
| 1476 | 1464 |
| 1477 void Capability::PrintJSONImpl(JSONStream* stream, bool ref) const { | 1465 void Capability::PrintJSONImpl(JSONStream* stream, bool ref) const { |
| 1478 Instance::PrintJSONImpl(stream, ref); | 1466 Instance::PrintJSONImpl(stream, ref); |
| 1479 } | 1467 } |
| 1480 | 1468 |
| 1481 | 1469 |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1572 jsobj.AddProperty("mirrorReferent", referent_handle); | 1560 jsobj.AddProperty("mirrorReferent", referent_handle); |
| 1573 } | 1561 } |
| 1574 | 1562 |
| 1575 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const { | 1563 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const { |
| 1576 Instance::PrintJSONImpl(stream, ref); | 1564 Instance::PrintJSONImpl(stream, ref); |
| 1577 } | 1565 } |
| 1578 | 1566 |
| 1579 #endif | 1567 #endif |
| 1580 | 1568 |
| 1581 } // namespace dart | 1569 } // namespace dart |
| OLD | NEW |