OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/compiler/instruction-selector.h" | 5 #include "src/compiler/instruction-selector.h" |
6 | 6 |
7 #include <limits> | 7 #include <limits> |
8 | 8 |
9 #include "src/assembler-inl.h" | 9 #include "src/assembler-inl.h" |
10 #include "src/base/adapters.h" | 10 #include "src/base/adapters.h" |
(...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
295 if (next == InstructionOperand::kInvalidVirtualRegister) { | 295 if (next == InstructionOperand::kInvalidVirtualRegister) { |
296 break; | 296 break; |
297 } | 297 } |
298 rename = next; | 298 rename = next; |
299 } | 299 } |
300 return rename; | 300 return rename; |
301 } | 301 } |
302 | 302 |
303 void InstructionSelector::TryRename(InstructionOperand* op) { | 303 void InstructionSelector::TryRename(InstructionOperand* op) { |
304 if (!op->IsUnallocated()) return; | 304 if (!op->IsUnallocated()) return; |
305 int vreg = UnallocatedOperand::cast(op)->virtual_register(); | 305 UnallocatedOperand* unalloc = UnallocatedOperand::cast(op); |
| 306 int vreg = unalloc->virtual_register(); |
306 int rename = GetRename(vreg); | 307 int rename = GetRename(vreg); |
307 if (rename != vreg) { | 308 if (rename != vreg) { |
308 UnallocatedOperand::cast(op)->set_virtual_register(rename); | 309 *unalloc = UnallocatedOperand(*unalloc, rename); |
309 } | 310 } |
310 } | 311 } |
311 | 312 |
312 void InstructionSelector::SetRename(const Node* node, const Node* rename) { | 313 void InstructionSelector::SetRename(const Node* node, const Node* rename) { |
313 int vreg = GetVirtualRegister(node); | 314 int vreg = GetVirtualRegister(node); |
314 if (static_cast<size_t>(vreg) >= virtual_register_rename_.size()) { | 315 if (static_cast<size_t>(vreg) >= virtual_register_rename_.size()) { |
315 int invalid = InstructionOperand::kInvalidVirtualRegister; | 316 int invalid = InstructionOperand::kInvalidVirtualRegister; |
316 virtual_register_rename_.resize(vreg + 1, invalid); | 317 virtual_register_rename_.resize(vreg + 1, invalid); |
317 } | 318 } |
318 virtual_register_rename_[vreg] = GetVirtualRegister(rename); | 319 virtual_register_rename_[vreg] = GetVirtualRegister(rename); |
(...skipping 2535 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2854 return new (instruction_zone()) FrameStateDescriptor( | 2855 return new (instruction_zone()) FrameStateDescriptor( |
2855 instruction_zone(), state_info.type(), state_info.bailout_id(), | 2856 instruction_zone(), state_info.type(), state_info.bailout_id(), |
2856 state_info.state_combine(), parameters, locals, stack, | 2857 state_info.state_combine(), parameters, locals, stack, |
2857 state_info.shared_info(), outer_state); | 2858 state_info.shared_info(), outer_state); |
2858 } | 2859 } |
2859 | 2860 |
2860 | 2861 |
2861 } // namespace compiler | 2862 } // namespace compiler |
2862 } // namespace internal | 2863 } // namespace internal |
2863 } // namespace v8 | 2864 } // namespace v8 |
OLD | NEW |