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

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

Issue 317773002: Fix Win64 build of Dart VM. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: add fix for http://dartbug.com/19213 Created 6 years, 6 months 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
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 1439 matching lines...) Expand 10 before | Expand all | Expand 10 after
1450 __ popq(left); 1450 __ popq(left);
1451 } else { 1451 } else {
1452 __ cmpl(left, right); 1452 __ cmpl(left, right);
1453 } 1453 }
1454 } 1454 }
1455 1455
1456 1456
1457 // This function must be in sync with FlowGraphCompiler::RecordSafepoint and 1457 // This function must be in sync with FlowGraphCompiler::RecordSafepoint and
1458 // FlowGraphCompiler::SlowPathEnvironmentFor. 1458 // FlowGraphCompiler::SlowPathEnvironmentFor.
1459 void FlowGraphCompiler::SaveLiveRegisters(LocationSummary* locs) { 1459 void FlowGraphCompiler::SaveLiveRegisters(LocationSummary* locs) {
1460 // TODO(vegorov): consider saving only caller save (volatile) registers. 1460 // TODO(vegorov): avoid saving non-volatile registers.
1461 const intptr_t xmm_regs_count = locs->live_registers()->FpuRegisterCount(); 1461 __ PushRegisters(locs->live_registers()->cpu_registers(),
1462 if (xmm_regs_count > 0) { 1462 locs->live_registers()->fpu_registers());
1463 __ AddImmediate(RSP, Immediate(-xmm_regs_count * kFpuRegisterSize), PP);
1464 // Store XMM registers with the lowest register number at the lowest
1465 // address.
1466 intptr_t offset = 0;
1467 for (intptr_t reg_idx = 0; reg_idx < kNumberOfXmmRegisters; ++reg_idx) {
1468 XmmRegister xmm_reg = static_cast<XmmRegister>(reg_idx);
1469 if (locs->live_registers()->ContainsFpuRegister(xmm_reg)) {
1470 __ movups(Address(RSP, offset), xmm_reg);
1471 offset += kFpuRegisterSize;
1472 }
1473 }
1474 ASSERT(offset == (xmm_regs_count * kFpuRegisterSize));
1475 }
1476
1477 // Store general purpose registers with the highest register number at the
1478 // lowest address.
1479 for (intptr_t reg_idx = 0; reg_idx < kNumberOfCpuRegisters; ++reg_idx) {
1480 Register reg = static_cast<Register>(reg_idx);
1481 if (locs->live_registers()->ContainsRegister(reg)) {
1482 __ pushq(reg);
1483 }
1484 }
1485 } 1463 }
1486 1464
1487 1465
1488 void FlowGraphCompiler::RestoreLiveRegisters(LocationSummary* locs) { 1466 void FlowGraphCompiler::RestoreLiveRegisters(LocationSummary* locs) {
1489 // General purpose registers have the highest register number at the 1467 __ PopRegisters(locs->live_registers()->cpu_registers(),
1490 // lowest address. 1468 locs->live_registers()->fpu_registers());
1491 for (intptr_t reg_idx = kNumberOfCpuRegisters - 1; reg_idx >= 0; --reg_idx) {
1492 Register reg = static_cast<Register>(reg_idx);
1493 if (locs->live_registers()->ContainsRegister(reg)) {
1494 __ popq(reg);
1495 }
1496 }
1497
1498 const intptr_t xmm_regs_count = locs->live_registers()->FpuRegisterCount();
1499 if (xmm_regs_count > 0) {
1500 // XMM registers have the lowest register number at the lowest address.
1501 intptr_t offset = 0;
1502 for (intptr_t reg_idx = 0; reg_idx < kNumberOfXmmRegisters; ++reg_idx) {
1503 XmmRegister xmm_reg = static_cast<XmmRegister>(reg_idx);
1504 if (locs->live_registers()->ContainsFpuRegister(xmm_reg)) {
1505 __ movups(xmm_reg, Address(RSP, offset));
1506 offset += kFpuRegisterSize;
1507 }
1508 }
1509 ASSERT(offset == (xmm_regs_count * kFpuRegisterSize));
1510 __ AddImmediate(RSP, Immediate(offset), PP);
1511 }
1512 } 1469 }
1513 1470
1514 1471
1515 void FlowGraphCompiler::EmitTestAndCall(const ICData& ic_data, 1472 void FlowGraphCompiler::EmitTestAndCall(const ICData& ic_data,
1516 Register class_id_reg, 1473 Register class_id_reg,
1517 intptr_t argument_count, 1474 intptr_t argument_count,
1518 const Array& argument_names, 1475 const Array& argument_names,
1519 Label* deopt, 1476 Label* deopt,
1520 intptr_t deopt_id, 1477 intptr_t deopt_id,
1521 intptr_t token_index, 1478 intptr_t token_index,
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after
1770 __ movups(reg, Address(RSP, 0)); 1727 __ movups(reg, Address(RSP, 0));
1771 __ AddImmediate(RSP, Immediate(kFpuRegisterSize), PP); 1728 __ AddImmediate(RSP, Immediate(kFpuRegisterSize), PP);
1772 } 1729 }
1773 1730
1774 1731
1775 #undef __ 1732 #undef __
1776 1733
1777 } // namespace dart 1734 } // namespace dart
1778 1735
1779 #endif // defined TARGET_ARCH_X64 1736 #endif // defined TARGET_ARCH_X64
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698