| Index: runtime/vm/intermediate_language_x64.cc
|
| ===================================================================
|
| --- runtime/vm/intermediate_language_x64.cc (revision 14749)
|
| +++ runtime/vm/intermediate_language_x64.cc (working copy)
|
| @@ -20,7 +20,6 @@
|
| namespace dart {
|
|
|
| DECLARE_FLAG(int, optimization_counter_threshold);
|
| -DECLARE_FLAG(bool, trace_functions);
|
| DECLARE_FLAG(bool, propagate_ic_data);
|
|
|
| // Generic summary for call instructions that have all arguments pushed
|
| @@ -36,16 +35,16 @@
|
| const intptr_t kNumInputs = 1;
|
| const intptr_t kNumTemps = 1;
|
| LocationSummary* locs =
|
| - new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall);
|
| + new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kCall);
|
| locs->set_in(0, Location::RegisterLocation(RAX));
|
| - locs->set_temp(0, Location::RequiresRegister());
|
| + locs->set_temp(0, Location::RegisterLocation(RDX));
|
| return locs;
|
| }
|
|
|
|
|
| void ReturnInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
|
| Register result = locs()->in(0).reg();
|
| - Register temp = locs()->temp(0).reg();
|
| + Register func_reg = locs()->temp(0).reg();
|
| ASSERT(result == RAX);
|
| if (!compiler->is_optimizing()) {
|
| __ Comment("Check function counter");
|
| @@ -54,35 +53,25 @@
|
| // collection and counting stub.
|
| const Function& function =
|
| Function::ZoneHandle(compiler->parsed_function().function().raw());
|
| - __ LoadObject(temp, function);
|
| - __ incq(FieldAddress(temp, Function::usage_counter_offset()));
|
| + __ LoadObject(func_reg, function);
|
| + __ incq(FieldAddress(func_reg, Function::usage_counter_offset()));
|
| if (FlowGraphCompiler::CanOptimize() &&
|
| compiler->parsed_function().function().is_optimizable()) {
|
| // Do not optimize if usage count must be reported.
|
| - __ cmpq(FieldAddress(temp, Function::usage_counter_offset()),
|
| + __ cmpq(FieldAddress(func_reg, Function::usage_counter_offset()),
|
| Immediate(FLAG_optimization_counter_threshold));
|
| Label not_yet_hot;
|
| __ j(LESS, ¬_yet_hot, Assembler::kNearJump);
|
| - __ pushq(result); // Preserve result.
|
| - __ pushq(temp); // Argument for runtime: function to optimize.
|
| - __ CallRuntime(kOptimizeInvokedFunctionRuntimeEntry);
|
| - __ popq(temp); // Remove argument.
|
| - __ popq(result); // Restore result.
|
| + // 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(¬_yet_hot);
|
| }
|
| }
|
| - if (FLAG_trace_functions) {
|
| - const Function& function =
|
| - Function::ZoneHandle(compiler->parsed_function().function().raw());
|
| - __ LoadObject(temp, function);
|
| - __ pushq(result); // Preserve result.
|
| - __ pushq(temp);
|
| - compiler->GenerateCallRuntime(0,
|
| - kTraceFunctionExitRuntimeEntry,
|
| - NULL);
|
| - __ popq(temp); // Remove argument.
|
| - __ popq(result); // Restore result.
|
| - }
|
| #if defined(DEBUG)
|
| // TODO(srdjan): Fix for functions with finally clause.
|
| // A finally clause may leave a previously pushed return value if it
|
|
|