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

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
« no previous file with comments | « runtime/vm/assembler_x64.cc ('k') | runtime/vm/flow_graph_compiler_arm.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/code_generator.cc
===================================================================
--- runtime/vm/code_generator.cc (revision 29013)
+++ runtime/vm/code_generator.cc (working copy)
@@ -1418,10 +1418,22 @@
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.HasCode()) {
+ target_code ^= target_function.CurrentCode();
+ CodePatcher::PatchStaticCallAt(frame->pc(), caller_code,
+ target_code.EntryPoint());
+ caller_code.SetStaticCallTargetCodeAt(frame->pc(), target_code);
+ } else {
+ ASSERT(target_function.unoptimized_code() == Code::null());
+ target_code ^= caller_code.GetStaticCallTargetCodeAt(frame->pc());
+ ASSERT(!target_code.IsNull());
+ ASSERT(!target_code.is_optimized());
+ target_function.ReattachCode(target_code);
+ }
if (FLAG_trace_patching) {
OS::PrintErr("FixCallersTarget: patching from %#" Px " to '%s' %#" Px "\n",
frame->pc(),
« no previous file with comments | « runtime/vm/assembler_x64.cc ('k') | runtime/vm/flow_graph_compiler_arm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698