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

Side by Side Diff: runtime/vm/flow_graph_compiler_arm64.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_arm.cc ('k') | runtime/vm/flow_graph_compiler_ia32.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) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, 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_ARM64. 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_ARM64.
6 #if defined(TARGET_ARCH_ARM64) 6 #if defined(TARGET_ARCH_ARM64)
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 1410 matching lines...) Expand 10 before | Expand all | Expand 10 after
1421 __ CompareRegisters(left, right); 1421 __ CompareRegisters(left, right);
1422 } 1422 }
1423 } 1423 }
1424 1424
1425 1425
1426 // This function must be in sync with FlowGraphCompiler::RecordSafepoint and 1426 // This function must be in sync with FlowGraphCompiler::RecordSafepoint and
1427 // FlowGraphCompiler::SlowPathEnvironmentFor. 1427 // FlowGraphCompiler::SlowPathEnvironmentFor.
1428 void FlowGraphCompiler::SaveLiveRegisters(LocationSummary* locs) { 1428 void FlowGraphCompiler::SaveLiveRegisters(LocationSummary* locs) {
1429 #if defined(DEBUG) 1429 #if defined(DEBUG)
1430 locs->CheckWritableInputs(); 1430 locs->CheckWritableInputs();
1431 ClobberDeadTempRegisters(locs);
1431 #endif 1432 #endif
1432 1433
1433 // TODO(vegorov): consider saving only caller save (volatile) registers. 1434 // TODO(vegorov): consider saving only caller save (volatile) registers.
1434 const intptr_t fpu_regs_count = locs->live_registers()->FpuRegisterCount(); 1435 const intptr_t fpu_regs_count = locs->live_registers()->FpuRegisterCount();
1435 if (fpu_regs_count > 0) { 1436 if (fpu_regs_count > 0) {
1436 // Store fpu registers with the lowest register number at the lowest 1437 // Store fpu registers with the lowest register number at the lowest
1437 // address. 1438 // address.
1438 for (intptr_t reg_idx = kNumberOfVRegisters - 1; 1439 for (intptr_t reg_idx = kNumberOfVRegisters - 1;
1439 reg_idx >= 0; --reg_idx) { 1440 reg_idx >= 0; --reg_idx) {
1440 VRegister fpu_reg = static_cast<VRegister>(reg_idx); 1441 VRegister fpu_reg = static_cast<VRegister>(reg_idx);
1441 if (locs->live_registers()->ContainsFpuRegister(fpu_reg)) { 1442 if (locs->live_registers()->ContainsFpuRegister(fpu_reg)) {
1442 __ PushQuad(fpu_reg); 1443 __ PushQuad(fpu_reg);
1443 } 1444 }
1444 } 1445 }
1445 } 1446 }
1446 1447
1447 // Store general purpose registers with the highest register number at the 1448 // Store general purpose registers with the highest register number at the
1448 // lowest address. The order in which the registers are pushed must match the 1449 // lowest address. The order in which the registers are pushed must match the
1449 // order in which the registers are encoded in the safe point's stack map. 1450 // order in which the registers are encoded in the safe point's stack map.
1450 for (intptr_t reg_idx = 0; reg_idx < kNumberOfCpuRegisters; ++reg_idx) { 1451 for (intptr_t reg_idx = 0; reg_idx < kNumberOfCpuRegisters; ++reg_idx) {
1451 Register reg = static_cast<Register>(reg_idx); 1452 Register reg = static_cast<Register>(reg_idx);
1452 if (locs->live_registers()->ContainsRegister(reg)) { 1453 if (locs->live_registers()->ContainsRegister(reg)) {
1453 __ Push(reg); 1454 __ Push(reg);
1454 } 1455 }
1455 } 1456 }
1456 } 1457 }
1457 1458
1458 1459
1459 void FlowGraphCompiler::RestoreLiveRegisters(LocationSummary* locs) { 1460 void FlowGraphCompiler::RestoreLiveRegisters(LocationSummary* locs) {
1461 #if defined(DEBUG)
1462 ClobberDeadTempRegisters(locs);
1463 #endif
1460 // General purpose registers have the highest register number at the 1464 // General purpose registers have the highest register number at the
1461 // lowest address. 1465 // lowest address.
1462 for (intptr_t reg_idx = kNumberOfCpuRegisters - 1; reg_idx >= 0; --reg_idx) { 1466 for (intptr_t reg_idx = kNumberOfCpuRegisters - 1; reg_idx >= 0; --reg_idx) {
1463 Register reg = static_cast<Register>(reg_idx); 1467 Register reg = static_cast<Register>(reg_idx);
1464 if (locs->live_registers()->ContainsRegister(reg)) { 1468 if (locs->live_registers()->ContainsRegister(reg)) {
1465 __ Pop(reg); 1469 __ Pop(reg);
1466 } 1470 }
1467 } 1471 }
1468 1472
1469 const intptr_t fpu_regs_count = locs->live_registers()->FpuRegisterCount(); 1473 const intptr_t fpu_regs_count = locs->live_registers()->FpuRegisterCount();
1470 if (fpu_regs_count > 0) { 1474 if (fpu_regs_count > 0) {
1471 // Fpu registers have the lowest register number at the lowest address. 1475 // Fpu registers have the lowest register number at the lowest address.
1472 for (intptr_t reg_idx = 0; reg_idx < kNumberOfVRegisters; ++reg_idx) { 1476 for (intptr_t reg_idx = 0; reg_idx < kNumberOfVRegisters; ++reg_idx) {
1473 VRegister fpu_reg = static_cast<VRegister>(reg_idx); 1477 VRegister fpu_reg = static_cast<VRegister>(reg_idx);
1474 if (locs->live_registers()->ContainsFpuRegister(fpu_reg)) { 1478 if (locs->live_registers()->ContainsFpuRegister(fpu_reg)) {
1475 __ PopQuad(fpu_reg); 1479 __ PopQuad(fpu_reg);
1476 } 1480 }
1477 } 1481 }
1478 } 1482 }
1479 } 1483 }
1480 1484
1481 1485
1486 #if defined(DEBUG)
1487 void FlowGraphCompiler::ClobberDeadTempRegisters(LocationSummary* locs) {
1488 // Clobber temporaries that have not been manually preserved.
1489 for (intptr_t i = 0; i < locs->temp_count(); ++i) {
1490 Location tmp = locs->temp(i);
1491 // TODO(zerny): clobber non-live temporary FPU registers.
1492 if (tmp.IsRegister() &&
1493 !locs->live_registers()->ContainsRegister(tmp.reg())) {
1494 __ movz(tmp.reg(), Immediate(0xf7), 0);
1495 }
1496 }
1497 }
1498 #endif
1499
1500
1482 void FlowGraphCompiler::EmitTestAndCall(const ICData& ic_data, 1501 void FlowGraphCompiler::EmitTestAndCall(const ICData& ic_data,
1483 Register class_id_reg, 1502 Register class_id_reg,
1484 intptr_t argument_count, 1503 intptr_t argument_count,
1485 const Array& argument_names, 1504 const Array& argument_names,
1486 Label* deopt, 1505 Label* deopt,
1487 intptr_t deopt_id, 1506 intptr_t deopt_id,
1488 intptr_t token_index, 1507 intptr_t token_index,
1489 LocationSummary* locs) { 1508 LocationSummary* locs) {
1490 ASSERT(is_optimizing()); 1509 ASSERT(is_optimizing());
1491 ASSERT(!ic_data.IsNull() && (ic_data.NumberOfUsedChecks() > 0)); 1510 ASSERT(!ic_data.IsNull() && (ic_data.NumberOfUsedChecks() > 0));
(...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after
1808 void ParallelMoveResolver::RestoreFpuScratch(FpuRegister reg) { 1827 void ParallelMoveResolver::RestoreFpuScratch(FpuRegister reg) {
1809 __ PopDouble(reg); 1828 __ PopDouble(reg);
1810 } 1829 }
1811 1830
1812 1831
1813 #undef __ 1832 #undef __
1814 1833
1815 } // namespace dart 1834 } // namespace dart
1816 1835
1817 #endif // defined TARGET_ARCH_ARM64 1836 #endif // defined TARGET_ARCH_ARM64
OLDNEW
« no previous file with comments | « runtime/vm/flow_graph_compiler_arm.cc ('k') | runtime/vm/flow_graph_compiler_ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698