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

Side by Side Diff: runtime/vm/flow_graph_compiler_ia32.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_arm64.cc ('k') | runtime/vm/flow_graph_compiler_mips.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_IA32. 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_IA32.
6 #if defined(TARGET_ARCH_IA32) 6 #if defined(TARGET_ARCH_IA32)
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 1432 matching lines...) Expand 10 before | Expand all | Expand 10 after
1443 __ cmpl(left, right); 1443 __ cmpl(left, right);
1444 } 1444 }
1445 } 1445 }
1446 1446
1447 1447
1448 // This function must be in sync with FlowGraphCompiler::RecordSafepoint and 1448 // This function must be in sync with FlowGraphCompiler::RecordSafepoint and
1449 // FlowGraphCompiler::SlowPathEnvironmentFor. 1449 // FlowGraphCompiler::SlowPathEnvironmentFor.
1450 void FlowGraphCompiler::SaveLiveRegisters(LocationSummary* locs) { 1450 void FlowGraphCompiler::SaveLiveRegisters(LocationSummary* locs) {
1451 #if defined(DEBUG) 1451 #if defined(DEBUG)
1452 locs->CheckWritableInputs(); 1452 locs->CheckWritableInputs();
1453 ClobberDeadTempRegisters(locs);
1453 #endif 1454 #endif
1454 1455
1455 // TODO(vegorov): consider saving only caller save (volatile) registers. 1456 // TODO(vegorov): consider saving only caller save (volatile) registers.
1456 const intptr_t xmm_regs_count = locs->live_registers()->FpuRegisterCount(); 1457 const intptr_t xmm_regs_count = locs->live_registers()->FpuRegisterCount();
1457 if (xmm_regs_count > 0) { 1458 if (xmm_regs_count > 0) {
1458 __ subl(ESP, Immediate(xmm_regs_count * kFpuRegisterSize)); 1459 __ subl(ESP, Immediate(xmm_regs_count * kFpuRegisterSize));
1459 // Store XMM registers with the lowest register number at the lowest 1460 // Store XMM registers with the lowest register number at the lowest
1460 // address. 1461 // address.
1461 intptr_t offset = 0; 1462 intptr_t offset = 0;
1462 for (intptr_t reg_idx = 0; reg_idx < kNumberOfXmmRegisters; ++reg_idx) { 1463 for (intptr_t reg_idx = 0; reg_idx < kNumberOfXmmRegisters; ++reg_idx) {
(...skipping 12 matching lines...) Expand all
1475 for (intptr_t reg_idx = 0; reg_idx < kNumberOfCpuRegisters; ++reg_idx) { 1476 for (intptr_t reg_idx = 0; reg_idx < kNumberOfCpuRegisters; ++reg_idx) {
1476 Register reg = static_cast<Register>(reg_idx); 1477 Register reg = static_cast<Register>(reg_idx);
1477 if (locs->live_registers()->ContainsRegister(reg)) { 1478 if (locs->live_registers()->ContainsRegister(reg)) {
1478 __ pushl(reg); 1479 __ pushl(reg);
1479 } 1480 }
1480 } 1481 }
1481 } 1482 }
1482 1483
1483 1484
1484 void FlowGraphCompiler::RestoreLiveRegisters(LocationSummary* locs) { 1485 void FlowGraphCompiler::RestoreLiveRegisters(LocationSummary* locs) {
1486 #if defined(DEBUG)
1487 ClobberDeadTempRegisters(locs);
1488 #endif
1489
1485 // General purpose registers have the highest register number at the 1490 // General purpose registers have the highest register number at the
1486 // lowest address. 1491 // lowest address.
1487 for (intptr_t reg_idx = kNumberOfCpuRegisters - 1; reg_idx >= 0; --reg_idx) { 1492 for (intptr_t reg_idx = kNumberOfCpuRegisters - 1; reg_idx >= 0; --reg_idx) {
1488 Register reg = static_cast<Register>(reg_idx); 1493 Register reg = static_cast<Register>(reg_idx);
1489 if (locs->live_registers()->ContainsRegister(reg)) { 1494 if (locs->live_registers()->ContainsRegister(reg)) {
1490 __ popl(reg); 1495 __ popl(reg);
1491 } 1496 }
1492 } 1497 }
1493 1498
1494 const intptr_t xmm_regs_count = locs->live_registers()->FpuRegisterCount(); 1499 const intptr_t xmm_regs_count = locs->live_registers()->FpuRegisterCount();
1495 if (xmm_regs_count > 0) { 1500 if (xmm_regs_count > 0) {
1496 // XMM registers have the lowest register number at the lowest address. 1501 // XMM registers have the lowest register number at the lowest address.
1497 intptr_t offset = 0; 1502 intptr_t offset = 0;
1498 for (intptr_t reg_idx = 0; reg_idx < kNumberOfXmmRegisters; ++reg_idx) { 1503 for (intptr_t reg_idx = 0; reg_idx < kNumberOfXmmRegisters; ++reg_idx) {
1499 XmmRegister xmm_reg = static_cast<XmmRegister>(reg_idx); 1504 XmmRegister xmm_reg = static_cast<XmmRegister>(reg_idx);
1500 if (locs->live_registers()->ContainsFpuRegister(xmm_reg)) { 1505 if (locs->live_registers()->ContainsFpuRegister(xmm_reg)) {
1501 __ movups(xmm_reg, Address(ESP, offset)); 1506 __ movups(xmm_reg, Address(ESP, offset));
1502 offset += kFpuRegisterSize; 1507 offset += kFpuRegisterSize;
1503 } 1508 }
1504 } 1509 }
1505 ASSERT(offset == (xmm_regs_count * kFpuRegisterSize)); 1510 ASSERT(offset == (xmm_regs_count * kFpuRegisterSize));
1506 __ addl(ESP, Immediate(offset)); 1511 __ addl(ESP, Immediate(offset));
1507 } 1512 }
1508 } 1513 }
1509 1514
1510 1515
1516 #if defined(DEBUG)
1517 void FlowGraphCompiler::ClobberDeadTempRegisters(LocationSummary* locs) {
1518 // Clobber temporaries that have not been manually preserved.
1519 for (intptr_t i = 0; i < locs->temp_count(); ++i) {
1520 Location tmp = locs->temp(i);
1521 // TODO(zerny): clobber non-live temporary FPU registers.
1522 if (tmp.IsRegister() &&
1523 !locs->live_registers()->ContainsRegister(tmp.reg())) {
1524 __ movl(tmp.reg(), Immediate(0xf7));
1525 }
1526 }
1527 }
1528 #endif
1529
1530
1511 void FlowGraphCompiler::EmitTestAndCall(const ICData& ic_data, 1531 void FlowGraphCompiler::EmitTestAndCall(const ICData& ic_data,
1512 Register class_id_reg, 1532 Register class_id_reg,
1513 intptr_t argument_count, 1533 intptr_t argument_count,
1514 const Array& argument_names, 1534 const Array& argument_names,
1515 Label* deopt, 1535 Label* deopt,
1516 intptr_t deopt_id, 1536 intptr_t deopt_id,
1517 intptr_t token_index, 1537 intptr_t token_index,
1518 LocationSummary* locs) { 1538 LocationSummary* locs) {
1519 ASSERT(is_optimizing()); 1539 ASSERT(is_optimizing());
1520 ASSERT(!ic_data.IsNull() && (ic_data.NumberOfUsedChecks() > 0)); 1540 ASSERT(!ic_data.IsNull() && (ic_data.NumberOfUsedChecks() > 0));
(...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after
1818 __ movups(reg, Address(ESP, 0)); 1838 __ movups(reg, Address(ESP, 0));
1819 __ addl(ESP, Immediate(kFpuRegisterSize)); 1839 __ addl(ESP, Immediate(kFpuRegisterSize));
1820 } 1840 }
1821 1841
1822 1842
1823 #undef __ 1843 #undef __
1824 1844
1825 } // namespace dart 1845 } // namespace dart
1826 1846
1827 #endif // defined TARGET_ARCH_IA32 1847 #endif // defined TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « runtime/vm/flow_graph_compiler_arm64.cc ('k') | runtime/vm/flow_graph_compiler_mips.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698