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

Unified Diff: runtime/vm/stub_code_ia32.cc

Issue 10779026: Fix triggering of method optimization: increment counter at all IC calls and return as before but a… (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 5 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 | « no previous file | runtime/vm/stub_code_x64.cc » ('j') | runtime/vm/stub_code_x64.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/stub_code_ia32.cc
===================================================================
--- runtime/vm/stub_code_ia32.cc (revision 9689)
+++ runtime/vm/stub_code_ia32.cc (working copy)
@@ -1558,27 +1558,24 @@
Immediate(reinterpret_cast<intptr_t>(Object::null()));
__ movl(EBX, FieldAddress(ECX, ICData::function_offset()));
- __ incl(FieldAddress(EBX, Function::usage_counter_offset()));
+ Label is_hot;
if (FlowGraphCompiler::CanOptimize()) {
+ ASSERT(FLAG_optimization_counter_threshold > 1);
+ // The usage_counter is always less than FLAG_optimization_counter_threshold
+ // except when the function gets optimized.
__ cmpl(FieldAddress(EBX, Function::usage_counter_offset()),
- Immediate(FLAG_optimization_counter_threshold));
- Label not_yet_hot, already_optimized;
- __ j(LESS, &not_yet_hot, Assembler::kNearJump);
- __ j(GREATER, &already_optimized, Assembler::kNearJump);
- // Create a stub frame as we are pushing some objects on the stack before
- // calling into the runtime.
- AssemblerMacros::EnterStubFrame(assembler);
- __ pushl(ECX); // Preserve inline cache data object.
- __ pushl(EDX); // Preserve arguments array.
- __ pushl(EBX); // Argument for runtime: function object.
- __ CallRuntime(kOptimizeInvokedFunctionRuntimeEntry);
regis 2012/07/17 16:08:06 Is this runtime entry still needed?
srdjan 2012/07/17 16:25:06 Yes, from ReturnInstr::EmitNativeCode.
- __ popl(EBX); // Remove argument.
- __ popl(EDX); // Restore arguments array.
- __ popl(ECX); // Restore inline cache data object.
- __ LeaveFrame();
- __ Bind(&not_yet_hot);
- __ Bind(&already_optimized);
+ Immediate(FLAG_optimization_counter_threshold - 1));
+ // Do not increment to equality with threshold, since a counter greater
+ // than threshold denotes a function that was already optimized.
+ // The equality should be reached only at exit of the method
+ // (return instruction).
+ __ j(EQUAL, &is_hot, Assembler::kNearJump);
+ // As long as VM has no OSR do not optimize in the middle of the function
regis 2012/07/17 16:08:06 OSR? On-stack replacement?
srdjan 2012/07/17 16:25:06 Yes.
+ // but only at exit so that we have collected all type feedback before
+ // optimizing.
}
+ __ incl(FieldAddress(EBX, Function::usage_counter_offset()));
+ __ Bind(&is_hot);
ASSERT(num_args > 0);
// Get receiver (first read number of arguments from argument descriptor array
« no previous file with comments | « no previous file | runtime/vm/stub_code_x64.cc » ('j') | runtime/vm/stub_code_x64.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698