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

Unified Diff: runtime/vm/stub_code_x64.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
« runtime/vm/stub_code_ia32.cc ('K') | « runtime/vm/stub_code_ia32.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/stub_code_x64.cc
===================================================================
--- runtime/vm/stub_code_x64.cc (revision 9689)
+++ runtime/vm/stub_code_x64.cc (working copy)
@@ -1532,25 +1532,25 @@
void StubCode::GenerateNArgsCheckInlineCacheStub(Assembler* assembler,
intptr_t num_args) {
__ movq(RCX, FieldAddress(RBX, ICData::function_offset()));
- __ incq(FieldAddress(RCX, 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.
__ cmpq(FieldAddress(RCX, 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);
- AssemblerMacros::EnterStubFrame(assembler);
- __ pushq(RBX); // Preserve inline cache data object.
- __ pushq(R10); // Preserve arguments array.
- __ pushq(RCX); // Argument for runtime: function object.
- __ CallRuntime(kOptimizeInvokedFunctionRuntimeEntry);
regis 2012/07/17 16:08:06 ditto
srdjan 2012/07/17 16:25:06 ditto.
- __ popq(RCX); // Remove argument.
- __ popq(R10); // Restore arguments array.
- __ popq(RBX); // 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 ditto
+ // but only at exit so that we have collected all type feedback before
+ // optimizing.
}
+ __ incq(FieldAddress(RCX, Function::usage_counter_offset()));
+ __ Bind(&is_hot);
+
ASSERT(num_args > 0);
// Get receiver (first read number of arguments from argument descriptor array
// and then access the receiver from the stack).
« runtime/vm/stub_code_ia32.cc ('K') | « runtime/vm/stub_code_ia32.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698