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

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

Issue 10831179: Allocate the environment's location backing store during register allocation. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Store location count to enable bounds checking assertions. 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 | « no previous file | runtime/vm/il_printer.cc » ('j') | runtime/vm/intermediate_language.h » ('J')
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 644 matching lines...) Expand 10 before | Expand all | Expand 10 after
655 // Any value mentioned in the deoptimization environment should survive 655 // Any value mentioned in the deoptimization environment should survive
656 // until the end of instruction but it does not need to be in the register. 656 // until the end of instruction but it does not need to be in the register.
657 // Expected shape of live range: 657 // Expected shape of live range:
658 // 658 //
659 // i i' 659 // i i'
660 // value -----* 660 // value -----*
661 // 661 //
662 662
663 Environment* env = current->env(); 663 Environment* env = current->env();
664 const GrowableArray<Value*>& values = env->values(); 664 const GrowableArray<Value*>& values = env->values();
665 665 env->InitializeLocations();
srdjan 2012/08/06 22:49:25 I would move the loop below into InitializeLocatio
666 for (intptr_t j = 0; j < values.length(); j++) { 666 for (intptr_t j = 0; j < values.length(); j++) {
667 Value* val = values[j]; 667 Value* val = values[j];
668 Location* loc = env->LocationSlotAt(j);
668 if (val->IsUse()) { 669 if (val->IsUse()) {
669 env->AddLocation(Location::Any()); 670 *loc = Location::Any();
670 const intptr_t vreg = val->AsUse()->definition()->ssa_temp_index(); 671 const intptr_t vreg = val->AsUse()->definition()->ssa_temp_index();
671 672
672 LiveRange* range = GetLiveRange(vreg); 673 LiveRange* range = GetLiveRange(vreg);
673 range->AddUseInterval(block->start_pos(), pos + 1); 674 range->AddUseInterval(block->start_pos(), pos + 1);
674 range->AddUse(pos + 1, env->LocationSlotAt(j)); 675 range->AddUse(pos + 1, loc);
675 } else { 676 } else {
676 ASSERT(val->IsConstant()); 677 ASSERT(val->IsConstant());
677 env->AddLocation(Location::NoLocation()); 678 *loc = Location::NoLocation();
678 } 679 }
679 } 680 }
680 } 681 }
681 682
682 // Process inputs. 683 // Process inputs.
683 // Skip the first input if output is specified with kSameAsFirstInput policy, 684 // Skip the first input if output is specified with kSameAsFirstInput policy,
684 // they will be processed together at the very end. 685 // they will be processed together at the very end.
685 for (intptr_t j = output_same_as_first_input ? 1 : 0; 686 for (intptr_t j = output_same_as_first_input ? 1 : 0;
686 j < current->InputCount(); 687 j < current->InputCount();
687 j++) { 688 j++) {
(...skipping 1194 matching lines...) Expand 10 before | Expand all | Expand 10 after
1882 OS::Print("-- [after ssa allocator] ir [%s] -------------\n", 1883 OS::Print("-- [after ssa allocator] ir [%s] -------------\n",
1883 function.ToFullyQualifiedCString()); 1884 function.ToFullyQualifiedCString());
1884 FlowGraphPrinter printer(Function::Handle(), block_order_, true); 1885 FlowGraphPrinter printer(Function::Handle(), block_order_, true);
1885 printer.PrintBlocks(); 1886 printer.PrintBlocks();
1886 OS::Print("----------------------------------------------\n"); 1887 OS::Print("----------------------------------------------\n");
1887 } 1888 }
1888 } 1889 }
1889 1890
1890 1891
1891 } // namespace dart 1892 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | runtime/vm/il_printer.cc » ('j') | runtime/vm/intermediate_language.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698