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

Unified Diff: runtime/vm/intermediate_language_ia32.cc

Issue 11783066: Optimize function at its entry instead of at exit. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 11 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/flow_graph_compiler_x64.cc ('k') | runtime/vm/intermediate_language_x64.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/intermediate_language_ia32.cc
===================================================================
--- runtime/vm/intermediate_language_ia32.cc (revision 16874)
+++ runtime/vm/intermediate_language_ia32.cc (working copy)
@@ -60,11 +60,10 @@
LocationSummary* ReturnInstr::MakeLocationSummary() const {
const intptr_t kNumInputs = 1;
- const intptr_t kNumTemps = 1;
+ const intptr_t kNumTemps = 0;
LocationSummary* locs =
new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kCall);
locs->set_in(0, Location::RegisterLocation(EAX));
- locs->set_temp(0, Location::RegisterLocation(EDX));
return locs;
}
@@ -73,50 +72,8 @@
// The entry needs to be patchable, no inlined objects are allowed in the area
// that will be overwritten by the patch instruction: a jump).
void ReturnInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
- const Function& function =
- Function::ZoneHandle(compiler->parsed_function().function().raw());
Register result = locs()->in(0).reg();
- Register func_reg = locs()->temp(0).reg();
ASSERT(result == EAX);
- if (compiler->is_optimizing()) {
- if (compiler->may_reoptimize()) {
- // Increment of counter occurs only in optimized IC calls, as they
- // can cause reoptimization.
- Label done;
- __ LoadObject(func_reg, function);
- __ cmpl(FieldAddress(func_reg, Function::usage_counter_offset()),
- Immediate(FLAG_optimization_counter_threshold));
- __ j(LESS, &done, Assembler::kNearJump);
- // Equal (or greater), optimize. Note that counter can reach equality
- // only at return instruction.
- // The stub call preserves result register (EAX).
- ASSERT(func_reg == EDX);
- compiler->GenerateCall(0, // no token position.
- &StubCode::OptimizeFunctionLabel(),
- PcDescriptors::kOther,
- locs());
- __ Bind(&done);
- }
- } else {
- __ LoadObject(func_reg, function);
- __ incl(FieldAddress(func_reg, Function::usage_counter_offset()));
- if (compiler->CanOptimizeFunction() &&
- compiler->parsed_function().function().is_optimizable()) {
- // Do not optimize if usage count must be reported.
- __ cmpl(FieldAddress(func_reg, Function::usage_counter_offset()),
- Immediate(FLAG_optimization_counter_threshold));
- Label not_yet_hot;
- __ j(LESS, &not_yet_hot, Assembler::kNearJump);
- // Equal (or greater), optimize.
- // The stub call preserves result register (EAX).
- ASSERT(func_reg == EDX);
- compiler->GenerateCall(0, // no token position.
- &StubCode::OptimizeFunctionLabel(),
- PcDescriptors::kOther,
- locs());
- __ Bind(&not_yet_hot);
- }
- }
#if defined(DEBUG)
// TODO(srdjan): Fix for functions with finally clause.
// A finally clause may leave a previously pushed return value if it
« no previous file with comments | « runtime/vm/flow_graph_compiler_x64.cc ('k') | runtime/vm/intermediate_language_x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698