| 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 4123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4134 jsobj.AddProperty("_finalized", is_finalized()); | 4134 jsobj.AddProperty("_finalized", is_finalized()); |
| 4135 jsobj.AddProperty("_implemented", is_implemented()); | 4135 jsobj.AddProperty("_implemented", is_implemented()); |
| 4136 jsobj.AddProperty("_patch", is_patch()); | 4136 jsobj.AddProperty("_patch", is_patch()); |
| 4137 const Class& superClass = Class::Handle(SuperClass()); | 4137 const Class& superClass = Class::Handle(SuperClass()); |
| 4138 if (!superClass.IsNull()) { | 4138 if (!superClass.IsNull()) { |
| 4139 jsobj.AddProperty("super", superClass); | 4139 jsobj.AddProperty("super", superClass); |
| 4140 } | 4140 } |
| 4141 jsobj.AddProperty("library", Object::Handle(library())); | 4141 jsobj.AddProperty("library", Object::Handle(library())); |
| 4142 const Script& script = Script::Handle(this->script()); | 4142 const Script& script = Script::Handle(this->script()); |
| 4143 if (!script.IsNull()) { | 4143 if (!script.IsNull()) { |
| 4144 jsobj.AddProperty("script", script); | 4144 jsobj.AddLocation(script, token_pos(), ComputeEndTokenPos()); |
| 4145 jsobj.AddProperty("tokenPos", token_pos()); | |
| 4146 jsobj.AddProperty("endTokenPos", ComputeEndTokenPos()); | |
| 4147 } | 4145 } |
| 4148 { | 4146 { |
| 4149 JSONArray interfaces_array(&jsobj, "interfaces"); | 4147 JSONArray interfaces_array(&jsobj, "interfaces"); |
| 4150 const Array& interface_array = Array::Handle(interfaces()); | 4148 const Array& interface_array = Array::Handle(interfaces()); |
| 4151 Type& interface_type = Type::Handle(); | 4149 Type& interface_type = Type::Handle(); |
| 4152 if (!interface_array.IsNull()) { | 4150 if (!interface_array.IsNull()) { |
| 4153 for (intptr_t i = 0; i < interface_array.Length(); ++i) { | 4151 for (intptr_t i = 0; i < interface_array.Length(); ++i) { |
| 4154 interface_type ^= interface_array.At(i); | 4152 interface_type ^= interface_array.At(i); |
| 4155 interfaces_array.AddValue(interface_type); | 4153 interfaces_array.AddValue(interface_type); |
| 4156 } | 4154 } |
| (...skipping 2766 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6923 if (!code.IsNull()) { | 6921 if (!code.IsNull()) { |
| 6924 jsobj.AddProperty("_unoptimizedCode", code); | 6922 jsobj.AddProperty("_unoptimizedCode", code); |
| 6925 } | 6923 } |
| 6926 jsobj.AddProperty("_usageCounter", usage_counter()); | 6924 jsobj.AddProperty("_usageCounter", usage_counter()); |
| 6927 jsobj.AddProperty("_optimizedCallSiteCount", optimized_call_site_count()); | 6925 jsobj.AddProperty("_optimizedCallSiteCount", optimized_call_site_count()); |
| 6928 jsobj.AddProperty("_deoptimizations", | 6926 jsobj.AddProperty("_deoptimizations", |
| 6929 static_cast<intptr_t>(deoptimization_counter())); | 6927 static_cast<intptr_t>(deoptimization_counter())); |
| 6930 | 6928 |
| 6931 const Script& script = Script::Handle(this->script()); | 6929 const Script& script = Script::Handle(this->script()); |
| 6932 if (!script.IsNull()) { | 6930 if (!script.IsNull()) { |
| 6933 jsobj.AddProperty("script", script); | 6931 jsobj.AddLocation(script, token_pos(), end_token_pos()); |
| 6934 jsobj.AddProperty("tokenPos", token_pos()); | |
| 6935 jsobj.AddProperty("endTokenPos", end_token_pos()); | |
| 6936 } | 6932 } |
| 6937 } | 6933 } |
| 6938 | 6934 |
| 6939 | 6935 |
| 6940 void ClosureData::set_context_scope(const ContextScope& value) const { | 6936 void ClosureData::set_context_scope(const ContextScope& value) const { |
| 6941 StorePointer(&raw_ptr()->context_scope_, value.raw()); | 6937 StorePointer(&raw_ptr()->context_scope_, value.raw()); |
| 6942 } | 6938 } |
| 6943 | 6939 |
| 6944 | 6940 |
| 6945 void ClosureData::set_implicit_static_closure(const Instance& closure) const { | 6941 void ClosureData::set_implicit_static_closure(const Instance& closure) const { |
| (...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7280 if (guarded_list_length() == kUnknownFixedLength) { | 7276 if (guarded_list_length() == kUnknownFixedLength) { |
| 7281 jsobj.AddProperty("_guardLength", "unknown"); | 7277 jsobj.AddProperty("_guardLength", "unknown"); |
| 7282 } else if (guarded_list_length() == kNoFixedLength) { | 7278 } else if (guarded_list_length() == kNoFixedLength) { |
| 7283 jsobj.AddProperty("_guardLength", "variable"); | 7279 jsobj.AddProperty("_guardLength", "variable"); |
| 7284 } else { | 7280 } else { |
| 7285 jsobj.AddProperty("_guardLength", guarded_list_length()); | 7281 jsobj.AddProperty("_guardLength", guarded_list_length()); |
| 7286 } | 7282 } |
| 7287 const Class& origin_cls = Class::Handle(origin()); | 7283 const Class& origin_cls = Class::Handle(origin()); |
| 7288 const Script& script = Script::Handle(origin_cls.script()); | 7284 const Script& script = Script::Handle(origin_cls.script()); |
| 7289 if (!script.IsNull()) { | 7285 if (!script.IsNull()) { |
| 7290 jsobj.AddProperty("script", script); | 7286 jsobj.AddLocation(script, token_pos()); |
| 7291 jsobj.AddProperty("tokenPos", token_pos()); | |
| 7292 } | 7287 } |
| 7293 } | 7288 } |
| 7294 | 7289 |
| 7295 | 7290 |
| 7296 RawArray* Field::dependent_code() const { | 7291 RawArray* Field::dependent_code() const { |
| 7297 return raw_ptr()->dependent_code_; | 7292 return raw_ptr()->dependent_code_; |
| 7298 } | 7293 } |
| 7299 | 7294 |
| 7300 | 7295 |
| 7301 void Field::set_dependent_code(const Array& array) const { | 7296 void Field::set_dependent_code(const Array& array) const { |
| (...skipping 3479 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10781 Class& cls = Class::Handle(this->clazz()); | 10776 Class& cls = Class::Handle(this->clazz()); |
| 10782 jsobj->AddProperty("class", cls); | 10777 jsobj->AddProperty("class", cls); |
| 10783 jsobj->AddProperty("size", raw()->Size()); | 10778 jsobj->AddProperty("size", raw()->Size()); |
| 10784 JSONArray members(jsobj, "members"); | 10779 JSONArray members(jsobj, "members"); |
| 10785 Iterator iter(*this, RawPcDescriptors::kAnyKind); | 10780 Iterator iter(*this, RawPcDescriptors::kAnyKind); |
| 10786 while (iter.MoveNext()) { | 10781 while (iter.MoveNext()) { |
| 10787 JSONObject descriptor(&members); | 10782 JSONObject descriptor(&members); |
| 10788 descriptor.AddPropertyF("pcOffset", "%" Px "", iter.PcOffset()); | 10783 descriptor.AddPropertyF("pcOffset", "%" Px "", iter.PcOffset()); |
| 10789 descriptor.AddProperty("kind", KindAsStr(iter.Kind())); | 10784 descriptor.AddProperty("kind", KindAsStr(iter.Kind())); |
| 10790 descriptor.AddProperty("deoptId", iter.DeoptId()); | 10785 descriptor.AddProperty("deoptId", iter.DeoptId()); |
| 10786 // TODO(turnidge): Use AddLocation instead. |
| 10791 descriptor.AddProperty("tokenPos", iter.TokenPos()); | 10787 descriptor.AddProperty("tokenPos", iter.TokenPos()); |
| 10792 descriptor.AddProperty("tryIndex", iter.TryIndex()); | 10788 descriptor.AddProperty("tryIndex", iter.TryIndex()); |
| 10793 } | 10789 } |
| 10794 } | 10790 } |
| 10795 | 10791 |
| 10796 | 10792 |
| 10797 void PcDescriptors::PrintJSONImpl(JSONStream* stream, bool ref) const { | 10793 void PcDescriptors::PrintJSONImpl(JSONStream* stream, bool ref) const { |
| 10798 JSONObject jsobj(stream); | 10794 JSONObject jsobj(stream); |
| 10799 PrintToJSONObject(&jsobj, ref); | 10795 PrintToJSONObject(&jsobj, ref); |
| 10800 } | 10796 } |
| (...skipping 1193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11994 | 11990 |
| 11995 void ICData::PrintToJSONArray(const JSONArray& jsarray, | 11991 void ICData::PrintToJSONArray(const JSONArray& jsarray, |
| 11996 intptr_t token_pos, | 11992 intptr_t token_pos, |
| 11997 bool is_static_call) const { | 11993 bool is_static_call) const { |
| 11998 Isolate* isolate = Isolate::Current(); | 11994 Isolate* isolate = Isolate::Current(); |
| 11999 Class& cls = Class::Handle(); | 11995 Class& cls = Class::Handle(); |
| 12000 Function& func = Function::Handle(); | 11996 Function& func = Function::Handle(); |
| 12001 | 11997 |
| 12002 JSONObject jsobj(&jsarray); | 11998 JSONObject jsobj(&jsarray); |
| 12003 jsobj.AddProperty("name", String::Handle(target_name()).ToCString()); | 11999 jsobj.AddProperty("name", String::Handle(target_name()).ToCString()); |
| 12000 // TODO(turnidge): Use AddLocation instead. |
| 12004 jsobj.AddProperty("tokenPos", token_pos); | 12001 jsobj.AddProperty("tokenPos", token_pos); |
| 12005 // TODO(rmacnak): Figure out how to stringify DeoptReasons(). | 12002 // TODO(rmacnak): Figure out how to stringify DeoptReasons(). |
| 12006 // jsobj.AddProperty("deoptReasons", ...); | 12003 // jsobj.AddProperty("deoptReasons", ...); |
| 12007 | 12004 |
| 12008 JSONArray cache_entries(&jsobj, "cacheEntries"); | 12005 JSONArray cache_entries(&jsobj, "cacheEntries"); |
| 12009 for (intptr_t i = 0; i < NumberOfChecks(); i++) { | 12006 for (intptr_t i = 0; i < NumberOfChecks(); i++) { |
| 12010 func = GetTargetAt(i); | 12007 func = GetTargetAt(i); |
| 12011 if (is_static_call) { | 12008 if (is_static_call) { |
| 12012 cls ^= func.Owner(); | 12009 cls ^= func.Owner(); |
| 12013 } else { | 12010 } else { |
| (...skipping 8812 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 20826 return tag_label.ToCString(); | 20823 return tag_label.ToCString(); |
| 20827 } | 20824 } |
| 20828 | 20825 |
| 20829 | 20826 |
| 20830 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const { | 20827 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const { |
| 20831 Instance::PrintJSONImpl(stream, ref); | 20828 Instance::PrintJSONImpl(stream, ref); |
| 20832 } | 20829 } |
| 20833 | 20830 |
| 20834 | 20831 |
| 20835 } // namespace dart | 20832 } // namespace dart |
| OLD | NEW |