Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(201)

Side by Side Diff: runtime/vm/object.cc

Issue 100103011: Changes to support dprof and Observatory profiler UIs (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 1800 matching lines...) Expand 10 before | Expand all | Expand 10 after
1811 intptr_t Class::FindFunctionIndex(const Function& needle) const { 1811 intptr_t Class::FindFunctionIndex(const Function& needle) const {
1812 Isolate* isolate = Isolate::Current(); 1812 Isolate* isolate = Isolate::Current();
1813 if (EnsureIsFinalized(isolate) != Error::null()) { 1813 if (EnsureIsFinalized(isolate) != Error::null()) {
1814 return -1; 1814 return -1;
1815 } 1815 }
1816 ReusableHandleScope reused_handles(isolate); 1816 ReusableHandleScope reused_handles(isolate);
1817 Array& funcs = reused_handles.ArrayHandle(); 1817 Array& funcs = reused_handles.ArrayHandle();
1818 funcs ^= functions(); 1818 funcs ^= functions();
1819 ASSERT(!funcs.IsNull()); 1819 ASSERT(!funcs.IsNull());
1820 Function& function = reused_handles.FunctionHandle(); 1820 Function& function = reused_handles.FunctionHandle();
1821 String& function_name = reused_handles.StringHandle();
1822 String& needle_name = String::Handle(isolate);
1823 needle_name ^= needle.name();
1824 const intptr_t len = funcs.Length(); 1821 const intptr_t len = funcs.Length();
1825 for (intptr_t i = 0; i < len; i++) { 1822 for (intptr_t i = 0; i < len; i++) {
1826 function ^= funcs.At(i); 1823 function ^= funcs.At(i);
1827 function_name ^= function.name(); 1824 if (function.raw() == needle.raw()) {
1828 if (function_name.Equals(needle_name)) {
1829 return i; 1825 return i;
1830 } 1826 }
1831 } 1827 }
1832 // No function found. 1828 // No function found.
1829 return -1;
1830 }
1831
1832
1833
1834 intptr_t Class::FindImplicitClosureFunctionIndex(const Function& needle) const {
1835 Isolate* isolate = Isolate::Current();
1836 if (EnsureIsFinalized(isolate) != Error::null()) {
1837 return -1;
1838 }
1839 ReusableHandleScope reused_handles(isolate);
1840 Array& funcs = reused_handles.ArrayHandle();
1841 funcs ^= functions();
1842 ASSERT(!funcs.IsNull());
1843 Function& function = reused_handles.FunctionHandle();
1844 Function& implicit_closure = Function::Handle();
1845 const intptr_t len = funcs.Length();
1846 for (intptr_t i = 0; i < len; i++) {
1847 function ^= funcs.At(i);
1848 implicit_closure ^= function.implicit_closure_function();
1849 if (implicit_closure.IsNull()) {
1850 // Skip non-implicit closure functions.
1851 continue;
1852 }
1853 if (needle.raw() == implicit_closure.raw()) {
1854 return i;
1855 }
1856 }
1857 // No function found.
1858 return -1;
1859 }
1860
1861
1862
1863 intptr_t Class::FindInvocationDispatcherFunctionIndex(
1864 const Function& needle) const {
1865 Isolate* isolate = Isolate::Current();
1866 if (EnsureIsFinalized(isolate) != Error::null()) {
1867 return -1;
1868 }
1869 ReusableHandleScope reused_handles(isolate);
1870 Array& funcs = reused_handles.ArrayHandle();
1871 funcs ^= invocation_dispatcher_cache();
1872 ASSERT(!funcs.IsNull());
1873 Object& object = reused_handles.ObjectHandle();
1874 const intptr_t len = funcs.Length();
1875 for (intptr_t i = 0; i < len; i++) {
1876 object = funcs.At(i);
1877 // The invocation_dispatcher_cache is a table with some entries that
1878 // are functions.
1879 if (object.IsFunction()) {
1880 if (Function::Cast(object).raw() == needle.raw()) {
1881 return i;
1882 }
1883 }
1884 }
1885 // No function found.
1833 return -1; 1886 return -1;
1834 } 1887 }
1835 1888
1836 1889
1890
1891 RawFunction* Class::InvocationDispatcherFunctionFromIndex(intptr_t idx) const {
1892 ReusableHandleScope reused_handles(Isolate::Current());
1893 Array& dispatcher_cache = reused_handles.ArrayHandle();
1894 dispatcher_cache ^= invocation_dispatcher_cache();
1895 Object& object = reused_handles.ObjectHandle();
1896 object = dispatcher_cache.At(idx);
1897 if (!object.IsFunction()) {
1898 return Function::null();
1899 }
1900 return Function::Cast(object).raw();
1901 }
1902
1903
1837 void Class::AddClosureFunction(const Function& function) const { 1904 void Class::AddClosureFunction(const Function& function) const {
1838 GrowableObjectArray& closures = 1905 GrowableObjectArray& closures =
1839 GrowableObjectArray::Handle(raw_ptr()->closure_functions_); 1906 GrowableObjectArray::Handle(raw_ptr()->closure_functions_);
1840 if (closures.IsNull()) { 1907 if (closures.IsNull()) {
1841 closures = GrowableObjectArray::New(4); 1908 closures = GrowableObjectArray::New(4);
1842 StorePointer(&raw_ptr()->closure_functions_, closures.raw()); 1909 StorePointer(&raw_ptr()->closure_functions_, closures.raw());
1843 } 1910 }
1844 ASSERT(function.IsNonImplicitClosureFunction()); 1911 ASSERT(function.IsNonImplicitClosureFunction());
1845 closures.Add(function); 1912 closures.Add(function);
1846 } 1913 }
(...skipping 20 matching lines...) Expand all
1867 best_fit_token_pos = closure.token_pos(); 1934 best_fit_token_pos = closure.token_pos();
1868 } 1935 }
1869 } 1936 }
1870 closure = Function::null(); 1937 closure = Function::null();
1871 if (best_fit_index >= 0) { 1938 if (best_fit_index >= 0) {
1872 closure ^= closures.At(best_fit_index); 1939 closure ^= closures.At(best_fit_index);
1873 } 1940 }
1874 return closure.raw(); 1941 return closure.raw();
1875 } 1942 }
1876 1943
1877 intptr_t Class::FindClosureIndex(intptr_t token_pos) const { 1944 intptr_t Class::FindClosureIndex(const Function& needle) const {
1878 if (closures() == GrowableObjectArray::null()) { 1945 if (closures() == GrowableObjectArray::null()) {
1879 return -1; 1946 return -1;
1880 } 1947 }
1881 Isolate* isolate = Isolate::Current(); 1948 Isolate* isolate = Isolate::Current();
1882 ReusableHandleScope reused_handles(isolate); 1949 ReusableHandleScope reused_handles(isolate);
1883 const GrowableObjectArray& closures_array = 1950 const GrowableObjectArray& closures_array =
1884 GrowableObjectArray::Handle(isolate, closures()); 1951 GrowableObjectArray::Handle(isolate, closures());
1885 Function& closure = reused_handles.FunctionHandle(); 1952 Function& closure = reused_handles.FunctionHandle();
1886 intptr_t num_closures = closures_array.Length(); 1953 intptr_t num_closures = closures_array.Length();
1887 intptr_t best_fit_token_pos = -1;
1888 intptr_t best_fit_index = -1;
1889 for (intptr_t i = 0; i < num_closures; i++) { 1954 for (intptr_t i = 0; i < num_closures; i++) {
1890 closure ^= closures_array.At(i); 1955 closure ^= closures_array.At(i);
1891 ASSERT(!closure.IsNull()); 1956 ASSERT(!closure.IsNull());
1892 if ((closure.token_pos() <= token_pos) && 1957 if (closure.raw() == needle.raw()) {
1893 (token_pos <= closure.end_token_pos()) && 1958 return i;
1894 (best_fit_token_pos < closure.token_pos())) {
1895 best_fit_index = i;
1896 best_fit_token_pos = closure.token_pos();
1897 } 1959 }
1898 } 1960 }
1899 return best_fit_index; 1961 return -1;
1900 } 1962 }
1901 1963
1902 1964
1903 void Class::set_signature_function(const Function& value) const { 1965 void Class::set_signature_function(const Function& value) const {
1904 ASSERT(value.IsClosureFunction() || value.IsSignatureFunction()); 1966 ASSERT(value.IsClosureFunction() || value.IsSignatureFunction());
1905 StorePointer(&raw_ptr()->signature_function_, value.raw()); 1967 StorePointer(&raw_ptr()->signature_function_, value.raw());
1906 } 1968 }
1907 1969
1908 1970
1909 void Class::set_state_bits(intptr_t bits) const { 1971 void Class::set_state_bits(intptr_t bits) const {
(...skipping 2534 matching lines...) Expand 10 before | Expand all | Expand 10 after
4444 4506
4445 4507
4446 RawType* Function::RedirectionType() const { 4508 RawType* Function::RedirectionType() const {
4447 ASSERT(IsRedirectingFactory()); 4509 ASSERT(IsRedirectingFactory());
4448 const Object& obj = Object::Handle(raw_ptr()->data_); 4510 const Object& obj = Object::Handle(raw_ptr()->data_);
4449 ASSERT(!obj.IsNull()); 4511 ASSERT(!obj.IsNull());
4450 return RedirectionData::Cast(obj).type(); 4512 return RedirectionData::Cast(obj).type();
4451 } 4513 }
4452 4514
4453 4515
4516 const char* Function::KindToCString(RawFunction::Kind kind) {
4517 switch (kind) {
4518 case RawFunction::kRegularFunction:
4519 return "kRegularFunction";
4520 break;
4521 case RawFunction::kClosureFunction:
4522 return "kClosureFunction";
4523 break;
4524 case RawFunction::kSignatureFunction:
4525 return "kSignatureFunction";
4526 break;
4527 case RawFunction::kGetterFunction:
4528 return "kGetterFunction";
4529 break;
4530 case RawFunction::kSetterFunction:
4531 return "kSetterFunction";
4532 break;
4533 case RawFunction::kConstructor:
4534 return "kConstructor";
4535 break;
4536 case RawFunction::kImplicitGetter:
4537 return "kImplicitGetter";
4538 break;
4539 case RawFunction::kImplicitSetter:
4540 return "kImplicitSetter";
4541 break;
4542 case RawFunction::kImplicitStaticFinalGetter:
4543 return "kImplicitStaticFinalGetter";
4544 break;
4545 case RawFunction::kStaticInitializer:
4546 return "kStaticInitializer";
4547 break;
4548 case RawFunction::kMethodExtractor:
4549 return "kMethodExtractor";
4550 break;
4551 case RawFunction::kNoSuchMethodDispatcher:
4552 return "kNoSuchMethodDispatcher";
4553 break;
4554 case RawFunction::kInvokeFieldDispatcher:
4555 return "kInvokeFieldDispatcher";
4556 break;
4557 default:
4558 UNREACHABLE();
4559 return NULL;
4560 }
4561 }
4562
4563
4454 void Function::SetRedirectionType(const Type& type) const { 4564 void Function::SetRedirectionType(const Type& type) const {
4455 ASSERT(IsFactory()); 4565 ASSERT(IsFactory());
4456 Object& obj = Object::Handle(raw_ptr()->data_); 4566 Object& obj = Object::Handle(raw_ptr()->data_);
4457 if (obj.IsNull()) { 4567 if (obj.IsNull()) {
4458 obj = RedirectionData::New(); 4568 obj = RedirectionData::New();
4459 set_data(obj); 4569 set_data(obj);
4460 } 4570 }
4461 RedirectionData::Cast(obj).set_type(type); 4571 RedirectionData::Cast(obj).set_type(type);
4462 } 4572 }
4463 4573
(...skipping 1240 matching lines...) Expand 10 before | Expand all | Expand 10 after
5704 static_str, abstract_str, kind_str, const_str); 5814 static_str, abstract_str, kind_str, const_str);
5705 return chars; 5815 return chars;
5706 } 5816 }
5707 5817
5708 5818
5709 void Function::PrintToJSONStream(JSONStream* stream, bool ref) const { 5819 void Function::PrintToJSONStream(JSONStream* stream, bool ref) const {
5710 const char* internal_function_name = String::Handle(name()).ToCString(); 5820 const char* internal_function_name = String::Handle(name()).ToCString();
5711 const char* function_name = 5821 const char* function_name =
5712 String::Handle(QualifiedUserVisibleName()).ToCString(); 5822 String::Handle(QualifiedUserVisibleName()).ToCString();
5713 Class& cls = Class::Handle(Owner()); 5823 Class& cls = Class::Handle(Owner());
5824 ASSERT(!cls.IsNull());
5714 Error& err = Error::Handle(); 5825 Error& err = Error::Handle();
5715 err ^= cls.EnsureIsFinalized(Isolate::Current()); 5826 err ^= cls.EnsureIsFinalized(Isolate::Current());
5716 ASSERT(err.IsNull()); 5827 ASSERT(err.IsNull());
5717 const Function& func = *this; 5828 intptr_t id = -1;
5718 intptr_t id;
5719 if (IsNonImplicitClosureFunction()) { 5829 if (IsNonImplicitClosureFunction()) {
Ivan Posva 2014/01/03 01:52:17 Please consolidate this lookup with the one below.
Cutch 2014/01/03 16:01:56 Done.
5720 id = cls.FindClosureIndex(token_pos()); 5830 id = cls.FindClosureIndex(*this);
5831 } else if (IsImplicitClosureFunction()) {
5832 id = cls.FindImplicitClosureFunctionIndex(*this);
5833 } else if (IsNoSuchMethodDispatcher() || IsInvokeFieldDispatcher()) {
5834 id = cls.FindInvocationDispatcherFunctionIndex(*this);
5721 } else { 5835 } else {
5722 id = cls.FindFunctionIndex(func); 5836 id = cls.FindFunctionIndex(*this);
5723 } 5837 }
5838 const char* kind_string = Function::KindToCString(kind());
5724 ASSERT(id >= 0); 5839 ASSERT(id >= 0);
5725 intptr_t cid = cls.id(); 5840 intptr_t cid = cls.id();
5726 JSONObject jsobj(stream); 5841 JSONObject jsobj(stream);
5727 jsobj.AddProperty("type", JSONType(ref)); 5842 jsobj.AddProperty("type", JSONType(ref));
5728 if (IsNonImplicitClosureFunction()) { 5843 if (IsNonImplicitClosureFunction()) {
5729 jsobj.AddPropertyF("id", "classes/%" Pd "/closures/%" Pd "", cid, id); 5844 jsobj.AddPropertyF("id", "classes/%" Pd "/closures/%" Pd "", cid, id);
5845 } else if (IsImplicitClosureFunction()) {
5846 jsobj.AddPropertyF("id", "classes/%" Pd "/implicit_closures/%" Pd "",
5847 cid, id);
5848 } else if (IsNoSuchMethodDispatcher() || IsInvokeFieldDispatcher()) {
5849 jsobj.AddPropertyF("id", "classes/%" Pd "/dispatchers/%" Pd "", cid, id);
5730 } else { 5850 } else {
5731 jsobj.AddPropertyF("id", "classes/%" Pd "/functions/%" Pd "", cid, id); 5851 jsobj.AddPropertyF("id", "classes/%" Pd "/functions/%" Pd "", cid, id);
5732 } 5852 }
5733 jsobj.AddProperty("name", internal_function_name); 5853 jsobj.AddProperty("name", internal_function_name);
5734 jsobj.AddProperty("user_name", function_name); 5854 jsobj.AddProperty("user_name", function_name);
5735 if (ref) return; 5855 if (ref) return;
5736 jsobj.AddProperty("is_static", is_static()); 5856 jsobj.AddProperty("is_static", is_static());
5737 jsobj.AddProperty("is_const", is_const()); 5857 jsobj.AddProperty("is_const", is_const());
5738 jsobj.AddProperty("is_optimizable", is_optimizable()); 5858 jsobj.AddProperty("is_optimizable", is_optimizable());
5739 jsobj.AddProperty("is_inlinable", IsInlineable()); 5859 jsobj.AddProperty("is_inlinable", IsInlineable());
5740 const char* kind_string = NULL; 5860
5741 switch (kind()) {
5742 case RawFunction::kRegularFunction:
5743 kind_string = "regular";
5744 break;
5745 case RawFunction::kGetterFunction:
5746 kind_string = "getter";
5747 break;
5748 case RawFunction::kSetterFunction:
5749 kind_string = "setter";
5750 break;
5751 case RawFunction::kImplicitGetter:
5752 kind_string = "implicit getter";
5753 break;
5754 case RawFunction::kImplicitSetter:
5755 kind_string = "implicit setter";
5756 break;
5757 case RawFunction::kMethodExtractor:
5758 kind_string = "method extractor";
5759 break;
5760 case RawFunction::kNoSuchMethodDispatcher:
5761 kind_string = "no such method";
5762 break;
5763 case RawFunction::kClosureFunction:
5764 kind_string = "closure";
5765 break;
5766 case RawFunction::kConstructor:
5767 kind_string = "constructor";
5768 break;
5769 case RawFunction::kStaticInitializer:
5770 kind_string = "static initializer";
5771 break;
5772 case RawFunction::kImplicitStaticFinalGetter:
5773 kind_string = "static final getter";
5774 break;
5775 default:
5776 UNREACHABLE();
5777 }
5778 jsobj.AddProperty("kind", kind_string); 5861 jsobj.AddProperty("kind", kind_string);
5779 jsobj.AddProperty("unoptimized_code", Object::Handle(unoptimized_code())); 5862 jsobj.AddProperty("unoptimized_code", Object::Handle(unoptimized_code()));
5780 jsobj.AddProperty("usage_counter", usage_counter()); 5863 jsobj.AddProperty("usage_counter", usage_counter());
5781 jsobj.AddProperty("optimized_call_site_count", optimized_call_site_count()); 5864 jsobj.AddProperty("optimized_call_site_count", optimized_call_site_count());
5782 jsobj.AddProperty("code", Object::Handle(CurrentCode())); 5865 jsobj.AddProperty("code", Object::Handle(CurrentCode()));
5783 jsobj.AddProperty("deoptimizations", 5866 jsobj.AddProperty("deoptimizations",
5784 static_cast<intptr_t>(deoptimization_counter())); 5867 static_cast<intptr_t>(deoptimization_counter()));
5785 } 5868 }
5786 5869
5787 5870
(...skipping 3897 matching lines...) Expand 10 before | Expand all | Expand 10 after
9685 ASSERT(i >= 0); 9768 ASSERT(i >= 0);
9686 const Array& array = 9769 const Array& array =
9687 Array::Handle(raw_ptr()->static_calls_target_table_); 9770 Array::Handle(raw_ptr()->static_calls_target_table_);
9688 ASSERT(code.IsNull() || 9771 ASSERT(code.IsNull() ||
9689 (code.function() == array.At(i + kSCallTableFunctionEntry))); 9772 (code.function() == array.At(i + kSCallTableFunctionEntry)));
9690 array.SetAt(i + kSCallTableCodeEntry, code); 9773 array.SetAt(i + kSCallTableCodeEntry, code);
9691 } 9774 }
9692 9775
9693 9776
9694 void Code::Disassemble() const { 9777 void Code::Disassemble() const {
9778 const bool fix_patch = CodePatcher::CodeIsPatchable(*this) &&
9779 CodePatcher::IsEntryPatched(*this);
9780 if (fix_patch) {
9781 // The disassembler may choke on illegal instructions if the code has been
9782 // patched, un-patch the code before disassembling and re-patch after.
9783 CodePatcher::RestoreEntry(*this);
9784 }
9695 const Instructions& instr = Instructions::Handle(instructions()); 9785 const Instructions& instr = Instructions::Handle(instructions());
9696 uword start = instr.EntryPoint(); 9786 uword start = instr.EntryPoint();
9697 Disassembler::Disassemble(start, start + instr.size(), comments()); 9787 Disassembler::Disassemble(start, start + instr.size(), comments());
9788 if (fix_patch) {
9789 // Redo the patch.
9790 CodePatcher::PatchEntry(*this);
9791 }
9698 } 9792 }
9699 9793
9700 9794
9795 void Code::Disassemble(DisassemblyFormatter* formatter) const {
Ivan Posva 2014/01/03 01:52:17 Can you consolidate these two identical functions
Cutch 2014/01/03 16:01:56 Done.
9796 const bool fix_patch = CodePatcher::CodeIsPatchable(*this) &&
9797 CodePatcher::IsEntryPatched(*this);
9798 if (fix_patch) {
9799 // The disassembler may choke on illegal instructions if the code has been
9800 // patched, un-patch the code before disassembling and re-patch after.
9801 CodePatcher::RestoreEntry(*this);
9802 }
9803 const Instructions& instr = Instructions::Handle(instructions());
9804 uword start = instr.EntryPoint();
9805 Disassembler::Disassemble(start, start + instr.size(), formatter, comments());
9806 if (fix_patch) {
9807 // Redo the patch.
9808 CodePatcher::PatchEntry(*this);
9809 }
9810 }
9811
9812
9701 const Code::Comments& Code::comments() const { 9813 const Code::Comments& Code::comments() const {
9702 Comments* comments = new Code::Comments(Array::Handle(raw_ptr()->comments_)); 9814 Comments* comments = new Code::Comments(Array::Handle(raw_ptr()->comments_));
9703 return *comments; 9815 return *comments;
9704 } 9816 }
9705 9817
9706 9818
9707 void Code::set_comments(const Code::Comments& comments) const { 9819 void Code::set_comments(const Code::Comments& comments) const {
9708 ASSERT(comments.comments_.IsOld()); 9820 ASSERT(comments.comments_.IsOld());
9709 StorePointer(&raw_ptr()->comments_, comments.comments_.raw()); 9821 StorePointer(&raw_ptr()->comments_, comments.comments_.raw());
9710 } 9822 }
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
9869 const char* Code::ToCString() const { 9981 const char* Code::ToCString() const {
9870 const char* kFormat = "Code entry:%p"; 9982 const char* kFormat = "Code entry:%p";
9871 intptr_t len = OS::SNPrint(NULL, 0, kFormat, EntryPoint()) + 1; 9983 intptr_t len = OS::SNPrint(NULL, 0, kFormat, EntryPoint()) + 1;
9872 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); 9984 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len);
9873 OS::SNPrint(chars, len, kFormat, EntryPoint()); 9985 OS::SNPrint(chars, len, kFormat, EntryPoint());
9874 return chars; 9986 return chars;
9875 } 9987 }
9876 9988
9877 9989
9878 void Code::PrintToJSONStream(JSONStream* stream, bool ref) const { 9990 void Code::PrintToJSONStream(JSONStream* stream, bool ref) const {
9879 Isolate* isolate = Isolate::Current();
9880 ObjectIdRing* ring = isolate->object_id_ring();
9881 intptr_t id = ring->GetIdForObject(raw());
9882 JSONObject jsobj(stream); 9991 JSONObject jsobj(stream);
9883 jsobj.AddProperty("type", JSONType(ref)); 9992 jsobj.AddProperty("type", JSONType(ref));
9884 jsobj.AddPropertyF("id", "objects/%" Pd "", id); 9993 jsobj.AddPropertyF("id", "code/%" Px "", EntryPoint());
9994 jsobj.AddPropertyF("start", "%" Px "", EntryPoint());
9995 jsobj.AddPropertyF("end", "%" Px "", EntryPoint() + Size());
9885 Function& func = Function::Handle(); 9996 Function& func = Function::Handle();
9997 func ^= function();
9998 ASSERT(!func.IsNull());
9886 String& name = String::Handle(); 9999 String& name = String::Handle();
9887 func ^= function();
9888 ASSERT(!func.IsNull()); 10000 ASSERT(!func.IsNull());
9889 name ^= func.name(); 10001 name ^= func.name();
9890 const char* internal_function_name = name.ToCString(); 10002 const char* internal_function_name = name.ToCString();
9891 jsobj.AddPropertyF("name", "%s%s", is_optimized() ? "*" : "", 10003 jsobj.AddPropertyF("name", "%s%s", is_optimized() ? "*" : "",
9892 internal_function_name); 10004 internal_function_name);
9893 name ^= func.QualifiedUserVisibleName(); 10005 name ^= func.QualifiedUserVisibleName();
9894 const char* function_name = name.ToCString(); 10006 const char* function_name = name.ToCString();
9895 jsobj.AddPropertyF("user_name", "%s%s", is_optimized() ? "*" : "", 10007 jsobj.AddPropertyF("user_name", "%s%s", is_optimized() ? "*" : "",
9896 function_name); 10008 function_name);
9897 if (ref) { 10009 if (ref) {
9898 return; 10010 return;
9899 } 10011 }
9900 jsobj.AddProperty("is_optimized", is_optimized()); 10012 jsobj.AddProperty("is_optimized", is_optimized());
9901 jsobj.AddProperty("is_alive", is_alive()); 10013 jsobj.AddProperty("is_alive", is_alive());
9902 jsobj.AddProperty("function", Object::Handle(function())); 10014 jsobj.AddProperty("function", Object::Handle(function()));
9903 JSONArray jsarr(&jsobj, "disassembly"); 10015 JSONArray jsarr(&jsobj, "disassembly");
9904 DisassembleToJSONStream formatter(jsarr); 10016 DisassembleToJSONStream formatter(jsarr);
9905 const Instructions& instr = Instructions::Handle(instructions()); 10017 Disassemble(&formatter);
9906 uword start = instr.EntryPoint();
9907 Disassembler::Disassemble(start, start + instr.size(), &formatter,
9908 comments());
9909 } 10018 }
9910 10019
9911 10020
9912 uword Code::GetPatchCodePc() const { 10021 uword Code::GetPatchCodePc() const {
9913 const PcDescriptors& descriptors = PcDescriptors::Handle(pc_descriptors()); 10022 const PcDescriptors& descriptors = PcDescriptors::Handle(pc_descriptors());
9914 return descriptors.GetPcForKind(PcDescriptors::kPatchCode); 10023 return descriptors.GetPcForKind(PcDescriptors::kPatchCode);
9915 } 10024 }
9916 10025
9917 10026
9918 uword Code::GetLazyDeoptPc() const { 10027 uword Code::GetLazyDeoptPc() const {
(...skipping 6863 matching lines...) Expand 10 before | Expand all | Expand 10 after
16782 return "_MirrorReference"; 16891 return "_MirrorReference";
16783 } 16892 }
16784 16893
16785 16894
16786 void MirrorReference::PrintToJSONStream(JSONStream* stream, bool ref) const { 16895 void MirrorReference::PrintToJSONStream(JSONStream* stream, bool ref) const {
16787 Instance::PrintToJSONStream(stream, ref); 16896 Instance::PrintToJSONStream(stream, ref);
16788 } 16897 }
16789 16898
16790 16899
16791 } // namespace dart 16900 } // namespace dart
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698