Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(561)

Side by Side Diff: runtime/vm/flow_graph_compiler_arm.cc

Issue 783103003: Clobber non-live temporaries on some paths involving a possible slow-path allocation. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: unnedded temp saves Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « runtime/vm/flow_graph_compiler.h ('k') | runtime/vm/flow_graph_compiler_arm64.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_ARM. 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_ARM.
6 #if defined(TARGET_ARCH_ARM) 6 #if defined(TARGET_ARCH_ARM)
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 1407 matching lines...) Expand 10 before | Expand all | Expand 10 after
1418 __ cmp(left, Operand(right)); 1418 __ cmp(left, Operand(right));
1419 } 1419 }
1420 } 1420 }
1421 1421
1422 1422
1423 // This function must be in sync with FlowGraphCompiler::RecordSafepoint and 1423 // This function must be in sync with FlowGraphCompiler::RecordSafepoint and
1424 // FlowGraphCompiler::SlowPathEnvironmentFor. 1424 // FlowGraphCompiler::SlowPathEnvironmentFor.
1425 void FlowGraphCompiler::SaveLiveRegisters(LocationSummary* locs) { 1425 void FlowGraphCompiler::SaveLiveRegisters(LocationSummary* locs) {
1426 #if defined(DEBUG) 1426 #if defined(DEBUG)
1427 locs->CheckWritableInputs(); 1427 locs->CheckWritableInputs();
1428 ClobberDeadTempRegisters(locs);
1428 #endif 1429 #endif
1429 1430
1430 // TODO(vegorov): consider saving only caller save (volatile) registers. 1431 // TODO(vegorov): consider saving only caller save (volatile) registers.
1431 const intptr_t fpu_regs_count = locs->live_registers()->FpuRegisterCount(); 1432 const intptr_t fpu_regs_count = locs->live_registers()->FpuRegisterCount();
1432 if (fpu_regs_count > 0) { 1433 if (fpu_regs_count > 0) {
1433 __ AddImmediate(SP, -(fpu_regs_count * kFpuRegisterSize)); 1434 __ AddImmediate(SP, -(fpu_regs_count * kFpuRegisterSize));
1434 // Store fpu registers with the lowest register number at the lowest 1435 // Store fpu registers with the lowest register number at the lowest
1435 // address. 1436 // address.
1436 intptr_t offset = 0; 1437 intptr_t offset = 0;
1437 for (intptr_t reg_idx = 0; reg_idx < kNumberOfFpuRegisters; ++reg_idx) { 1438 for (intptr_t reg_idx = 0; reg_idx < kNumberOfFpuRegisters; ++reg_idx) {
(...skipping 18 matching lines...) Expand all
1456 for (intptr_t reg_idx = 0; reg_idx < kNumberOfCpuRegisters; ++reg_idx) { 1457 for (intptr_t reg_idx = 0; reg_idx < kNumberOfCpuRegisters; ++reg_idx) {
1457 Register reg = static_cast<Register>(reg_idx); 1458 Register reg = static_cast<Register>(reg_idx);
1458 if (locs->live_registers()->ContainsRegister(reg)) { 1459 if (locs->live_registers()->ContainsRegister(reg)) {
1459 __ Push(reg); 1460 __ Push(reg);
1460 } 1461 }
1461 } 1462 }
1462 } 1463 }
1463 1464
1464 1465
1465 void FlowGraphCompiler::RestoreLiveRegisters(LocationSummary* locs) { 1466 void FlowGraphCompiler::RestoreLiveRegisters(LocationSummary* locs) {
1467 #if defined(DEBUG)
1468 ClobberDeadTempRegisters(locs);
1469 #endif
1470
1466 // General purpose registers have the highest register number at the 1471 // General purpose registers have the highest register number at the
1467 // lowest address. 1472 // lowest address.
1468 for (intptr_t reg_idx = kNumberOfCpuRegisters - 1; reg_idx >= 0; --reg_idx) { 1473 for (intptr_t reg_idx = kNumberOfCpuRegisters - 1; reg_idx >= 0; --reg_idx) {
1469 Register reg = static_cast<Register>(reg_idx); 1474 Register reg = static_cast<Register>(reg_idx);
1470 if (locs->live_registers()->ContainsRegister(reg)) { 1475 if (locs->live_registers()->ContainsRegister(reg)) {
1471 __ Pop(reg); 1476 __ Pop(reg);
1472 } 1477 }
1473 } 1478 }
1474 1479
1475 const intptr_t fpu_regs_count = locs->live_registers()->FpuRegisterCount(); 1480 const intptr_t fpu_regs_count = locs->live_registers()->FpuRegisterCount();
(...skipping 10 matching lines...) Expand all
1486 __ vldrd(d2, Address(SP, offset + 2 * kWordSize)); 1491 __ vldrd(d2, Address(SP, offset + 2 * kWordSize));
1487 offset += kFpuRegisterSize; 1492 offset += kFpuRegisterSize;
1488 } 1493 }
1489 } 1494 }
1490 ASSERT(offset == (fpu_regs_count * kFpuRegisterSize)); 1495 ASSERT(offset == (fpu_regs_count * kFpuRegisterSize));
1491 __ AddImmediate(SP, offset); 1496 __ AddImmediate(SP, offset);
1492 } 1497 }
1493 } 1498 }
1494 1499
1495 1500
1501 #if defined(DEBUG)
1502 void FlowGraphCompiler::ClobberDeadTempRegisters(LocationSummary* locs) {
1503 // Clobber temporaries that have not been manually preserved.
1504 for (intptr_t i = 0; i < locs->temp_count(); ++i) {
1505 Location tmp = locs->temp(i);
1506 // TODO(zerny): clobber non-live temporary FPU registers.
1507 if (tmp.IsRegister() &&
1508 !locs->live_registers()->ContainsRegister(tmp.reg())) {
1509 __ mov(tmp.reg(), Operand(0xf7));
1510 }
1511 }
1512 }
1513 #endif
1514
1515
1496 void FlowGraphCompiler::EmitTestAndCall(const ICData& ic_data, 1516 void FlowGraphCompiler::EmitTestAndCall(const ICData& ic_data,
1497 Register class_id_reg, 1517 Register class_id_reg,
1498 intptr_t argument_count, 1518 intptr_t argument_count,
1499 const Array& argument_names, 1519 const Array& argument_names,
1500 Label* deopt, 1520 Label* deopt,
1501 intptr_t deopt_id, 1521 intptr_t deopt_id,
1502 intptr_t token_index, 1522 intptr_t token_index,
1503 LocationSummary* locs) { 1523 LocationSummary* locs) {
1504 ASSERT(is_optimizing()); 1524 ASSERT(is_optimizing());
1505 ASSERT(!ic_data.IsNull() && (ic_data.NumberOfUsedChecks() > 0)); 1525 ASSERT(!ic_data.IsNull() && (ic_data.NumberOfUsedChecks() > 0));
(...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after
1839 DRegister dreg = EvenDRegisterOf(reg); 1859 DRegister dreg = EvenDRegisterOf(reg);
1840 __ vldrd(dreg, Address(SP, kDoubleSize, Address::PostIndex)); 1860 __ vldrd(dreg, Address(SP, kDoubleSize, Address::PostIndex));
1841 } 1861 }
1842 1862
1843 1863
1844 #undef __ 1864 #undef __
1845 1865
1846 } // namespace dart 1866 } // namespace dart
1847 1867
1848 #endif // defined TARGET_ARCH_ARM 1868 #endif // defined TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « runtime/vm/flow_graph_compiler.h ('k') | runtime/vm/flow_graph_compiler_arm64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698