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

Unified Diff: runtime/vm/intermediate_language_x64.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/intermediate_language_ia32.cc ('k') | runtime/vm/object.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/intermediate_language_x64.cc
===================================================================
--- runtime/vm/intermediate_language_x64.cc (revision 16874)
+++ runtime/vm/intermediate_language_x64.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(RAX));
- locs->set_temp(0, Location::RegisterLocation(RDX));
return locs;
}
@@ -73,54 +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 == RAX);
- 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);
- __ cmpq(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 == RDX);
- compiler->GenerateCall(0, // no token position.
- &StubCode::OptimizeFunctionLabel(),
- PcDescriptors::kOther,
- locs());
- __ Bind(&done);
- }
- } else {
- __ Comment("Check function counter");
- // Count only in unoptimized code.
- // TODO(srdjan): Replace the counting code with a type feedback
- // collection and counting stub.
- __ LoadObject(func_reg, function);
- __ incq(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.
- __ cmpq(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(RAX)
- ASSERT(func_reg == RDX);
- 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/intermediate_language_ia32.cc ('k') | runtime/vm/object.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698