Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(248)

Unified Diff: runtime/vm/code_generator.cc

Issue 27802002: Disconnects code objects from infrequently used unoptimized functions. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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(),

Powered by Google App Engine
This is Rietveld 408576698