| 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_IA32. | 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_IA32. |
| 6 #if defined(TARGET_ARCH_IA32) | 6 #if defined(TARGET_ARCH_IA32) |
| 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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 // collection and counting stub. | 53 // collection and counting stub. |
| 54 const Function& function = | 54 const Function& function = |
| 55 Function::ZoneHandle(compiler->parsed_function().function().raw()); | 55 Function::ZoneHandle(compiler->parsed_function().function().raw()); |
| 56 __ LoadObject(temp, function); | 56 __ LoadObject(temp, function); |
| 57 __ incl(FieldAddress(temp, Function::usage_counter_offset())); | 57 __ incl(FieldAddress(temp, Function::usage_counter_offset())); |
| 58 if (FlowGraphCompiler::CanOptimize() && | 58 if (FlowGraphCompiler::CanOptimize() && |
| 59 compiler->parsed_function().function().is_optimizable()) { | 59 compiler->parsed_function().function().is_optimizable()) { |
| 60 // Do not optimize if usage count must be reported. | 60 // Do not optimize if usage count must be reported. |
| 61 __ cmpl(FieldAddress(temp, Function::usage_counter_offset()), | 61 __ cmpl(FieldAddress(temp, Function::usage_counter_offset()), |
| 62 Immediate(FLAG_optimization_counter_threshold)); | 62 Immediate(FLAG_optimization_counter_threshold)); |
| 63 Label not_yet_hot, already_optimized; | 63 Label not_yet_hot; |
| 64 __ j(LESS, ¬_yet_hot, Assembler::kNearJump); | 64 __ j(LESS, ¬_yet_hot, Assembler::kNearJump); |
| 65 __ j(GREATER, &already_optimized, Assembler::kNearJump); | |
| 66 __ pushl(result); // Preserve result. | 65 __ pushl(result); // Preserve result. |
| 67 __ pushl(temp); // Argument for runtime: function to optimize. | 66 __ pushl(temp); // Argument for runtime: function to optimize. |
| 68 __ CallRuntime(kOptimizeInvokedFunctionRuntimeEntry); | 67 __ CallRuntime(kOptimizeInvokedFunctionRuntimeEntry); |
| 69 __ popl(temp); // Remove argument. | 68 __ popl(temp); // Remove argument. |
| 70 __ popl(result); // Restore result. | 69 __ popl(result); // Restore result. |
| 71 __ Bind(¬_yet_hot); | 70 __ Bind(¬_yet_hot); |
| 72 __ Bind(&already_optimized); | |
| 73 } | 71 } |
| 74 } | 72 } |
| 75 if (FLAG_trace_functions) { | 73 if (FLAG_trace_functions) { |
| 76 const Function& function = | 74 const Function& function = |
| 77 Function::ZoneHandle(compiler->parsed_function().function().raw()); | 75 Function::ZoneHandle(compiler->parsed_function().function().raw()); |
| 78 __ LoadObject(temp, function); | 76 __ LoadObject(temp, function); |
| 79 __ pushl(result); // Preserve result. | 77 __ pushl(result); // Preserve result. |
| 80 __ pushl(temp); | 78 __ pushl(temp); |
| 81 compiler->GenerateCallRuntime(0, | 79 compiler->GenerateCallRuntime(0, |
| 82 kTraceFunctionExitRuntimeEntry, | 80 kTraceFunctionExitRuntimeEntry, |
| (...skipping 2646 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2729 __ pcmpeqq(XMM0, XMM0); // Generate all 1's. | 2727 __ pcmpeqq(XMM0, XMM0); // Generate all 1's. |
| 2730 __ pxor(value, XMM0); | 2728 __ pxor(value, XMM0); |
| 2731 } | 2729 } |
| 2732 | 2730 |
| 2733 | 2731 |
| 2734 } // namespace dart | 2732 } // namespace dart |
| 2735 | 2733 |
| 2736 #undef __ | 2734 #undef __ |
| 2737 | 2735 |
| 2738 #endif // defined TARGET_ARCH_X64 | 2736 #endif // defined TARGET_ARCH_X64 |
| OLD | NEW |