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 12505 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
12516 | 12516 |
12517 void Code::PrintJSONImpl(JSONStream* stream, bool ref) const { | 12517 void Code::PrintJSONImpl(JSONStream* stream, bool ref) const { |
12518 JSONObject jsobj(stream); | 12518 JSONObject jsobj(stream); |
12519 AddTypeProperties(&jsobj, "Code", JSONType(), ref); | 12519 AddTypeProperties(&jsobj, "Code", JSONType(), ref); |
12520 jsobj.AddPropertyF("id", "code/%" Px64"-%" Px "", compile_timestamp(), | 12520 jsobj.AddPropertyF("id", "code/%" Px64"-%" Px "", compile_timestamp(), |
12521 EntryPoint()); | 12521 EntryPoint()); |
12522 jsobj.AddPropertyF("start", "%" Px "", EntryPoint()); | 12522 jsobj.AddPropertyF("start", "%" Px "", EntryPoint()); |
12523 jsobj.AddPropertyF("end", "%" Px "", EntryPoint() + Size()); | 12523 jsobj.AddPropertyF("end", "%" Px "", EntryPoint() + Size()); |
12524 jsobj.AddProperty("optimized", is_optimized()); | 12524 jsobj.AddProperty("optimized", is_optimized()); |
12525 jsobj.AddProperty("alive", is_alive()); | 12525 jsobj.AddProperty("alive", is_alive()); |
12526 jsobj.AddProperty("kind", "Dart"); | 12526 const Object& obj = Object::Handle(owner()); |
12527 const bool is_stub = !obj.IsFunction(); | |
siva
2015/03/02 21:58:44
It might be cleaner to have a
bool IsStub() const
| |
12528 if (is_stub) { | |
12529 jsobj.AddProperty("kind", "Stub"); | |
12530 } else { | |
12531 jsobj.AddProperty("kind", "Dart"); | |
12532 } | |
12527 const String& user_name = String::Handle(PrettyName()); | 12533 const String& user_name = String::Handle(PrettyName()); |
12528 const String& vm_name = String::Handle(Name()); | 12534 const String& vm_name = String::Handle(Name()); |
12529 AddNameProperties(&jsobj, user_name, vm_name); | 12535 AddNameProperties(&jsobj, user_name, vm_name); |
12530 const Object& obj = Object::Handle(owner()); | |
12531 if (obj.IsFunction()) { | 12536 if (obj.IsFunction()) { |
12532 jsobj.AddProperty("function", obj); | 12537 jsobj.AddProperty("function", obj); |
12533 } else { | 12538 } else { |
12534 // Generate a fake function reference. | 12539 // Generate a fake function reference. |
12535 JSONObject func(&jsobj, "function"); | 12540 JSONObject func(&jsobj, "function"); |
12536 func.AddProperty("type", "@Function"); | 12541 func.AddProperty("type", "@Function"); |
12537 func.AddProperty("kind", "Stub"); | 12542 func.AddProperty("kind", "Stub"); |
12538 func.AddPropertyF("id", "functions/stub-%" Pd "", EntryPoint()); | |
12539 func.AddProperty("name", user_name.ToCString()); | 12543 func.AddProperty("name", user_name.ToCString()); |
12540 AddNameProperties(&func, user_name, vm_name); | 12544 AddNameProperties(&func, user_name, vm_name); |
12541 } | 12545 } |
12542 if (ref) { | 12546 if (ref) { |
12543 return; | 12547 return; |
12544 } | 12548 } |
12545 const Array& array = Array::Handle(ObjectPool()); | 12549 const Array& array = Array::Handle(ObjectPool()); |
12546 jsobj.AddProperty("objectPool", array); | 12550 jsobj.AddProperty("objectPool", array); |
12547 { | 12551 { |
12548 JSONArray jsarr(&jsobj, "disassembly"); | 12552 JSONArray jsarr(&jsobj, "disassembly"); |
(...skipping 8123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
20672 return tag_label.ToCString(); | 20676 return tag_label.ToCString(); |
20673 } | 20677 } |
20674 | 20678 |
20675 | 20679 |
20676 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const { | 20680 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const { |
20677 Instance::PrintJSONImpl(stream, ref); | 20681 Instance::PrintJSONImpl(stream, ref); |
20678 } | 20682 } |
20679 | 20683 |
20680 | 20684 |
20681 } // namespace dart | 20685 } // namespace dart |
OLD | NEW |