| 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" | 5 #include "vm/globals.h" |
| 6 #if defined(TARGET_ARCH_IA32) | 6 #if defined(TARGET_ARCH_IA32) |
| 7 | 7 |
| 8 #include "vm/assembler.h" | 8 #include "vm/assembler.h" |
| 9 #include "vm/assembler_macros.h" | 9 #include "vm/assembler_macros.h" |
| 10 #include "vm/compiler.h" | 10 #include "vm/compiler.h" |
| (...skipping 1536 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1547 void StubCode::GenerateUsageCounterIncrement(Assembler* assembler, | 1547 void StubCode::GenerateUsageCounterIncrement(Assembler* assembler, |
| 1548 Register ic_reg, | 1548 Register ic_reg, |
| 1549 Register temp_reg) { | 1549 Register temp_reg) { |
| 1550 __ movl(temp_reg, FieldAddress(ic_reg, ICData::function_offset())); | 1550 __ movl(temp_reg, FieldAddress(ic_reg, ICData::function_offset())); |
| 1551 Label is_hot; | 1551 Label is_hot; |
| 1552 if (FlowGraphCompiler::CanOptimize()) { | 1552 if (FlowGraphCompiler::CanOptimize()) { |
| 1553 ASSERT(FLAG_optimization_counter_threshold > 1); | 1553 ASSERT(FLAG_optimization_counter_threshold > 1); |
| 1554 // The usage_counter is always less than FLAG_optimization_counter_threshold | 1554 // The usage_counter is always less than FLAG_optimization_counter_threshold |
| 1555 // except when the function gets optimized. | 1555 // except when the function gets optimized. |
| 1556 __ cmpl(FieldAddress(temp_reg, Function::usage_counter_offset()), | 1556 __ cmpl(FieldAddress(temp_reg, Function::usage_counter_offset()), |
| 1557 Immediate(FLAG_optimization_counter_threshold - 1)); | 1557 Immediate(FLAG_optimization_counter_threshold)); |
| 1558 // Do not increment to equality with threshold, since a counter greater | |
| 1559 // than threshold denotes a function that was already optimized. | |
| 1560 // The equality should be reached only at exit of the method | |
| 1561 // (return instruction). | |
| 1562 __ j(EQUAL, &is_hot, Assembler::kNearJump); | 1558 __ j(EQUAL, &is_hot, Assembler::kNearJump); |
| 1563 // As long as VM has no OSR do not optimize in the middle of the function | 1559 // As long as VM has no OSR do not optimize in the middle of the function |
| 1564 // but only at exit so that we have collected all type feedback before | 1560 // but only at exit so that we have collected all type feedback before |
| 1565 // optimizing. | 1561 // optimizing. |
| 1566 } | 1562 } |
| 1567 __ incl(FieldAddress(temp_reg, Function::usage_counter_offset())); | 1563 __ incl(FieldAddress(temp_reg, Function::usage_counter_offset())); |
| 1568 __ Bind(&is_hot); | 1564 __ Bind(&is_hot); |
| 1569 } | 1565 } |
| 1570 | 1566 |
| 1571 | 1567 |
| (...skipping 496 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2068 __ Drop(4); | 2064 __ Drop(4); |
| 2069 __ LeaveFrame(); | 2065 __ LeaveFrame(); |
| 2070 | 2066 |
| 2071 __ jmp(&compute_result, Assembler::kNearJump); | 2067 __ jmp(&compute_result, Assembler::kNearJump); |
| 2072 } | 2068 } |
| 2073 | 2069 |
| 2074 | 2070 |
| 2075 } // namespace dart | 2071 } // namespace dart |
| 2076 | 2072 |
| 2077 #endif // defined TARGET_ARCH_IA32 | 2073 #endif // defined TARGET_ARCH_IA32 |
| OLD | NEW |