Chromium Code Reviews| Index: runtime/vm/debugger.cc |
| =================================================================== |
| --- runtime/vm/debugger.cc (revision 16645) |
| +++ runtime/vm/debugger.cc (working copy) |
| @@ -139,6 +139,7 @@ |
| : pc_(pc), fp_(fp), sp_(sp), |
| ctx_(Context::ZoneHandle(ctx.raw())), |
| function_(Function::ZoneHandle()), |
| + code_(Code::ZoneHandle()), |
| token_pos_(-1), |
| pc_desc_index_(-1), |
| line_number_(-1), |
| @@ -150,13 +151,20 @@ |
| } |
| -const Function& ActivationFrame::DartFunction() { |
| - if (function_.IsNull()) { |
| +const Code& ActivationFrame::DartCode() { |
| + if (code_.IsNull()) { |
| Isolate* isolate = Isolate::Current(); |
| ASSERT(isolate != NULL); |
| - const Code& code = Code::Handle(Code::LookupCode(pc_)); |
| - function_ = code.function(); |
| + code_ = Code::LookupCode(pc_); |
| } |
| + return code_; |
| +} |
| + |
| + |
| +const Function& ActivationFrame::DartFunction() { |
| + if (function_.IsNull()) { |
| + function_ = DartCode().function(); |
|
srdjan
2013/01/04 22:50:15
Why cache the function at all?
hausner
2013/01/05 00:46:06
It is used in a few locations. May save a few hand
|
| + } |
| return function_; |
| } |
| @@ -235,9 +243,7 @@ |
| void ActivationFrame::GetPcDescriptors() { |
| if (pc_desc_.IsNull()) { |
| - const Function& func = DartFunction(); |
| - ASSERT(!func.HasOptimizedCode()); |
| - Code& code = Code::Handle(func.unoptimized_code()); |
| + const Code& code = DartCode(); |
| ASSERT(!code.IsNull()); |
| pc_desc_ = code.pc_descriptors(); |
| ASSERT(!pc_desc_.IsNull()); |
| @@ -283,13 +289,11 @@ |
| void ActivationFrame::GetVarDescriptors() { |
| - if (!var_descriptors_.IsNull()) { |
| - return; |
| + if (var_descriptors_.IsNull()) { |
| + const Code& code = DartCode(); |
| + var_descriptors_ = code.var_descriptors(); |
| + ASSERT(!var_descriptors_.IsNull()); |
| } |
| - ASSERT(!DartFunction().HasOptimizedCode()); |
| - const Code& code = Code::Handle(DartFunction().unoptimized_code()); |
| - var_descriptors_ = code.var_descriptors(); |
| - ASSERT(!var_descriptors_.IsNull()); |
| } |