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/linkage.h" | 5 #include "src/compiler/linkage.h" |
6 #include "src/compiler/register-allocator.h" | 6 #include "src/compiler/register-allocator.h" |
7 #include "src/string-stream.h" | 7 #include "src/string-stream.h" |
8 | 8 |
9 namespace v8 { | 9 namespace v8 { |
10 namespace internal { | 10 namespace internal { |
(...skipping 2371 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2382 | 2382 |
2383 | 2383 |
2384 LiveRange* RegisterAllocator::SplitRangeAt(LiveRange* range, | 2384 LiveRange* RegisterAllocator::SplitRangeAt(LiveRange* range, |
2385 LifetimePosition pos) { | 2385 LifetimePosition pos) { |
2386 DCHECK(!range->IsFixed()); | 2386 DCHECK(!range->IsFixed()); |
2387 TraceAlloc("Splitting live range %d at %d\n", range->id(), pos.Value()); | 2387 TraceAlloc("Splitting live range %d at %d\n", range->id(), pos.Value()); |
2388 | 2388 |
2389 if (pos.Value() <= range->Start().Value()) return range; | 2389 if (pos.Value() <= range->Start().Value()) return range; |
2390 | 2390 |
2391 // We can't properly connect liveranges if split occured at the end | 2391 // We can't properly connect liveranges if split occured at the end |
2392 // a block. | 2392 // of control instruction. |
2393 DCHECK(pos.IsInstructionStart() || | 2393 DCHECK(pos.IsInstructionStart() || |
2394 code() | 2394 !InstructionAt(pos.InstructionIndex())->IsControl()); |
2395 ->GetInstructionBlock(pos.InstructionIndex()) | |
2396 ->last_instruction_index() != pos.InstructionIndex()); | |
2397 | 2395 |
2398 int vreg = GetVirtualRegister(); | 2396 int vreg = GetVirtualRegister(); |
2399 if (!AllocationOk()) return nullptr; | 2397 if (!AllocationOk()) return nullptr; |
2400 auto result = LiveRangeFor(vreg); | 2398 auto result = LiveRangeFor(vreg); |
2401 range->SplitAt(pos, result, local_zone()); | 2399 range->SplitAt(pos, result, local_zone()); |
2402 return result; | 2400 return result; |
2403 } | 2401 } |
2404 | 2402 |
2405 | 2403 |
2406 LiveRange* RegisterAllocator::SplitBetween(LiveRange* range, | 2404 LiveRange* RegisterAllocator::SplitBetween(LiveRange* range, |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2546 } else { | 2544 } else { |
2547 DCHECK(range->Kind() == GENERAL_REGISTERS); | 2545 DCHECK(range->Kind() == GENERAL_REGISTERS); |
2548 assigned_registers_->Add(reg); | 2546 assigned_registers_->Add(reg); |
2549 } | 2547 } |
2550 range->set_assigned_register(reg, code_zone()); | 2548 range->set_assigned_register(reg, code_zone()); |
2551 } | 2549 } |
2552 | 2550 |
2553 } // namespace compiler | 2551 } // namespace compiler |
2554 } // namespace internal | 2552 } // namespace internal |
2555 } // namespace v8 | 2553 } // namespace v8 |
OLD | NEW |