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/become.h" | 10 #include "vm/become.h" |
(...skipping 14466 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
14477 while (iter.MoveNext()) { | 14477 while (iter.MoveNext()) { |
14478 if (iter.PcOffset() == pc_offset) { | 14478 if (iter.PcOffset() == pc_offset) { |
14479 return iter.DeoptId(); | 14479 return iter.DeoptId(); |
14480 } | 14480 } |
14481 } | 14481 } |
14482 return Thread::kNoDeoptId; | 14482 return Thread::kNoDeoptId; |
14483 } | 14483 } |
14484 | 14484 |
14485 | 14485 |
14486 const char* Code::ToCString() const { | 14486 const char* Code::ToCString() const { |
14487 Zone* zone = Thread::Current()->zone(); | 14487 return Thread::Current()->zone()->PrintToString("Code(%s)", QualifiedName()); |
14488 if (IsStubCode()) { | |
14489 const char* name = StubCode::NameOfStub(UncheckedEntryPoint()); | |
14490 return zone->PrintToString("[stub: %s]", name); | |
14491 } else { | |
14492 return zone->PrintToString("Code entry: 0x%" Px, UncheckedEntryPoint()); | |
14493 } | |
14494 } | 14488 } |
14495 | 14489 |
14496 | 14490 |
14497 const char* Code::Name() const { | 14491 const char* Code::Name() const { |
14498 const Object& obj = Object::Handle(owner()); | 14492 Zone* zone = Thread::Current()->zone(); |
| 14493 const Object& obj = Object::Handle(zone, owner()); |
14499 if (obj.IsNull()) { | 14494 if (obj.IsNull()) { |
14500 // Regular stub. | 14495 // Regular stub. |
14501 Thread* thread = Thread::Current(); | |
14502 Zone* zone = thread->zone(); | |
14503 const char* name = StubCode::NameOfStub(UncheckedEntryPoint()); | 14496 const char* name = StubCode::NameOfStub(UncheckedEntryPoint()); |
14504 ASSERT(name != NULL); | 14497 ASSERT(name != NULL); |
14505 return OS::SCreate(zone, "[Stub] %s", name); | 14498 return zone->PrintToString("[Stub] %s", name); |
14506 } else if (obj.IsClass()) { | 14499 } else if (obj.IsClass()) { |
14507 // Allocation stub. | 14500 // Allocation stub. |
14508 Thread* thread = Thread::Current(); | 14501 String& cls_name = String::Handle(zone, Class::Cast(obj).ScrubbedName()); |
14509 Zone* zone = thread->zone(); | |
14510 const Class& cls = Class::Cast(obj); | |
14511 String& cls_name = String::Handle(zone, cls.ScrubbedName()); | |
14512 ASSERT(!cls_name.IsNull()); | 14502 ASSERT(!cls_name.IsNull()); |
14513 return OS::SCreate(zone, "[Stub] Allocate %s", cls_name.ToCString()); | 14503 return zone->PrintToString("[Stub] Allocate %s", cls_name.ToCString()); |
14514 } else { | 14504 } else { |
14515 ASSERT(obj.IsFunction()); | 14505 ASSERT(obj.IsFunction()); |
14516 // Dart function. | 14506 // Dart function. |
14517 // Same as scrubbed name. | 14507 const char* opt = is_optimized() ? "*" : ""; |
14518 return String::Handle(Function::Cast(obj).UserVisibleName()).ToCString(); | 14508 const char* function_name = |
| 14509 String::Handle(zone, Function::Cast(obj).UserVisibleName()).ToCString(); |
| 14510 return zone->PrintToString("%s%s", opt, function_name); |
14519 } | 14511 } |
14520 } | 14512 } |
14521 | 14513 |
14522 | 14514 |
14523 const char* Code::QualifiedName() const { | 14515 const char* Code::QualifiedName() const { |
14524 const Object& obj = Object::Handle(owner()); | 14516 Zone* zone = Thread::Current()->zone(); |
| 14517 const Object& obj = Object::Handle(zone, owner()); |
14525 if (obj.IsFunction()) { | 14518 if (obj.IsFunction()) { |
14526 return String::Handle(Function::Cast(obj).QualifiedScrubbedName()) | 14519 const char* opt = is_optimized() ? "*" : ""; |
14527 .ToCString(); | 14520 const char* function_name = |
| 14521 String::Handle(zone, Function::Cast(obj).QualifiedScrubbedName()) |
| 14522 .ToCString(); |
| 14523 return zone->PrintToString("%s%s", opt, function_name); |
14528 } | 14524 } |
14529 return Name(); | 14525 return Name(); |
14530 } | 14526 } |
14531 | 14527 |
14532 | 14528 |
14533 bool Code::IsAllocationStubCode() const { | 14529 bool Code::IsAllocationStubCode() const { |
14534 const Object& obj = Object::Handle(owner()); | 14530 const Object& obj = Object::Handle(owner()); |
14535 return obj.IsClass(); | 14531 return obj.IsClass(); |
14536 } | 14532 } |
14537 | 14533 |
(...skipping 8541 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
23079 return UserTag::null(); | 23075 return UserTag::null(); |
23080 } | 23076 } |
23081 | 23077 |
23082 | 23078 |
23083 const char* UserTag::ToCString() const { | 23079 const char* UserTag::ToCString() const { |
23084 const String& tag_label = String::Handle(label()); | 23080 const String& tag_label = String::Handle(label()); |
23085 return tag_label.ToCString(); | 23081 return tag_label.ToCString(); |
23086 } | 23082 } |
23087 | 23083 |
23088 } // namespace dart | 23084 } // namespace dart |
OLD | NEW |