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

Side by Side Diff: runtime/vm/flow_graph_compiler_x64.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_mips.cc ('k') | runtime/vm/intermediate_language_arm.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_X64. 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_X64.
6 #if defined(TARGET_ARCH_X64) 6 #if defined(TARGET_ARCH_X64)
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 1474 matching lines...) Expand 10 before | Expand all | Expand 10 after
1485 __ cmpl(left, right); 1485 __ cmpl(left, right);
1486 } 1486 }
1487 } 1487 }
1488 1488
1489 1489
1490 // This function must be in sync with FlowGraphCompiler::RecordSafepoint and 1490 // This function must be in sync with FlowGraphCompiler::RecordSafepoint and
1491 // FlowGraphCompiler::SlowPathEnvironmentFor. 1491 // FlowGraphCompiler::SlowPathEnvironmentFor.
1492 void FlowGraphCompiler::SaveLiveRegisters(LocationSummary* locs) { 1492 void FlowGraphCompiler::SaveLiveRegisters(LocationSummary* locs) {
1493 #if defined(DEBUG) 1493 #if defined(DEBUG)
1494 locs->CheckWritableInputs(); 1494 locs->CheckWritableInputs();
1495 ClobberDeadTempRegisters(locs);
1495 #endif 1496 #endif
1496 1497
1497 // TODO(vegorov): avoid saving non-volatile registers. 1498 // TODO(vegorov): avoid saving non-volatile registers.
1498 __ PushRegisters(locs->live_registers()->cpu_registers(), 1499 __ PushRegisters(locs->live_registers()->cpu_registers(),
1499 locs->live_registers()->fpu_registers()); 1500 locs->live_registers()->fpu_registers());
1500 } 1501 }
1501 1502
1502 1503
1503 void FlowGraphCompiler::RestoreLiveRegisters(LocationSummary* locs) { 1504 void FlowGraphCompiler::RestoreLiveRegisters(LocationSummary* locs) {
1505 #if defined(DEBUG)
1506 ClobberDeadTempRegisters(locs);
1507 #endif
1504 __ PopRegisters(locs->live_registers()->cpu_registers(), 1508 __ PopRegisters(locs->live_registers()->cpu_registers(),
1505 locs->live_registers()->fpu_registers()); 1509 locs->live_registers()->fpu_registers());
1506 } 1510 }
1507 1511
1508 1512
1513 #if defined(DEBUG)
1514 void FlowGraphCompiler::ClobberDeadTempRegisters(LocationSummary* locs) {
1515 // Clobber temporaries that have not been manually preserved.
1516 for (intptr_t i = 0; i < locs->temp_count(); ++i) {
1517 Location tmp = locs->temp(i);
1518 // TODO(zerny): clobber non-live temporary FPU registers.
1519 if (tmp.IsRegister() &&
1520 !locs->live_registers()->ContainsRegister(tmp.reg())) {
1521 __ movq(tmp.reg(), Immediate(0xf7));
1522 }
1523 }
1524 }
1525 #endif
1526
1527
1509 void FlowGraphCompiler::EmitTestAndCall(const ICData& ic_data, 1528 void FlowGraphCompiler::EmitTestAndCall(const ICData& ic_data,
1510 Register class_id_reg, 1529 Register class_id_reg,
1511 intptr_t argument_count, 1530 intptr_t argument_count,
1512 const Array& argument_names, 1531 const Array& argument_names,
1513 Label* deopt, 1532 Label* deopt,
1514 intptr_t deopt_id, 1533 intptr_t deopt_id,
1515 intptr_t token_index, 1534 intptr_t token_index,
1516 LocationSummary* locs) { 1535 LocationSummary* locs) {
1517 ASSERT(is_optimizing()); 1536 ASSERT(is_optimizing());
1518 ASSERT(!ic_data.IsNull() && (ic_data.NumberOfUsedChecks() > 0)); 1537 ASSERT(!ic_data.IsNull() && (ic_data.NumberOfUsedChecks() > 0));
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after
1787 __ movups(reg, Address(RSP, 0)); 1806 __ movups(reg, Address(RSP, 0));
1788 __ AddImmediate(RSP, Immediate(kFpuRegisterSize), PP); 1807 __ AddImmediate(RSP, Immediate(kFpuRegisterSize), PP);
1789 } 1808 }
1790 1809
1791 1810
1792 #undef __ 1811 #undef __
1793 1812
1794 } // namespace dart 1813 } // namespace dart
1795 1814
1796 #endif // defined TARGET_ARCH_X64 1815 #endif // defined TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « runtime/vm/flow_graph_compiler_mips.cc ('k') | runtime/vm/intermediate_language_arm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698