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

Side by Side Diff: src/compiler/register-allocator.cc

Issue 1428943004: [turbofan] Remove redundant code. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 1 month 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 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 2425 matching lines...) Expand 10 before | Expand all | Expand 10 after
2436 auto current = unhandled_live_ranges().back(); 2436 auto current = unhandled_live_ranges().back();
2437 unhandled_live_ranges().pop_back(); 2437 unhandled_live_ranges().pop_back();
2438 DCHECK(UnhandledIsSorted()); 2438 DCHECK(UnhandledIsSorted());
2439 auto position = current->Start(); 2439 auto position = current->Start();
2440 #ifdef DEBUG 2440 #ifdef DEBUG
2441 allocation_finger_ = position; 2441 allocation_finger_ = position;
2442 #endif 2442 #endif
2443 TRACE("Processing interval %d:%d start=%d\n", current->TopLevel()->vreg(), 2443 TRACE("Processing interval %d:%d start=%d\n", current->TopLevel()->vreg(),
2444 current->relative_id(), position.value()); 2444 current->relative_id(), position.value());
2445 2445
2446 if (current->IsTopLevel() && !current->TopLevel()->HasNoSpillType()) {
2447 TRACE("Live range %d:%d already has a spill operand\n",
2448 current->TopLevel()->vreg(), current->relative_id());
2449 auto next_pos = position;
2450 if (next_pos.IsGapPosition()) {
2451 next_pos = next_pos.NextStart();
2452 }
2453 auto pos = current->NextUsePositionRegisterIsBeneficial(next_pos);
2454 // If the range already has a spill operand and it doesn't need a
2455 // register immediately, split it and spill the first part of the range.
2456 if (pos == nullptr) {
2457 Spill(current);
2458 continue;
2459 } else if (pos->pos() > current->Start().NextStart()) {
2460 // Do not spill live range eagerly if use position that can benefit from
2461 // the register is too close to the start of live range.
2462 SpillBetween(current, current->Start(), pos->pos());
2463 DCHECK(UnhandledIsSorted());
2464 continue;
2465 }
2466 }
2467
2468 if (current->IsTopLevel() && TryReuseSpillForPhi(current->TopLevel())) 2446 if (current->IsTopLevel() && TryReuseSpillForPhi(current->TopLevel()))
2469 continue; 2447 continue;
2470 2448
2471 for (size_t i = 0; i < active_live_ranges().size(); ++i) { 2449 for (size_t i = 0; i < active_live_ranges().size(); ++i) {
2472 auto cur_active = active_live_ranges()[i]; 2450 auto cur_active = active_live_ranges()[i];
2473 if (cur_active->End() <= position) { 2451 if (cur_active->End() <= position) {
2474 ActiveToHandled(cur_active); 2452 ActiveToHandled(cur_active);
2475 --i; // The live range was removed from the list of active live ranges. 2453 --i; // The live range was removed from the list of active live ranges.
2476 } else if (!cur_active->Covers(position)) { 2454 } else if (!cur_active->Covers(position)) {
2477 ActiveToInactive(cur_active); 2455 ActiveToInactive(cur_active);
(...skipping 965 matching lines...) Expand 10 before | Expand all | Expand 10 after
3443 auto eliminate = moves->PrepareInsertAfter(move); 3421 auto eliminate = moves->PrepareInsertAfter(move);
3444 to_insert.push_back(move); 3422 to_insert.push_back(move);
3445 if (eliminate != nullptr) to_eliminate.push_back(eliminate); 3423 if (eliminate != nullptr) to_eliminate.push_back(eliminate);
3446 } 3424 }
3447 } 3425 }
3448 3426
3449 3427
3450 } // namespace compiler 3428 } // namespace compiler
3451 } // namespace internal 3429 } // namespace internal
3452 } // namespace v8 3430 } // namespace v8
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