| 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 6093 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6104 id = cls.FindFunctionIndex(*this); | 6104 id = cls.FindFunctionIndex(*this); |
| 6105 selector = "functions"; | 6105 selector = "functions"; |
| 6106 } | 6106 } |
| 6107 ASSERT(id >= 0); | 6107 ASSERT(id >= 0); |
| 6108 intptr_t cid = cls.id(); | 6108 intptr_t cid = cls.id(); |
| 6109 JSONObject jsobj(stream); | 6109 JSONObject jsobj(stream); |
| 6110 jsobj.AddProperty("type", JSONType(ref)); | 6110 jsobj.AddProperty("type", JSONType(ref)); |
| 6111 jsobj.AddPropertyF("id", "classes/%" Pd "/%s/%" Pd "", cid, selector, id); | 6111 jsobj.AddPropertyF("id", "classes/%" Pd "/%s/%" Pd "", cid, selector, id); |
| 6112 jsobj.AddProperty("name", internal_name); | 6112 jsobj.AddProperty("name", internal_name); |
| 6113 jsobj.AddProperty("user_name", user_name); | 6113 jsobj.AddProperty("user_name", user_name); |
| 6114 jsobj.AddProperty("class", cls); |
| 6115 const char* kind_string = Function::KindToCString(kind()); |
| 6116 jsobj.AddProperty("kind", kind_string); |
| 6114 if (ref) return; | 6117 if (ref) return; |
| 6115 jsobj.AddProperty("is_static", is_static()); | 6118 jsobj.AddProperty("is_static", is_static()); |
| 6116 jsobj.AddProperty("is_const", is_const()); | 6119 jsobj.AddProperty("is_const", is_const()); |
| 6117 jsobj.AddProperty("is_optimizable", is_optimizable()); | 6120 jsobj.AddProperty("is_optimizable", is_optimizable()); |
| 6118 jsobj.AddProperty("is_inlinable", IsInlineable()); | 6121 jsobj.AddProperty("is_inlinable", IsInlineable()); |
| 6119 const char* kind_string = Function::KindToCString(kind()); | |
| 6120 jsobj.AddProperty("kind", kind_string); | |
| 6121 jsobj.AddProperty("unoptimized_code", Object::Handle(unoptimized_code())); | 6122 jsobj.AddProperty("unoptimized_code", Object::Handle(unoptimized_code())); |
| 6122 jsobj.AddProperty("usage_counter", usage_counter()); | 6123 jsobj.AddProperty("usage_counter", usage_counter()); |
| 6123 jsobj.AddProperty("optimized_call_site_count", optimized_call_site_count()); | 6124 jsobj.AddProperty("optimized_call_site_count", optimized_call_site_count()); |
| 6124 jsobj.AddProperty("code", Object::Handle(CurrentCode())); | 6125 jsobj.AddProperty("code", Object::Handle(CurrentCode())); |
| 6125 jsobj.AddProperty("deoptimizations", | 6126 jsobj.AddProperty("deoptimizations", |
| 6126 static_cast<intptr_t>(deoptimization_counter())); | 6127 static_cast<intptr_t>(deoptimization_counter())); |
| 6127 } | 6128 } |
| 6128 | 6129 |
| 6129 | 6130 |
| 6130 void ClosureData::set_context_scope(const ContextScope& value) const { | 6131 void ClosureData::set_context_scope(const ContextScope& value) const { |
| (...skipping 4332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10463 jsobj.AddProperty("is_optimized", is_optimized()); | 10464 jsobj.AddProperty("is_optimized", is_optimized()); |
| 10464 jsobj.AddProperty("is_alive", is_alive()); | 10465 jsobj.AddProperty("is_alive", is_alive()); |
| 10465 const String& name = String::Handle(Name()); | 10466 const String& name = String::Handle(Name()); |
| 10466 const String& user_name = String::Handle(UserName()); | 10467 const String& user_name = String::Handle(UserName()); |
| 10467 const char* name_prefix = is_optimized() ? "*" : ""; | 10468 const char* name_prefix = is_optimized() ? "*" : ""; |
| 10468 jsobj.AddPropertyF("name", "%s%s", name_prefix, name.ToCString()); | 10469 jsobj.AddPropertyF("name", "%s%s", name_prefix, name.ToCString()); |
| 10469 jsobj.AddPropertyF("user_name", "%s%s", name_prefix, user_name.ToCString()); | 10470 jsobj.AddPropertyF("user_name", "%s%s", name_prefix, user_name.ToCString()); |
| 10470 const Object& obj = Object::Handle(owner()); | 10471 const Object& obj = Object::Handle(owner()); |
| 10471 if (obj.IsFunction()) { | 10472 if (obj.IsFunction()) { |
| 10472 jsobj.AddProperty("function", obj); | 10473 jsobj.AddProperty("function", obj); |
| 10474 } else { |
| 10475 // Generate a fake function reference. |
| 10476 JSONObject func(&jsobj, "function"); |
| 10477 func.AddProperty("type", "@Function"); |
| 10478 func.AddProperty("kind", "Stub"); |
| 10479 func.AddPropertyF("id", "stub/functions/%" Pd "", EntryPoint()); |
| 10480 func.AddProperty("user_name", user_name.ToCString()); |
| 10481 func.AddProperty("name", name.ToCString()); |
| 10473 } | 10482 } |
| 10474 if (ref) { | 10483 if (ref) { |
| 10475 return; | 10484 return; |
| 10476 } | 10485 } |
| 10477 JSONArray jsarr(&jsobj, "disassembly"); | 10486 JSONArray jsarr(&jsobj, "disassembly"); |
| 10478 if (is_alive()) { | 10487 if (is_alive()) { |
| 10479 // Only disassemble alive code objects. | 10488 // Only disassemble alive code objects. |
| 10480 DisassembleToJSONStream formatter(jsarr); | 10489 DisassembleToJSONStream formatter(jsarr); |
| 10481 Disassemble(&formatter); | 10490 Disassemble(&formatter); |
| 10482 } | 10491 } |
| (...skipping 7085 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 17568 return "_MirrorReference"; | 17577 return "_MirrorReference"; |
| 17569 } | 17578 } |
| 17570 | 17579 |
| 17571 | 17580 |
| 17572 void MirrorReference::PrintToJSONStream(JSONStream* stream, bool ref) const { | 17581 void MirrorReference::PrintToJSONStream(JSONStream* stream, bool ref) const { |
| 17573 Instance::PrintToJSONStream(stream, ref); | 17582 Instance::PrintToJSONStream(stream, ref); |
| 17574 } | 17583 } |
| 17575 | 17584 |
| 17576 | 17585 |
| 17577 } // namespace dart | 17586 } // namespace dart |
| OLD | NEW |