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/base/adapters.h" | 5 #include "src/base/adapters.h" |
6 #include "src/compiler/linkage.h" | 6 #include "src/compiler/linkage.h" |
7 #include "src/compiler/register-allocator.h" | 7 #include "src/compiler/register-allocator.h" |
8 #include "src/string-stream.h" | 8 #include "src/string-stream.h" |
9 | 9 |
10 namespace v8 { | 10 namespace v8 { |
(...skipping 1342 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1353 code_(code), | 1353 code_(code), |
1354 debug_name_(debug_name), | 1354 debug_name_(debug_name), |
1355 config_(config), | 1355 config_(config), |
1356 phi_map_(allocation_zone()), | 1356 phi_map_(allocation_zone()), |
1357 live_in_sets_(code->InstructionBlockCount(), nullptr, allocation_zone()), | 1357 live_in_sets_(code->InstructionBlockCount(), nullptr, allocation_zone()), |
1358 live_out_sets_(code->InstructionBlockCount(), nullptr, allocation_zone()), | 1358 live_out_sets_(code->InstructionBlockCount(), nullptr, allocation_zone()), |
1359 live_ranges_(code->VirtualRegisterCount() * 2, nullptr, | 1359 live_ranges_(code->VirtualRegisterCount() * 2, nullptr, |
1360 allocation_zone()), | 1360 allocation_zone()), |
1361 fixed_live_ranges_(this->config()->num_general_registers(), nullptr, | 1361 fixed_live_ranges_(this->config()->num_general_registers(), nullptr, |
1362 allocation_zone()), | 1362 allocation_zone()), |
1363 fixed_float_live_ranges_(this->config()->num_float_registers(), nullptr, | 1363 fixed_float_live_ranges_(allocation_zone()), |
1364 allocation_zone()), | |
1365 fixed_double_live_ranges_(this->config()->num_double_registers(), nullptr, | 1364 fixed_double_live_ranges_(this->config()->num_double_registers(), nullptr, |
1366 allocation_zone()), | 1365 allocation_zone()), |
1367 fixed_simd128_live_ranges_(this->config()->num_simd128_registers(), | 1366 fixed_simd128_live_ranges_(allocation_zone()), |
1368 nullptr, allocation_zone()), | |
1369 spill_ranges_(code->VirtualRegisterCount(), nullptr, allocation_zone()), | 1367 spill_ranges_(code->VirtualRegisterCount(), nullptr, allocation_zone()), |
1370 delayed_references_(allocation_zone()), | 1368 delayed_references_(allocation_zone()), |
1371 assigned_registers_(nullptr), | 1369 assigned_registers_(nullptr), |
1372 assigned_double_registers_(nullptr), | 1370 assigned_double_registers_(nullptr), |
1373 virtual_register_count_(code->VirtualRegisterCount()), | 1371 virtual_register_count_(code->VirtualRegisterCount()), |
1374 preassigned_slot_ranges_(zone) { | 1372 preassigned_slot_ranges_(zone) { |
| 1373 if (!kSimpleFPAliasing) { |
| 1374 fixed_float_live_ranges_.resize(this->config()->num_float_registers(), |
| 1375 nullptr); |
| 1376 fixed_simd128_live_ranges_.resize(this->config()->num_simd128_registers(), |
| 1377 nullptr); |
| 1378 } |
| 1379 |
1375 assigned_registers_ = new (code_zone()) | 1380 assigned_registers_ = new (code_zone()) |
1376 BitVector(this->config()->num_general_registers(), code_zone()); | 1381 BitVector(this->config()->num_general_registers(), code_zone()); |
1377 assigned_double_registers_ = new (code_zone()) | 1382 assigned_double_registers_ = new (code_zone()) |
1378 BitVector(this->config()->num_double_registers(), code_zone()); | 1383 BitVector(this->config()->num_double_registers(), code_zone()); |
1379 this->frame()->SetAllocatedRegisters(assigned_registers_); | 1384 this->frame()->SetAllocatedRegisters(assigned_registers_); |
1380 this->frame()->SetAllocatedDoubleRegisters(assigned_double_registers_); | 1385 this->frame()->SetAllocatedDoubleRegisters(assigned_double_registers_); |
1381 } | 1386 } |
1382 | 1387 |
1383 | 1388 |
1384 MoveOperands* RegisterAllocationData::AddGapMove( | 1389 MoveOperands* RegisterAllocationData::AddGapMove( |
(...skipping 523 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1908 DCHECK(result->IsFixed()); | 1913 DCHECK(result->IsFixed()); |
1909 result->set_assigned_register(index); | 1914 result->set_assigned_register(index); |
1910 data()->MarkAllocated(rep, index); | 1915 data()->MarkAllocated(rep, index); |
1911 data()->fixed_live_ranges()[index] = result; | 1916 data()->fixed_live_ranges()[index] = result; |
1912 } | 1917 } |
1913 return result; | 1918 return result; |
1914 } | 1919 } |
1915 | 1920 |
1916 TopLevelLiveRange* LiveRangeBuilder::FixedFPLiveRangeFor( | 1921 TopLevelLiveRange* LiveRangeBuilder::FixedFPLiveRangeFor( |
1917 int index, MachineRepresentation rep) { | 1922 int index, MachineRepresentation rep) { |
1918 int num_regs = -1; | 1923 int num_regs = config()->num_double_registers(); |
1919 ZoneVector<TopLevelLiveRange*>* live_ranges = nullptr; | 1924 ZoneVector<TopLevelLiveRange*>* live_ranges = |
1920 switch (rep) { | 1925 &data()->fixed_double_live_ranges(); |
1921 case MachineRepresentation::kFloat32: | 1926 if (!kSimpleFPAliasing) { |
1922 num_regs = config()->num_float_registers(); | 1927 switch (rep) { |
1923 live_ranges = &data()->fixed_float_live_ranges(); | 1928 case MachineRepresentation::kFloat32: |
1924 break; | 1929 num_regs = config()->num_float_registers(); |
1925 case MachineRepresentation::kFloat64: | 1930 live_ranges = &data()->fixed_float_live_ranges(); |
1926 num_regs = config()->num_double_registers(); | 1931 break; |
1927 live_ranges = &data()->fixed_double_live_ranges(); | 1932 case MachineRepresentation::kSimd128: |
1928 break; | 1933 num_regs = config()->num_simd128_registers(); |
1929 case MachineRepresentation::kSimd128: | 1934 live_ranges = &data()->fixed_simd128_live_ranges(); |
1930 num_regs = config()->num_simd128_registers(); | 1935 break; |
1931 live_ranges = &data()->fixed_simd128_live_ranges(); | 1936 default: |
1932 break; | 1937 break; |
1933 default: | 1938 } |
1934 UNREACHABLE(); | |
1935 break; | |
1936 } | 1939 } |
1937 | 1940 |
1938 DCHECK(index < num_regs); | 1941 DCHECK(index < num_regs); |
1939 TopLevelLiveRange* result = (*live_ranges)[index]; | 1942 TopLevelLiveRange* result = (*live_ranges)[index]; |
1940 if (result == nullptr) { | 1943 if (result == nullptr) { |
1941 result = data()->NewLiveRange(FixedFPLiveRangeID(index, rep), rep); | 1944 result = data()->NewLiveRange(FixedFPLiveRangeID(index, rep), rep); |
1942 DCHECK(result->IsFixed()); | 1945 DCHECK(result->IsFixed()); |
1943 result->set_assigned_register(index); | 1946 result->set_assigned_register(index); |
1944 data()->MarkAllocated(rep, index); | 1947 data()->MarkAllocated(rep, index); |
1945 (*live_ranges)[index] = result; | 1948 (*live_ranges)[index] = result; |
(...skipping 787 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2733 } | 2736 } |
2734 } | 2737 } |
2735 SortUnhandled(); | 2738 SortUnhandled(); |
2736 DCHECK(UnhandledIsSorted()); | 2739 DCHECK(UnhandledIsSorted()); |
2737 | 2740 |
2738 if (mode() == GENERAL_REGISTERS) { | 2741 if (mode() == GENERAL_REGISTERS) { |
2739 for (TopLevelLiveRange* current : data()->fixed_live_ranges()) { | 2742 for (TopLevelLiveRange* current : data()->fixed_live_ranges()) { |
2740 if (current != nullptr) AddToInactive(current); | 2743 if (current != nullptr) AddToInactive(current); |
2741 } | 2744 } |
2742 } else { | 2745 } else { |
2743 for (TopLevelLiveRange* current : data()->fixed_float_live_ranges()) { | |
2744 if (current != nullptr) AddToInactive(current); | |
2745 } | |
2746 for (TopLevelLiveRange* current : data()->fixed_double_live_ranges()) { | 2746 for (TopLevelLiveRange* current : data()->fixed_double_live_ranges()) { |
2747 if (current != nullptr) AddToInactive(current); | 2747 if (current != nullptr) AddToInactive(current); |
2748 } | 2748 } |
2749 for (TopLevelLiveRange* current : data()->fixed_simd128_live_ranges()) { | 2749 if (!kSimpleFPAliasing) { |
2750 if (current != nullptr) AddToInactive(current); | 2750 for (TopLevelLiveRange* current : data()->fixed_float_live_ranges()) { |
| 2751 if (current != nullptr) AddToInactive(current); |
| 2752 } |
| 2753 for (TopLevelLiveRange* current : data()->fixed_simd128_live_ranges()) { |
| 2754 if (current != nullptr) AddToInactive(current); |
| 2755 } |
2751 } | 2756 } |
2752 } | 2757 } |
2753 | 2758 |
2754 while (!unhandled_live_ranges().empty()) { | 2759 while (!unhandled_live_ranges().empty()) { |
2755 DCHECK(UnhandledIsSorted()); | 2760 DCHECK(UnhandledIsSorted()); |
2756 LiveRange* current = unhandled_live_ranges().back(); | 2761 LiveRange* current = unhandled_live_ranges().back(); |
2757 unhandled_live_ranges().pop_back(); | 2762 unhandled_live_ranges().pop_back(); |
2758 DCHECK(UnhandledIsSorted()); | 2763 DCHECK(UnhandledIsSorted()); |
2759 LifetimePosition position = current->Start(); | 2764 LifetimePosition position = current->Start(); |
2760 #ifdef DEBUG | 2765 #ifdef DEBUG |
(...skipping 1189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3950 } | 3955 } |
3951 } | 3956 } |
3952 } | 3957 } |
3953 } | 3958 } |
3954 } | 3959 } |
3955 | 3960 |
3956 | 3961 |
3957 } // namespace compiler | 3962 } // namespace compiler |
3958 } // namespace internal | 3963 } // namespace internal |
3959 } // namespace v8 | 3964 } // namespace v8 |
OLD | NEW |