Index: runtime/vm/object.cc |
diff --git a/runtime/vm/object.cc b/runtime/vm/object.cc |
index dc49aab1bd1dd37f821bedca25fd0836a4212c73..099b3231128438c9d213b5f4c9b59c0e9f09302d 100644 |
--- a/runtime/vm/object.cc |
+++ b/runtime/vm/object.cc |
@@ -4528,7 +4528,7 @@ void Function::SetCode(const Code& value) const { |
StorePointer(&raw_ptr()->code_, value.raw()); |
ASSERT(Function::Handle(value.function()).IsNull() || |
(value.function() == this->raw())); |
- value.set_function(*this); |
+ value.set_owner_function(*this); |
Ivan Posva
2014/02/28 21:46:32
How about just value.set_owner(*this)? The set_own
|
} |
@@ -4857,6 +4857,12 @@ bool Function::IsInFactoryScope() const { |
void Function::set_name(const String& value) const { |
ASSERT(value.IsSymbol()); |
+ if (value.IsNull()) { |
Ivan Posva
2014/02/28 21:46:32
Debugging code...
|
+ printf("Function given null name.\n"); |
turnidge
2014/02/28 19:23:37
Debug printf?
Cutch
2014/02/28 19:37:08
Done.
|
+ } |
+ if (value.IsSymbol() == false) { |
+ printf("Function name is not a symbol.\n"); |
turnidge
2014/02/28 19:23:37
Debug printf?
Cutch
2014/02/28 19:37:08
Done.
|
+ } |
StorePointer(&raw_ptr()->name_, value.raw()); |
} |
@@ -10258,8 +10264,8 @@ bool Code::FindRawCodeVisitor::FindObject(RawObject* obj) const { |
} |
-RawCode* Code::LookupCode(uword pc) { |
- Isolate* isolate = Isolate::Current(); |
+RawCode* Code::LookupCodeInIsolate(Isolate* isolate, uword pc) { |
+ ASSERT((isolate == Isolate::Current()) || (isolate == Dart::vm_isolate())); |
NoGCScope no_gc; |
FindRawCodeVisitor visitor(pc); |
RawInstructions* instr; |
@@ -10274,6 +10280,16 @@ RawCode* Code::LookupCode(uword pc) { |
} |
+RawCode* Code::LookupCode(uword pc) { |
+ return LookupCodeInIsolate(Isolate::Current(), pc); |
+} |
+ |
+ |
+RawCode* Code::LookupCodeInVmIsolate(uword pc) { |
+ return LookupCodeInIsolate(Dart::vm_isolate(), pc); |
+} |
+ |
+ |
intptr_t Code::GetTokenIndexOfPC(uword pc) const { |
intptr_t token_pos = -1; |
const PcDescriptors& descriptors = PcDescriptors::Handle(pc_descriptors()); |
@@ -10328,25 +10344,49 @@ void Code::PrintToJSONStream(JSONStream* stream, bool ref) const { |
jsobj.AddPropertyF("id", "code/%" Px "", EntryPoint()); |
jsobj.AddPropertyF("start", "%" Px "", EntryPoint()); |
jsobj.AddPropertyF("end", "%" Px "", EntryPoint() + Size()); |
- Function& func = Function::Handle(); |
- func ^= function(); |
- ASSERT(!func.IsNull()); |
- String& name = String::Handle(); |
- ASSERT(!func.IsNull()); |
- name ^= func.name(); |
- const char* internal_function_name = name.ToCString(); |
- jsobj.AddPropertyF("name", "%s%s", is_optimized() ? "*" : "", |
- internal_function_name); |
- name ^= func.QualifiedUserVisibleName(); |
- const char* function_name = name.ToCString(); |
- jsobj.AddPropertyF("user_name", "%s%s", is_optimized() ? "*" : "", |
- function_name); |
+ jsobj.AddProperty("is_optimized", is_optimized()); |
+ jsobj.AddProperty("is_alive", is_alive()); |
+ if (OwnerIsNotNullFunction()) { |
turnidge
2014/02/28 19:23:37
I don't care for negations in predicate names unle
Cutch
2014/02/28 19:37:08
Done.
|
+ // Dart function. |
+ jsobj.AddProperty("kind", "Dart"); |
+ Function& func = Function::Handle(); |
+ String& name = String::Handle(); |
+ func ^= function(); |
+ ASSERT(!func.IsNull()); |
+ name ^= func.name(); |
+ ASSERT(!name.IsNull()); |
+ const char* name_c = name.ToCString(); |
+ jsobj.AddPropertyF("name", "%s%s", is_optimized() ? "*" : "", name_c); |
+ name ^= func.QualifiedUserVisibleName(); |
+ ASSERT(!name.IsNull()); |
+ name_c = name.ToCString(); |
+ jsobj.AddPropertyF("user_name", "%s%s", is_optimized() ? "*" : "", name_c); |
+ jsobj.AddProperty("function", Object::Handle(function())); |
+ } else if (OwnerIsAllocationStub()) { |
+ // Allocation stub. |
+ jsobj.AddProperty("kind", "DartAllocationStub"); |
+ Isolate* isolate = Isolate::Current(); |
+ ClassTable* class_table = isolate->class_table(); |
+ intptr_t cid = Smi::Value(allocation_stub_class_id()); |
+ Class& cls = Class::Handle(); |
+ cls ^= class_table->At(cid); |
+ ASSERT(!cls.IsNull()); |
+ String& cls_name = String::Handle(cls.UserVisibleName()); |
+ ASSERT(!cls_name.IsNull()); |
+ const char* name = cls_name.ToCString(); |
+ jsobj.AddPropertyF("name", "Allocation stub for %s\n", name); |
+ jsobj.AddPropertyF("user_name", "Allocation stub for %s\n", name); |
+ } else { |
+ // Regular stub. |
+ jsobj.AddProperty("kind", "DartStub"); |
+ const char* name = StubCode::NameOfStub(EntryPoint()); |
+ ASSERT(name != NULL); |
+ jsobj.AddProperty("name", name); |
+ jsobj.AddProperty("user_name", name); |
+ } |
if (ref) { |
return; |
} |
- jsobj.AddProperty("is_optimized", is_optimized()); |
- jsobj.AddProperty("is_alive", is_alive()); |
- jsobj.AddProperty("function", Object::Handle(function())); |
JSONArray jsarr(&jsobj, "disassembly"); |
if (is_alive()) { |
// Only disassemble alive code objects. |