| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_X64. | 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_X64. |
| 6 #if defined(TARGET_ARCH_X64) | 6 #if defined(TARGET_ARCH_X64) |
| 7 | 7 |
| 8 #include "vm/intermediate_language.h" | 8 #include "vm/intermediate_language.h" |
| 9 | 9 |
| 10 #include "lib/error.h" | 10 #include "lib/error.h" |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 // collection and counting stub. | 54 // collection and counting stub. |
| 55 const Function& function = | 55 const Function& function = |
| 56 Function::ZoneHandle(compiler->parsed_function().function().raw()); | 56 Function::ZoneHandle(compiler->parsed_function().function().raw()); |
| 57 __ LoadObject(temp, function); | 57 __ LoadObject(temp, function); |
| 58 __ incq(FieldAddress(temp, Function::usage_counter_offset())); | 58 __ incq(FieldAddress(temp, Function::usage_counter_offset())); |
| 59 if (FlowGraphCompiler::CanOptimize() && | 59 if (FlowGraphCompiler::CanOptimize() && |
| 60 compiler->parsed_function().function().is_optimizable()) { | 60 compiler->parsed_function().function().is_optimizable()) { |
| 61 // Do not optimize if usage count must be reported. | 61 // Do not optimize if usage count must be reported. |
| 62 __ cmpq(FieldAddress(temp, Function::usage_counter_offset()), | 62 __ cmpq(FieldAddress(temp, Function::usage_counter_offset()), |
| 63 Immediate(FLAG_optimization_counter_threshold)); | 63 Immediate(FLAG_optimization_counter_threshold)); |
| 64 Label not_yet_hot, already_optimized; | 64 Label not_yet_hot; |
| 65 __ j(LESS, ¬_yet_hot, Assembler::kNearJump); | 65 __ j(LESS, ¬_yet_hot, Assembler::kNearJump); |
| 66 __ j(GREATER, &already_optimized, Assembler::kNearJump); | |
| 67 __ pushq(result); // Preserve result. | 66 __ pushq(result); // Preserve result. |
| 68 __ pushq(temp); // Argument for runtime: function to optimize. | 67 __ pushq(temp); // Argument for runtime: function to optimize. |
| 69 __ CallRuntime(kOptimizeInvokedFunctionRuntimeEntry); | 68 __ CallRuntime(kOptimizeInvokedFunctionRuntimeEntry); |
| 70 __ popq(temp); // Remove argument. | 69 __ popq(temp); // Remove argument. |
| 71 __ popq(result); // Restore result. | 70 __ popq(result); // Restore result. |
| 72 __ Bind(¬_yet_hot); | 71 __ Bind(¬_yet_hot); |
| 73 __ Bind(&already_optimized); | |
| 74 } | 72 } |
| 75 } | 73 } |
| 76 if (FLAG_trace_functions) { | 74 if (FLAG_trace_functions) { |
| 77 const Function& function = | 75 const Function& function = |
| 78 Function::ZoneHandle(compiler->parsed_function().function().raw()); | 76 Function::ZoneHandle(compiler->parsed_function().function().raw()); |
| 79 __ LoadObject(temp, function); | 77 __ LoadObject(temp, function); |
| 80 __ pushq(result); // Preserve result. | 78 __ pushq(result); // Preserve result. |
| 81 __ pushq(temp); | 79 __ pushq(temp); |
| 82 compiler->GenerateCallRuntime(0, | 80 compiler->GenerateCallRuntime(0, |
| 83 kTraceFunctionExitRuntimeEntry, | 81 kTraceFunctionExitRuntimeEntry, |
| (...skipping 2279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2363 | 2361 |
| 2364 void ShiftMintOpInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 2362 void ShiftMintOpInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 2365 UNIMPLEMENTED(); | 2363 UNIMPLEMENTED(); |
| 2366 } | 2364 } |
| 2367 | 2365 |
| 2368 } // namespace dart | 2366 } // namespace dart |
| 2369 | 2367 |
| 2370 #undef __ | 2368 #undef __ |
| 2371 | 2369 |
| 2372 #endif // defined TARGET_ARCH_X64 | 2370 #endif // defined TARGET_ARCH_X64 |
| OLD | NEW |