| 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 2994 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3005 positions[aliased_reg] = LifetimePosition::GapFromInstructionIndex(0); | 3005 positions[aliased_reg] = LifetimePosition::GapFromInstructionIndex(0); |
| 3006 } | 3006 } |
| 3007 } | 3007 } |
| 3008 } | 3008 } |
| 3009 | 3009 |
| 3010 for (LiveRange* cur_inactive : inactive_live_ranges()) { | 3010 for (LiveRange* cur_inactive : inactive_live_ranges()) { |
| 3011 DCHECK(cur_inactive->End() > range->Start()); | 3011 DCHECK(cur_inactive->End() > range->Start()); |
| 3012 int cur_reg = cur_inactive->assigned_register(); | 3012 int cur_reg = cur_inactive->assigned_register(); |
| 3013 // No need to carry out intersections, when this register won't be | 3013 // No need to carry out intersections, when this register won't be |
| 3014 // interesting to this range anyway. | 3014 // interesting to this range anyway. |
| 3015 if (positions[cur_reg] < range->Start()) continue; | 3015 // TODO(mtrofin): extend to aliased ranges, too. |
| 3016 if ((kSimpleFPAliasing || !check_fp_aliasing()) && |
| 3017 positions[cur_reg] < range->Start()) { |
| 3018 continue; |
| 3019 } |
| 3016 | 3020 |
| 3017 LifetimePosition next_intersection = cur_inactive->FirstIntersection(range); | 3021 LifetimePosition next_intersection = cur_inactive->FirstIntersection(range); |
| 3018 if (!next_intersection.IsValid()) continue; | 3022 if (!next_intersection.IsValid()) continue; |
| 3019 if (kSimpleFPAliasing || !check_fp_aliasing()) { | 3023 if (kSimpleFPAliasing || !check_fp_aliasing()) { |
| 3020 positions[cur_reg] = Min(positions[cur_reg], next_intersection); | 3024 positions[cur_reg] = Min(positions[cur_reg], next_intersection); |
| 3021 TRACE("Register %s is free until pos %d (2)\n", RegisterName(cur_reg), | 3025 TRACE("Register %s is free until pos %d (2)\n", RegisterName(cur_reg), |
| 3022 Min(positions[cur_reg], next_intersection).value()); | 3026 Min(positions[cur_reg], next_intersection).value()); |
| 3023 } else { | 3027 } else { |
| 3024 int alias_base_index = -1; | 3028 int alias_base_index = -1; |
| 3025 int aliases = data()->config()->GetAliases( | 3029 int aliases = data()->config()->GetAliases( |
| (...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3202 } else { | 3206 } else { |
| 3203 use_pos[aliased_reg] = | 3207 use_pos[aliased_reg] = |
| 3204 range->NextLifetimePositionRegisterIsBeneficial(current->Start()); | 3208 range->NextLifetimePositionRegisterIsBeneficial(current->Start()); |
| 3205 } | 3209 } |
| 3206 } | 3210 } |
| 3207 } | 3211 } |
| 3208 } | 3212 } |
| 3209 | 3213 |
| 3210 for (LiveRange* range : inactive_live_ranges()) { | 3214 for (LiveRange* range : inactive_live_ranges()) { |
| 3211 DCHECK(range->End() > current->Start()); | 3215 DCHECK(range->End() > current->Start()); |
| 3216 int cur_reg = range->assigned_register(); |
| 3217 bool is_fixed = range->TopLevel()->IsFixed(); |
| 3218 |
| 3219 // Don't perform costly intersections if they are guaranteed to not update |
| 3220 // block_pos or use_pos. |
| 3221 // TODO(mtrofin): extend to aliased ranges, too. |
| 3222 if ((kSimpleFPAliasing || !check_fp_aliasing()) && is_fixed) { |
| 3223 if (block_pos[cur_reg] < range->Start()) continue; |
| 3224 } else { |
| 3225 if (use_pos[cur_reg] < range->Start()) continue; |
| 3226 } |
| 3227 |
| 3212 LifetimePosition next_intersection = range->FirstIntersection(current); | 3228 LifetimePosition next_intersection = range->FirstIntersection(current); |
| 3213 if (!next_intersection.IsValid()) continue; | 3229 if (!next_intersection.IsValid()) continue; |
| 3214 int cur_reg = range->assigned_register(); | 3230 |
| 3215 bool is_fixed = range->TopLevel()->IsFixed(); | |
| 3216 if (kSimpleFPAliasing || !check_fp_aliasing()) { | 3231 if (kSimpleFPAliasing || !check_fp_aliasing()) { |
| 3217 if (is_fixed) { | 3232 if (is_fixed) { |
| 3218 block_pos[cur_reg] = Min(block_pos[cur_reg], next_intersection); | 3233 block_pos[cur_reg] = Min(block_pos[cur_reg], next_intersection); |
| 3219 use_pos[cur_reg] = Min(block_pos[cur_reg], use_pos[cur_reg]); | 3234 use_pos[cur_reg] = Min(block_pos[cur_reg], use_pos[cur_reg]); |
| 3220 } else { | 3235 } else { |
| 3221 use_pos[cur_reg] = Min(use_pos[cur_reg], next_intersection); | 3236 use_pos[cur_reg] = Min(use_pos[cur_reg], next_intersection); |
| 3222 } | 3237 } |
| 3223 } else { | 3238 } else { |
| 3224 int alias_base_index = -1; | 3239 int alias_base_index = -1; |
| 3225 int aliases = data()->config()->GetAliases( | 3240 int aliases = data()->config()->GetAliases( |
| (...skipping 757 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3983 } | 3998 } |
| 3984 } | 3999 } |
| 3985 } | 4000 } |
| 3986 } | 4001 } |
| 3987 } | 4002 } |
| 3988 | 4003 |
| 3989 | 4004 |
| 3990 } // namespace compiler | 4005 } // namespace compiler |
| 3991 } // namespace internal | 4006 } // namespace internal |
| 3992 } // namespace v8 | 4007 } // namespace v8 |
| OLD | NEW |