| 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" // Needed here to get TARGET_ARCH_MIPS. | 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_MIPS. |
| 6 #if defined(TARGET_ARCH_MIPS) | 6 #if defined(TARGET_ARCH_MIPS) |
| 7 | 7 |
| 8 #include "vm/flow_graph_compiler.h" | 8 #include "vm/flow_graph_compiler.h" |
| 9 | 9 |
| 10 #include "vm/ast_printer.h" | 10 #include "vm/ast_printer.h" |
| (...skipping 1452 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1463 __ slt(CMPRES2, right, left); | 1463 __ slt(CMPRES2, right, left); |
| 1464 } | 1464 } |
| 1465 } | 1465 } |
| 1466 | 1466 |
| 1467 | 1467 |
| 1468 // This function must be in sync with FlowGraphCompiler::RecordSafepoint and | 1468 // This function must be in sync with FlowGraphCompiler::RecordSafepoint and |
| 1469 // FlowGraphCompiler::SlowPathEnvironmentFor. | 1469 // FlowGraphCompiler::SlowPathEnvironmentFor. |
| 1470 void FlowGraphCompiler::SaveLiveRegisters(LocationSummary* locs) { | 1470 void FlowGraphCompiler::SaveLiveRegisters(LocationSummary* locs) { |
| 1471 #if defined(DEBUG) | 1471 #if defined(DEBUG) |
| 1472 locs->CheckWritableInputs(); | 1472 locs->CheckWritableInputs(); |
| 1473 ClobberDeadTempRegisters(locs); |
| 1473 #endif | 1474 #endif |
| 1474 | 1475 |
| 1475 __ TraceSimMsg("SaveLiveRegisters"); | 1476 __ TraceSimMsg("SaveLiveRegisters"); |
| 1476 // TODO(vegorov): consider saving only caller save (volatile) registers. | 1477 // TODO(vegorov): consider saving only caller save (volatile) registers. |
| 1477 const intptr_t fpu_regs_count= locs->live_registers()->FpuRegisterCount(); | 1478 const intptr_t fpu_regs_count= locs->live_registers()->FpuRegisterCount(); |
| 1478 if (fpu_regs_count > 0) { | 1479 if (fpu_regs_count > 0) { |
| 1479 __ AddImmediate(SP, -(fpu_regs_count * kFpuRegisterSize)); | 1480 __ AddImmediate(SP, -(fpu_regs_count * kFpuRegisterSize)); |
| 1480 // Store fpu registers with the lowest register number at the lowest | 1481 // Store fpu registers with the lowest register number at the lowest |
| 1481 // address. | 1482 // address. |
| 1482 intptr_t offset = 0; | 1483 intptr_t offset = 0; |
| (...skipping 22 matching lines...) Expand all Loading... |
| 1505 offset -= kWordSize; | 1506 offset -= kWordSize; |
| 1506 __ sw(r, Address(SP, offset)); | 1507 __ sw(r, Address(SP, offset)); |
| 1507 } | 1508 } |
| 1508 } | 1509 } |
| 1509 ASSERT(offset == 0); | 1510 ASSERT(offset == 0); |
| 1510 } | 1511 } |
| 1511 } | 1512 } |
| 1512 | 1513 |
| 1513 | 1514 |
| 1514 void FlowGraphCompiler::RestoreLiveRegisters(LocationSummary* locs) { | 1515 void FlowGraphCompiler::RestoreLiveRegisters(LocationSummary* locs) { |
| 1516 #if defined(DEBUG) |
| 1517 ClobberDeadTempRegisters(locs); |
| 1518 #endif |
| 1515 // General purpose registers have the highest register number at the | 1519 // General purpose registers have the highest register number at the |
| 1516 // lowest address. | 1520 // lowest address. |
| 1517 __ TraceSimMsg("RestoreLiveRegisters"); | 1521 __ TraceSimMsg("RestoreLiveRegisters"); |
| 1518 const intptr_t cpu_registers = locs->live_registers()->cpu_registers(); | 1522 const intptr_t cpu_registers = locs->live_registers()->cpu_registers(); |
| 1519 ASSERT((cpu_registers & ~kAllCpuRegistersList) == 0); | 1523 ASSERT((cpu_registers & ~kAllCpuRegistersList) == 0); |
| 1520 const int register_count = Utils::CountOneBits(cpu_registers); | 1524 const int register_count = Utils::CountOneBits(cpu_registers); |
| 1521 if (register_count > 0) { | 1525 if (register_count > 0) { |
| 1522 intptr_t offset = register_count * kWordSize; | 1526 intptr_t offset = register_count * kWordSize; |
| 1523 for (int i = 0; i < kNumberOfCpuRegisters; i++) { | 1527 for (int i = 0; i < kNumberOfCpuRegisters; i++) { |
| 1524 Register r = static_cast<Register>(i); | 1528 Register r = static_cast<Register>(i); |
| (...skipping 16 matching lines...) Expand all Loading... |
| 1541 __ LoadDFromOffset(fpu_reg, SP, offset); | 1545 __ LoadDFromOffset(fpu_reg, SP, offset); |
| 1542 offset += kFpuRegisterSize; | 1546 offset += kFpuRegisterSize; |
| 1543 } | 1547 } |
| 1544 } | 1548 } |
| 1545 ASSERT(offset == (fpu_regs_count * kFpuRegisterSize)); | 1549 ASSERT(offset == (fpu_regs_count * kFpuRegisterSize)); |
| 1546 __ AddImmediate(SP, offset); | 1550 __ AddImmediate(SP, offset); |
| 1547 } | 1551 } |
| 1548 } | 1552 } |
| 1549 | 1553 |
| 1550 | 1554 |
| 1555 #if defined(DEBUG) |
| 1556 void FlowGraphCompiler::ClobberDeadTempRegisters(LocationSummary* locs) { |
| 1557 // Clobber temporaries that have not been manually preserved. |
| 1558 for (intptr_t i = 0; i < locs->temp_count(); ++i) { |
| 1559 Location tmp = locs->temp(i); |
| 1560 // TODO(zerny): clobber non-live temporary FPU registers. |
| 1561 if (tmp.IsRegister() && |
| 1562 !locs->live_registers()->ContainsRegister(tmp.reg())) { |
| 1563 __ LoadImmediate(tmp.reg(), 0xf7); |
| 1564 } |
| 1565 } |
| 1566 } |
| 1567 #endif |
| 1568 |
| 1569 |
| 1551 void FlowGraphCompiler::EmitTestAndCall(const ICData& ic_data, | 1570 void FlowGraphCompiler::EmitTestAndCall(const ICData& ic_data, |
| 1552 Register class_id_reg, | 1571 Register class_id_reg, |
| 1553 intptr_t argument_count, | 1572 intptr_t argument_count, |
| 1554 const Array& argument_names, | 1573 const Array& argument_names, |
| 1555 Label* deopt, | 1574 Label* deopt, |
| 1556 intptr_t deopt_id, | 1575 intptr_t deopt_id, |
| 1557 intptr_t token_index, | 1576 intptr_t token_index, |
| 1558 LocationSummary* locs) { | 1577 LocationSummary* locs) { |
| 1559 ASSERT(is_optimizing()); | 1578 ASSERT(is_optimizing()); |
| 1560 ASSERT(!ic_data.IsNull() && (ic_data.NumberOfUsedChecks() > 0)); | 1579 ASSERT(!ic_data.IsNull() && (ic_data.NumberOfUsedChecks() > 0)); |
| (...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1837 __ AddImmediate(SP, kDoubleSize); | 1856 __ AddImmediate(SP, kDoubleSize); |
| 1838 } | 1857 } |
| 1839 | 1858 |
| 1840 | 1859 |
| 1841 #undef __ | 1860 #undef __ |
| 1842 | 1861 |
| 1843 | 1862 |
| 1844 } // namespace dart | 1863 } // namespace dart |
| 1845 | 1864 |
| 1846 #endif // defined TARGET_ARCH_MIPS | 1865 #endif // defined TARGET_ARCH_MIPS |
| OLD | NEW |