Index: runtime/vm/object.cc |
diff --git a/runtime/vm/object.cc b/runtime/vm/object.cc |
index 5088075dfa46b3d75602c5e8e52b9fe41e5f50fa..0a5790991d4255f4d56ad3fa42c7516a1950ac69 100644 |
--- a/runtime/vm/object.cc |
+++ b/runtime/vm/object.cc |
@@ -13360,24 +13360,35 @@ bool Code::FindRawCodeVisitor::FindObject(RawObject* raw_obj) const { |
} |
+bool Code::SlowFindRawCodeVisitor::FindObject(RawObject* raw_obj) const { |
+ return RawCode::ContainsPC(raw_obj, pc_); |
+} |
+ |
+ |
RawCode* Code::LookupCodeInIsolate(Isolate* isolate, uword pc) { |
ASSERT((isolate == Isolate::Current()) || (isolate == Dart::vm_isolate())); |
+ if (isolate->heap() == NULL) { |
+ return Code::null(); |
+ } |
NoSafepointScope no_safepoint; |
- FindRawCodeVisitor visitor(pc); |
- RawInstructions* instr; |
+ // TODO(johnmccutchan): Make lookup without a back pointer faster and use for |
+ // both cases. |
if (Dart::IsRunningPrecompiledCode()) { |
- // TODO(johnmccutchan): Make code lookup work when running precompiled. |
- UNIMPLEMENTED(); |
+ SlowFindRawCodeVisitor visitor(pc); |
+ RawObject* needle = isolate->heap()->FindOldObject(&visitor); |
+ if (needle != Code::null()) { |
+ return static_cast<RawCode*>(needle); |
+ } |
return Code::null(); |
- } |
- if (isolate->heap() == NULL) { |
+ } else { |
+ FindRawCodeVisitor visitor(pc); |
+ RawInstructions* instr; |
+ instr = isolate->heap()->FindObjectInCodeSpace(&visitor); |
+ if (instr != Instructions::null()) { |
+ return Instructions::Handle(instr).code(); |
+ } |
return Code::null(); |
} |
- instr = isolate->heap()->FindObjectInCodeSpace(&visitor); |
- if (instr != Instructions::null()) { |
- return Instructions::Handle(instr).code(); |
- } |
- return Code::null(); |
} |