Chromium Code Reviews| Index: runtime/vm/code_generator.cc |
| =================================================================== |
| --- runtime/vm/code_generator.cc (revision 29013) |
| +++ runtime/vm/code_generator.cc (working copy) |
| @@ -1418,10 +1418,21 @@ |
| ASSERT(caller_code.is_optimized()); |
| const Function& target_function = Function::Handle( |
| caller_code.GetStaticCallTargetFunctionAt(frame->pc())); |
| - const Code& target_code = Code::Handle(target_function.CurrentCode()); |
| - CodePatcher::PatchStaticCallAt(frame->pc(), caller_code, |
| - target_code.EntryPoint()); |
| - caller_code.SetStaticCallTargetCodeAt(frame->pc(), target_code); |
| + |
| + // Check whether the code object has been detached from the target function. |
| + // If it has been detached, reattach it. |
| + Code& target_code = Code::Handle(); |
| + if (target_function.CurrentCode() == Code::null()) { |
|
srdjan
2013/10/23 15:58:13
if (target_function.HasCode()) {
.... old code: p
zra
2013/10/23 17:39:37
Done.
|
| + ASSERT(target_function.unoptimized_code() == Code::null()); |
| + target_code ^= caller_code.GetStaticCallTargetCodeAt(frame->pc()); |
|
srdjan
2013/10/23 15:58:13
ASSERT(!target_code.is_optimized())
zra
2013/10/23 17:39:37
Done.
|
| + ASSERT(target_code.raw() != Code::null()); |
|
srdjan
2013/10/23 15:58:13
ASSERT(!target_code.IsNull())
zra
2013/10/23 17:39:37
Done.
|
| + target_function.ReattachCode(target_code); |
| + } else { |
| + target_code ^= target_function.CurrentCode(); |
| + CodePatcher::PatchStaticCallAt(frame->pc(), caller_code, |
| + target_code.EntryPoint()); |
| + caller_code.SetStaticCallTargetCodeAt(frame->pc(), target_code); |
| + } |
| if (FLAG_trace_patching) { |
| OS::PrintErr("FixCallersTarget: patching from %#" Px " to '%s' %#" Px "\n", |
| frame->pc(), |