| 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_MIPS) | 6 #if defined(TARGET_ARCH_MIPS) |
| 7 | 7 |
| 8 #include "vm/assembler.h" | 8 #include "vm/assembler.h" |
| 9 #include "vm/code_generator.h" | 9 #include "vm/code_generator.h" |
| 10 #include "vm/compiler.h" | 10 #include "vm/compiler.h" |
| (...skipping 1495 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1506 __ sw(S5, Address(SP, 2 * kWordSize)); | 1506 __ sw(S5, Address(SP, 2 * kWordSize)); |
| 1507 __ sw(ic_reg, Address(SP, 1 * kWordSize)); // Argument. | 1507 __ sw(ic_reg, Address(SP, 1 * kWordSize)); // Argument. |
| 1508 __ sw(func_reg, Address(SP, 0 * kWordSize)); // Argument. | 1508 __ sw(func_reg, Address(SP, 0 * kWordSize)); // Argument. |
| 1509 __ CallRuntime(kTraceICCallRuntimeEntry); | 1509 __ CallRuntime(kTraceICCallRuntimeEntry); |
| 1510 __ lw(S5, Address(SP, 2 * kWordSize)); | 1510 __ lw(S5, Address(SP, 2 * kWordSize)); |
| 1511 __ lw(T0, Address(SP, 3 * kWordSize)); | 1511 __ lw(T0, Address(SP, 3 * kWordSize)); |
| 1512 __ addiu(SP, SP, Immediate(4 * kWordSize)); // Discard argument; | 1512 __ addiu(SP, SP, Immediate(4 * kWordSize)); // Discard argument; |
| 1513 __ LeaveStubFrame(); | 1513 __ LeaveStubFrame(); |
| 1514 } | 1514 } |
| 1515 __ lw(T7, FieldAddress(func_reg, Function::usage_counter_offset())); | 1515 __ lw(T7, FieldAddress(func_reg, Function::usage_counter_offset())); |
| 1516 Label is_hot; | |
| 1517 if (FlowGraphCompiler::CanOptimize()) { | |
| 1518 ASSERT(FLAG_optimization_counter_threshold > 1); | |
| 1519 __ BranchSignedGreaterEqual(T7, FLAG_optimization_counter_threshold, | |
| 1520 &is_hot); | |
| 1521 // As long as VM has no OSR do not optimize in the middle of the function | |
| 1522 // but only at exit so that we have collected all type feedback before | |
| 1523 // optimizing. | |
| 1524 } | |
| 1525 __ addiu(T7, T7, Immediate(1)); | 1516 __ addiu(T7, T7, Immediate(1)); |
| 1526 __ sw(T7, FieldAddress(func_reg, Function::usage_counter_offset())); | 1517 __ sw(T7, FieldAddress(func_reg, Function::usage_counter_offset())); |
| 1527 __ Bind(&is_hot); | |
| 1528 } | 1518 } |
| 1529 | 1519 |
| 1530 | 1520 |
| 1531 // Loads function into 'temp_reg'. | 1521 // Loads function into 'temp_reg'. |
| 1532 void StubCode::GenerateUsageCounterIncrement(Assembler* assembler, | 1522 void StubCode::GenerateUsageCounterIncrement(Assembler* assembler, |
| 1533 Register temp_reg) { | 1523 Register temp_reg) { |
| 1534 __ TraceSimMsg("UsageCounterIncrement"); | 1524 __ TraceSimMsg("UsageCounterIncrement"); |
| 1535 Register ic_reg = S5; | 1525 Register ic_reg = S5; |
| 1536 Register func_reg = temp_reg; | 1526 Register func_reg = temp_reg; |
| 1537 ASSERT(temp_reg == T0); | 1527 ASSERT(temp_reg == T0); |
| 1538 __ lw(func_reg, FieldAddress(ic_reg, ICData::function_offset())); | 1528 __ lw(func_reg, FieldAddress(ic_reg, ICData::function_offset())); |
| 1539 __ lw(T1, FieldAddress(func_reg, Function::usage_counter_offset())); | 1529 __ lw(T1, FieldAddress(func_reg, Function::usage_counter_offset())); |
| 1540 Label is_hot; | |
| 1541 if (FlowGraphCompiler::CanOptimize()) { | |
| 1542 ASSERT(FLAG_optimization_counter_threshold > 1); | |
| 1543 // The usage_counter is always less than FLAG_optimization_counter_threshold | |
| 1544 // except when the function gets optimized. | |
| 1545 __ BranchEqual(T1, FLAG_optimization_counter_threshold, &is_hot); | |
| 1546 // As long as VM has no OSR do not optimize in the middle of the function | |
| 1547 // but only at exit so that we have collected all type feedback before | |
| 1548 // optimizing. | |
| 1549 } | |
| 1550 __ addiu(T1, T1, Immediate(1)); | 1530 __ addiu(T1, T1, Immediate(1)); |
| 1551 __ sw(T1, FieldAddress(func_reg, Function::usage_counter_offset())); | 1531 __ sw(T1, FieldAddress(func_reg, Function::usage_counter_offset())); |
| 1552 __ Bind(&is_hot); | |
| 1553 } | 1532 } |
| 1554 | 1533 |
| 1555 | 1534 |
| 1556 // Generate inline cache check for 'num_args'. | 1535 // Generate inline cache check for 'num_args'. |
| 1557 // RA: return address | 1536 // RA: return address |
| 1558 // S5: Inline cache data object. | 1537 // S5: Inline cache data object. |
| 1559 // Control flow: | 1538 // Control flow: |
| 1560 // - If receiver is null -> jump to IC miss. | 1539 // - If receiver is null -> jump to IC miss. |
| 1561 // - If receiver is Smi -> load Smi class. | 1540 // - If receiver is Smi -> load Smi class. |
| 1562 // - If receiver is not-Smi -> load receiver's class. | 1541 // - If receiver is not-Smi -> load receiver's class. |
| (...skipping 831 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2394 __ lw(left, Address(SP, 1 * kWordSize)); | 2373 __ lw(left, Address(SP, 1 * kWordSize)); |
| 2395 __ lw(temp2, Address(SP, 2 * kWordSize)); | 2374 __ lw(temp2, Address(SP, 2 * kWordSize)); |
| 2396 __ lw(temp1, Address(SP, 3 * kWordSize)); | 2375 __ lw(temp1, Address(SP, 3 * kWordSize)); |
| 2397 __ Ret(); | 2376 __ Ret(); |
| 2398 __ delay_slot()->addiu(SP, SP, Immediate(4 * kWordSize)); | 2377 __ delay_slot()->addiu(SP, SP, Immediate(4 * kWordSize)); |
| 2399 } | 2378 } |
| 2400 | 2379 |
| 2401 } // namespace dart | 2380 } // namespace dart |
| 2402 | 2381 |
| 2403 #endif // defined TARGET_ARCH_MIPS | 2382 #endif // defined TARGET_ARCH_MIPS |
| OLD | NEW |