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 12496 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
12507 ASSERT(!cls_name.IsNull()); | 12507 ASSERT(!cls_name.IsNull()); |
12508 return String::Concat(Symbols::AllocationStubFor(), cls_name); | 12508 return String::Concat(Symbols::AllocationStubFor(), cls_name); |
12509 } else { | 12509 } else { |
12510 ASSERT(obj.IsFunction()); | 12510 ASSERT(obj.IsFunction()); |
12511 // Dart function. | 12511 // Dart function. |
12512 return Function::Cast(obj).QualifiedPrettyName(); | 12512 return Function::Cast(obj).QualifiedPrettyName(); |
12513 } | 12513 } |
12514 } | 12514 } |
12515 | 12515 |
12516 | 12516 |
| 12517 bool Code::IsAllocationStubCode() const { |
| 12518 const Object& obj = Object::Handle(owner()); |
| 12519 return obj.IsClass(); |
| 12520 } |
| 12521 |
| 12522 |
| 12523 bool Code::IsStubCode() const { |
| 12524 const Object& obj = Object::Handle(owner()); |
| 12525 return obj.IsNull(); |
| 12526 } |
| 12527 |
| 12528 |
| 12529 bool Code::IsFunctionCode() const { |
| 12530 const Object& obj = Object::Handle(owner()); |
| 12531 return obj.IsFunction(); |
| 12532 } |
| 12533 |
| 12534 |
12517 void Code::PrintJSONImpl(JSONStream* stream, bool ref) const { | 12535 void Code::PrintJSONImpl(JSONStream* stream, bool ref) const { |
12518 JSONObject jsobj(stream); | 12536 JSONObject jsobj(stream); |
12519 AddTypeProperties(&jsobj, "Code", JSONType(), ref); | 12537 AddTypeProperties(&jsobj, "Code", JSONType(), ref); |
12520 jsobj.AddPropertyF("id", "code/%" Px64"-%" Px "", compile_timestamp(), | 12538 jsobj.AddPropertyF("id", "code/%" Px64"-%" Px "", compile_timestamp(), |
12521 EntryPoint()); | 12539 EntryPoint()); |
12522 jsobj.AddPropertyF("start", "%" Px "", EntryPoint()); | 12540 jsobj.AddPropertyF("start", "%" Px "", EntryPoint()); |
12523 jsobj.AddPropertyF("end", "%" Px "", EntryPoint() + Size()); | 12541 jsobj.AddPropertyF("end", "%" Px "", EntryPoint() + Size()); |
12524 jsobj.AddProperty("optimized", is_optimized()); | 12542 jsobj.AddProperty("optimized", is_optimized()); |
12525 jsobj.AddProperty("alive", is_alive()); | 12543 jsobj.AddProperty("alive", is_alive()); |
12526 jsobj.AddProperty("kind", "Dart"); | 12544 const Object& obj = Object::Handle(owner()); |
| 12545 const bool is_stub = IsStubCode() || IsAllocationStubCode(); |
| 12546 if (is_stub) { |
| 12547 jsobj.AddProperty("kind", "Stub"); |
| 12548 } else { |
| 12549 jsobj.AddProperty("kind", "Dart"); |
| 12550 } |
12527 const String& user_name = String::Handle(PrettyName()); | 12551 const String& user_name = String::Handle(PrettyName()); |
12528 const String& vm_name = String::Handle(Name()); | 12552 const String& vm_name = String::Handle(Name()); |
12529 AddNameProperties(&jsobj, user_name, vm_name); | 12553 AddNameProperties(&jsobj, user_name, vm_name); |
12530 const Object& obj = Object::Handle(owner()); | |
12531 if (obj.IsFunction()) { | 12554 if (obj.IsFunction()) { |
12532 jsobj.AddProperty("function", obj); | 12555 jsobj.AddProperty("function", obj); |
12533 } else { | 12556 } else { |
12534 // Generate a fake function reference. | 12557 // Generate a fake function reference. |
12535 JSONObject func(&jsobj, "function"); | 12558 JSONObject func(&jsobj, "function"); |
12536 func.AddProperty("type", "@Function"); | 12559 func.AddProperty("type", "@Function"); |
12537 func.AddProperty("kind", "Stub"); | 12560 func.AddProperty("kind", "Stub"); |
12538 func.AddPropertyF("id", "functions/stub-%" Pd "", EntryPoint()); | |
12539 func.AddProperty("name", user_name.ToCString()); | 12561 func.AddProperty("name", user_name.ToCString()); |
12540 AddNameProperties(&func, user_name, vm_name); | 12562 AddNameProperties(&func, user_name, vm_name); |
12541 } | 12563 } |
12542 if (ref) { | 12564 if (ref) { |
12543 return; | 12565 return; |
12544 } | 12566 } |
12545 const Array& array = Array::Handle(ObjectPool()); | 12567 const Array& array = Array::Handle(ObjectPool()); |
12546 jsobj.AddProperty("objectPool", array); | 12568 jsobj.AddProperty("objectPool", array); |
12547 { | 12569 { |
12548 JSONArray jsarr(&jsobj, "disassembly"); | 12570 JSONArray jsarr(&jsobj, "disassembly"); |
(...skipping 8123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
20672 return tag_label.ToCString(); | 20694 return tag_label.ToCString(); |
20673 } | 20695 } |
20674 | 20696 |
20675 | 20697 |
20676 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const { | 20698 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const { |
20677 Instance::PrintJSONImpl(stream, ref); | 20699 Instance::PrintJSONImpl(stream, ref); |
20678 } | 20700 } |
20679 | 20701 |
20680 | 20702 |
20681 } // namespace dart | 20703 } // namespace dart |
OLD | NEW |