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

Side by Side Diff: runtime/vm/flow_graph_allocator.cc

Issue 10826184: Move all register allocator environment initialization into class Environment. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 4 months 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 | Annotate | Revision Log
« no previous file with comments | « runtime/vm/flow_graph_allocator.h ('k') | runtime/vm/intermediate_language.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "vm/flow_graph_allocator.h" 5 #include "vm/flow_graph_allocator.h"
6 6
7 #include "vm/bit_vector.h" 7 #include "vm/bit_vector.h"
8 #include "vm/intermediate_language.h" 8 #include "vm/intermediate_language.h"
9 #include "vm/il_printer.h" 9 #include "vm/il_printer.h"
10 #include "vm/flow_graph_builder.h" 10 #include "vm/flow_graph_builder.h"
(...skipping 633 matching lines...) Expand 10 before | Expand all | Expand 10 after
644 (locs->out().policy() == Location::kSameAsFirstInput) && 644 (locs->out().policy() == Location::kSameAsFirstInput) &&
645 (locs->in(0).IsRegister())) { 645 (locs->in(0).IsRegister())) {
646 locs->set_out(locs->in(0)); 646 locs->set_out(locs->in(0));
647 } 647 }
648 648
649 const bool output_same_as_first_input = 649 const bool output_same_as_first_input =
650 locs->out().IsUnallocated() && 650 locs->out().IsUnallocated() &&
651 (locs->out().policy() == Location::kSameAsFirstInput); 651 (locs->out().policy() == Location::kSameAsFirstInput);
652 652
653 // Add uses from the deoptimization environment. 653 // Add uses from the deoptimization environment.
654 if (current->env() != NULL) { 654 Environment* env = current->env();
655 // Any value mentioned in the deoptimization environment should survive 655 if (env != NULL) {
656 // until the end of instruction but it does not need to be in the register. 656 env->InitializeLocations(this, block->start_pos(), pos + 1);
657 // Expected shape of live range:
658 //
659 // i i'
660 // value -----*
661 //
662
663 Environment* env = current->env();
664 const GrowableArray<Value*>& values = env->values();
665 env->InitializeLocations();
666 for (intptr_t j = 0; j < values.length(); j++) {
667 Value* val = values[j];
668 Location* loc = env->LocationSlotAt(j);
669 if (val->IsUse()) {
670 *loc = Location::Any();
671 const intptr_t vreg = val->AsUse()->definition()->ssa_temp_index();
672
673 LiveRange* range = GetLiveRange(vreg);
674 range->AddUseInterval(block->start_pos(), pos + 1);
675 range->AddUse(pos + 1, loc);
676 } else {
677 ASSERT(val->IsConstant());
678 *loc = Location::NoLocation();
679 }
680 }
681 } 657 }
682 658
683 // Process inputs. 659 // Process inputs.
684 // Skip the first input if output is specified with kSameAsFirstInput policy, 660 // Skip the first input if output is specified with kSameAsFirstInput policy,
685 // they will be processed together at the very end. 661 // they will be processed together at the very end.
686 for (intptr_t j = output_same_as_first_input ? 1 : 0; 662 for (intptr_t j = output_same_as_first_input ? 1 : 0;
687 j < current->InputCount(); 663 j < current->InputCount();
688 j++) { 664 j++) {
689 Value* input = current->InputAt(j); 665 Value* input = current->InputAt(j);
690 ASSERT(input->IsUse()); // Can not be a constant currently. 666 ASSERT(input->IsUse()); // Can not be a constant currently.
(...skipping 1192 matching lines...) Expand 10 before | Expand all | Expand 10 after
1883 OS::Print("-- [after ssa allocator] ir [%s] -------------\n", 1859 OS::Print("-- [after ssa allocator] ir [%s] -------------\n",
1884 function.ToFullyQualifiedCString()); 1860 function.ToFullyQualifiedCString());
1885 FlowGraphPrinter printer(Function::Handle(), block_order_, true); 1861 FlowGraphPrinter printer(Function::Handle(), block_order_, true);
1886 printer.PrintBlocks(); 1862 printer.PrintBlocks();
1887 OS::Print("----------------------------------------------\n"); 1863 OS::Print("----------------------------------------------\n");
1888 } 1864 }
1889 } 1865 }
1890 1866
1891 1867
1892 } // namespace dart 1868 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/flow_graph_allocator.h ('k') | runtime/vm/intermediate_language.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698