| 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_X64) | 6 #if defined(TARGET_ARCH_X64) |
| 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 1516 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1527 void StubCode::GenerateUsageCounterIncrement(Assembler* assembler, | 1527 void StubCode::GenerateUsageCounterIncrement(Assembler* assembler, |
| 1528 Register ic_reg, | 1528 Register ic_reg, |
| 1529 Register temp_reg) { | 1529 Register temp_reg) { |
| 1530 __ movq(temp_reg, FieldAddress(ic_reg, ICData::function_offset())); | 1530 __ movq(temp_reg, FieldAddress(ic_reg, ICData::function_offset())); |
| 1531 Label is_hot; | 1531 Label is_hot; |
| 1532 if (FlowGraphCompiler::CanOptimize()) { | 1532 if (FlowGraphCompiler::CanOptimize()) { |
| 1533 ASSERT(FLAG_optimization_counter_threshold > 1); | 1533 ASSERT(FLAG_optimization_counter_threshold > 1); |
| 1534 // The usage_counter is always less than FLAG_optimization_counter_threshold | 1534 // The usage_counter is always less than FLAG_optimization_counter_threshold |
| 1535 // except when the function gets optimized. | 1535 // except when the function gets optimized. |
| 1536 __ cmpq(FieldAddress(temp_reg, Function::usage_counter_offset()), | 1536 __ cmpq(FieldAddress(temp_reg, Function::usage_counter_offset()), |
| 1537 Immediate(FLAG_optimization_counter_threshold - 1)); | 1537 Immediate(FLAG_optimization_counter_threshold)); |
| 1538 // Do not increment to equality with threshold, since a counter greater | |
| 1539 // than threshold denotes a function that was already optimized. | |
| 1540 // The equality should be reached only at exit of the method | |
| 1541 // (return instruction). | |
| 1542 __ j(EQUAL, &is_hot, Assembler::kNearJump); | 1538 __ j(EQUAL, &is_hot, Assembler::kNearJump); |
| 1543 // As long as VM has no OSR do not optimize in the middle of the function | 1539 // As long as VM has no OSR do not optimize in the middle of the function |
| 1544 // but only at exit so that we have collected all type feedback before | 1540 // but only at exit so that we have collected all type feedback before |
| 1545 // optimizing. | 1541 // optimizing. |
| 1546 } | 1542 } |
| 1547 __ incq(FieldAddress(temp_reg, Function::usage_counter_offset())); | 1543 __ incq(FieldAddress(temp_reg, Function::usage_counter_offset())); |
| 1548 __ Bind(&is_hot); | 1544 __ Bind(&is_hot); |
| 1549 } | 1545 } |
| 1550 | 1546 |
| 1551 // Generate inline cache check for 'num_args'. | 1547 // Generate inline cache check for 'num_args'. |
| (...skipping 477 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2029 __ CallRuntime(kUpdateICDataTwoArgsRuntimeEntry); | 2025 __ CallRuntime(kUpdateICDataTwoArgsRuntimeEntry); |
| 2030 __ Drop(4); | 2026 __ Drop(4); |
| 2031 __ LeaveFrame(); | 2027 __ LeaveFrame(); |
| 2032 | 2028 |
| 2033 __ jmp(&compute_result, Assembler::kNearJump); | 2029 __ jmp(&compute_result, Assembler::kNearJump); |
| 2034 } | 2030 } |
| 2035 | 2031 |
| 2036 } // namespace dart | 2032 } // namespace dart |
| 2037 | 2033 |
| 2038 #endif // defined TARGET_ARCH_X64 | 2034 #endif // defined TARGET_ARCH_X64 |
| OLD | NEW |