| Index: runtime/vm/object.cc
|
| diff --git a/runtime/vm/object.cc b/runtime/vm/object.cc
|
| index 93c5502dc51f97242fe8ab8c9d35585d075c02b6..1dfdcdf3877d16c956c79c8dd6fd40d30e3f843b 100644
|
| --- a/runtime/vm/object.cc
|
| +++ b/runtime/vm/object.cc
|
| @@ -13425,24 +13425,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();
|
| }
|
|
|
|
|
|
|