| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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/compiler.h" | 9 #include "vm/compiler.h" |
| 10 #include "vm/dart_entry.h" | 10 #include "vm/dart_entry.h" |
| (...skipping 1417 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1428 __ pushl(ic_reg); // Argument. | 1428 __ pushl(ic_reg); // Argument. |
| 1429 __ pushl(func_reg); // Argument. | 1429 __ pushl(func_reg); // Argument. |
| 1430 __ CallRuntime(kTraceICCallRuntimeEntry); | 1430 __ CallRuntime(kTraceICCallRuntimeEntry); |
| 1431 __ popl(EAX); // Discard argument; | 1431 __ popl(EAX); // Discard argument; |
| 1432 __ popl(EAX); // Discard argument; | 1432 __ popl(EAX); // Discard argument; |
| 1433 __ popl(ic_reg); // Restore. | 1433 __ popl(ic_reg); // Restore. |
| 1434 __ popl(argdesc_reg); // Restore. | 1434 __ popl(argdesc_reg); // Restore. |
| 1435 __ popl(func_reg); // Restore. | 1435 __ popl(func_reg); // Restore. |
| 1436 __ LeaveFrame(); | 1436 __ LeaveFrame(); |
| 1437 } | 1437 } |
| 1438 Label is_hot; | |
| 1439 if (FlowGraphCompiler::CanOptimize()) { | |
| 1440 ASSERT(FLAG_optimization_counter_threshold > 1); | |
| 1441 __ cmpl(FieldAddress(func_reg, Function::usage_counter_offset()), | |
| 1442 Immediate(FLAG_optimization_counter_threshold)); | |
| 1443 __ j(GREATER_EQUAL, &is_hot, Assembler::kNearJump); | |
| 1444 // As long as VM has no OSR do not optimize in the middle of the function | |
| 1445 // but only at exit so that we have collected all type feedback before | |
| 1446 // optimizing. | |
| 1447 } | |
| 1448 __ incl(FieldAddress(func_reg, Function::usage_counter_offset())); | 1438 __ incl(FieldAddress(func_reg, Function::usage_counter_offset())); |
| 1449 __ Bind(&is_hot); | |
| 1450 } | 1439 } |
| 1451 | 1440 |
| 1452 | 1441 |
| 1453 | |
| 1454 // Loads function into 'temp_reg'. | 1442 // Loads function into 'temp_reg'. |
| 1455 void StubCode::GenerateUsageCounterIncrement(Assembler* assembler, | 1443 void StubCode::GenerateUsageCounterIncrement(Assembler* assembler, |
| 1456 Register temp_reg) { | 1444 Register temp_reg) { |
| 1457 Register ic_reg = ECX; | 1445 Register ic_reg = ECX; |
| 1458 Register func_reg = temp_reg; | 1446 Register func_reg = temp_reg; |
| 1459 ASSERT(ic_reg != func_reg); | 1447 ASSERT(ic_reg != func_reg); |
| 1460 __ movl(func_reg, FieldAddress(ic_reg, ICData::function_offset())); | 1448 __ movl(func_reg, FieldAddress(ic_reg, ICData::function_offset())); |
| 1461 Label is_hot; | |
| 1462 if (FlowGraphCompiler::CanOptimize()) { | |
| 1463 ASSERT(FLAG_optimization_counter_threshold > 1); | |
| 1464 // The usage_counter is always less than FLAG_optimization_counter_threshold | |
| 1465 // except when the function gets optimized. | |
| 1466 __ cmpl(FieldAddress(func_reg, Function::usage_counter_offset()), | |
| 1467 Immediate(FLAG_optimization_counter_threshold)); | |
| 1468 __ j(EQUAL, &is_hot, Assembler::kNearJump); | |
| 1469 // As long as VM has no OSR do not optimize in the middle of the function | |
| 1470 // but only at exit so that we have collected all type feedback before | |
| 1471 // optimizing. | |
| 1472 } | |
| 1473 __ incl(FieldAddress(func_reg, Function::usage_counter_offset())); | 1449 __ incl(FieldAddress(func_reg, Function::usage_counter_offset())); |
| 1474 __ Bind(&is_hot); | |
| 1475 } | 1450 } |
| 1476 | 1451 |
| 1477 | 1452 |
| 1478 // Generate inline cache check for 'num_args'. | 1453 // Generate inline cache check for 'num_args'. |
| 1479 // ECX: Inline cache data object. | 1454 // ECX: Inline cache data object. |
| 1480 // EDX: Arguments descriptor array. | 1455 // EDX: Arguments descriptor array. |
| 1481 // TOS(0): return address | 1456 // TOS(0): return address |
| 1482 // Control flow: | 1457 // Control flow: |
| 1483 // - If receiver is null -> jump to IC miss. | 1458 // - If receiver is null -> jump to IC miss. |
| 1484 // - If receiver is Smi -> load Smi class. | 1459 // - If receiver is Smi -> load Smi class. |
| (...skipping 662 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2147 __ Bind(&done); | 2122 __ Bind(&done); |
| 2148 __ popl(temp); | 2123 __ popl(temp); |
| 2149 __ popl(right); | 2124 __ popl(right); |
| 2150 __ popl(left); | 2125 __ popl(left); |
| 2151 __ ret(); | 2126 __ ret(); |
| 2152 } | 2127 } |
| 2153 | 2128 |
| 2154 } // namespace dart | 2129 } // namespace dart |
| 2155 | 2130 |
| 2156 #endif // defined TARGET_ARCH_IA32 | 2131 #endif // defined TARGET_ARCH_IA32 |
| OLD | NEW |