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

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

Issue 1160973002: Revert 'Revert to use macro REG_MASK_BIT, now with parentheses.' (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 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
« no previous file with comments | « no previous file | no next file » | 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_XXX. 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_XXX.
6 6
7 #include "vm/flow_graph_compiler.h" 7 #include "vm/flow_graph_compiler.h"
8 8
9 #include "vm/bit_vector.h" 9 #include "vm/bit_vector.h"
10 #include "vm/cha.h" 10 #include "vm/cha.h"
(...skipping 1183 matching lines...) Expand 10 before | Expand all | Expand 10 after
1194 if (!blocked_registers[regno]) { 1194 if (!blocked_registers[regno]) {
1195 blocked_registers[regno] = true; 1195 blocked_registers[regno] = true;
1196 return static_cast<Register>(regno); 1196 return static_cast<Register>(regno);
1197 } 1197 }
1198 } 1198 }
1199 UNREACHABLE(); 1199 UNREACHABLE();
1200 return kNoRegister; 1200 return kNoRegister;
1201 } 1201 }
1202 1202
1203 1203
1204 #define REG_MASK_BIT(reg) (((reg) != kNoRegister) ? (1 << (reg)) : 0) 1204 static uword RegMaskBit(Register reg) {
1205 return ((reg) != kNoRegister) ? (1 << (reg)) : 0;
1206 }
1207
1208
1205 // Mask of globally reserved registers. Some other registers are only reserved 1209 // Mask of globally reserved registers. Some other registers are only reserved
1206 // in particular code (e.g., ARGS_DESC_REG in intrinsics). 1210 // in particular code (e.g., ARGS_DESC_REG in intrinsics).
1207 static const uword kReservedCpuRegisters = REG_MASK_BIT(SPREG) 1211 static const uword kReservedCpuRegisters = RegMaskBit(SPREG)
1208 | REG_MASK_BIT(FPREG) 1212 | RegMaskBit(FPREG)
1209 | REG_MASK_BIT(TMP) 1213 | RegMaskBit(TMP)
1210 | REG_MASK_BIT(TMP2) 1214 | RegMaskBit(TMP2)
1211 | REG_MASK_BIT(PP) 1215 | RegMaskBit(PP)
1212 | REG_MASK_BIT(THR); 1216 | RegMaskBit(THR);
1213 1217
1214 1218
1215 void FlowGraphCompiler::AllocateRegistersLocally(Instruction* instr) { 1219 void FlowGraphCompiler::AllocateRegistersLocally(Instruction* instr) {
1216 ASSERT(!is_optimizing()); 1220 ASSERT(!is_optimizing());
1217 1221
1218 instr->InitializeLocationSummary(zone(), 1222 instr->InitializeLocationSummary(zone(),
1219 false); // Not optimizing. 1223 false); // Not optimizing.
1220 LocationSummary* locs = instr->locs(); 1224 LocationSummary* locs = instr->locs();
1221 1225
1222 bool blocked_registers[kNumberOfCpuRegisters]; 1226 bool blocked_registers[kNumberOfCpuRegisters];
(...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after
1509 resolver_->RestoreFpuScratch(reg_); 1513 resolver_->RestoreFpuScratch(reg_);
1510 } 1514 }
1511 } 1515 }
1512 1516
1513 1517
1514 ParallelMoveResolver::ScratchRegisterScope::ScratchRegisterScope( 1518 ParallelMoveResolver::ScratchRegisterScope::ScratchRegisterScope(
1515 ParallelMoveResolver* resolver, Register blocked) 1519 ParallelMoveResolver* resolver, Register blocked)
1516 : resolver_(resolver), 1520 : resolver_(resolver),
1517 reg_(kNoRegister), 1521 reg_(kNoRegister),
1518 spilled_(false) { 1522 spilled_(false) {
1519 uword blocked_mask = REG_MASK_BIT(blocked) | kReservedCpuRegisters; 1523 uword blocked_mask = RegMaskBit(blocked) | kReservedCpuRegisters;
1520 if (resolver->compiler_->intrinsic_mode()) { 1524 if (resolver->compiler_->intrinsic_mode()) {
1521 // Block additional registers that must be preserved for intrinsics. 1525 // Block additional registers that must be preserved for intrinsics.
1522 blocked_mask |= REG_MASK_BIT(ARGS_DESC_REG); 1526 blocked_mask |= RegMaskBit(ARGS_DESC_REG);
1523 } 1527 }
1524 reg_ = static_cast<Register>( 1528 reg_ = static_cast<Register>(
1525 resolver_->AllocateScratchRegister(Location::kRegister, 1529 resolver_->AllocateScratchRegister(Location::kRegister,
1526 blocked_mask, 1530 blocked_mask,
1527 kFirstFreeCpuRegister, 1531 kFirstFreeCpuRegister,
1528 kLastFreeCpuRegister, 1532 kLastFreeCpuRegister,
1529 &spilled_)); 1533 &spilled_));
1530 1534
1531 if (spilled_) { 1535 if (spilled_) {
1532 resolver->SpillScratch(reg_); 1536 resolver->SpillScratch(reg_);
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after
1733 1737
1734 1738
1735 void FlowGraphCompiler::FrameStateClear() { 1739 void FlowGraphCompiler::FrameStateClear() {
1736 ASSERT(!is_optimizing()); 1740 ASSERT(!is_optimizing());
1737 frame_state_.TruncateTo(0); 1741 frame_state_.TruncateTo(0);
1738 } 1742 }
1739 #endif 1743 #endif
1740 1744
1741 1745
1742 } // namespace dart 1746 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698