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

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

Issue 10948007: Revert "Deoptimization support in inlined code." (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 3 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.cc ('k') | runtime/vm/flow_graph_builder.cc » ('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.h" 10 #include "vm/flow_graph.h"
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 // Handle uses. 142 // Handle uses.
143 for (intptr_t j = 0; j < current->InputCount(); j++) { 143 for (intptr_t j = 0; j < current->InputCount(); j++) {
144 Value* input = current->InputAt(j); 144 Value* input = current->InputAt(j);
145 const intptr_t use = input->definition()->ssa_temp_index(); 145 const intptr_t use = input->definition()->ssa_temp_index();
146 live_in->Add(use); 146 live_in->Add(use);
147 } 147 }
148 148
149 // Add non-argument uses from the deoptimization environment (pushed 149 // Add non-argument uses from the deoptimization environment (pushed
150 // arguments are not allocated by the register allocator). 150 // arguments are not allocated by the register allocator).
151 if (current->env() != NULL) { 151 if (current->env() != NULL) {
152 for (Environment::DeepIterator env_it(current->env()); 152 for (intptr_t i = 0; i < current->env()->Length(); ++i) {
153 !env_it.Done(); 153 Value* value = current->env()->ValueAt(i);
154 env_it.Advance()) {
155 Value* value = env_it.CurrentValue();
156 if (!value->definition()->IsPushArgument()) { 154 if (!value->definition()->IsPushArgument()) {
157 live_in->Add(value->definition()->ssa_temp_index()); 155 live_in->Add(value->definition()->ssa_temp_index());
158 } 156 }
159 } 157 }
160 } 158 }
161 } 159 }
162 160
163 // Handle phis. 161 // Handle phis.
164 if (block->IsJoinEntry()) { 162 if (block->IsJoinEntry()) {
165 JoinEntryInstr* join = block->AsJoinEntry(); 163 JoinEntryInstr* join = block->AsJoinEntry();
(...skipping 567 matching lines...) Expand 10 before | Expand all | Expand 10 after
733 731
734 move_idx++; 732 move_idx++;
735 } 733 }
736 } 734 }
737 } 735 }
738 736
739 737
740 void FlowGraphAllocator::ProcessEnvironmentUses(BlockEntryInstr* block, 738 void FlowGraphAllocator::ProcessEnvironmentUses(BlockEntryInstr* block,
741 Instruction* current) { 739 Instruction* current) {
742 ASSERT(current->env() != NULL); 740 ASSERT(current->env() != NULL);
741
743 Environment* env = current->env(); 742 Environment* env = current->env();
744 while (env != NULL) {
745 // Any value mentioned in the deoptimization environment should survive
746 // until the end of instruction but it does not need to be in the register.
747 // Expected shape of live range:
748 //
749 // i i'
750 // value -----*
751 //
752 743
753 if (env->Length() == 0) { 744 // Any value mentioned in the deoptimization environment should survive
754 env = env->outer(); 745 // until the end of instruction but it does not need to be in the register.
746 // Expected shape of live range:
747 //
748 // i i'
749 // value -----*
750 //
751
752 if (env->Length() == 0) return;
753
754 const intptr_t block_start_pos = block->start_pos();
755 const intptr_t use_pos = current->lifetime_position() + 1;
756
757 Location* locations =
758 Isolate::Current()->current_zone()->Alloc<Location>(env->Length());
759
760 for (intptr_t i = 0; i < env->Length(); ++i) {
761 Value* value = env->ValueAt(i);
762 locations[i] = Location::Any();
763 Definition* def = value->definition();
764
765 if (def->IsPushArgument()) {
766 // Frame size is unknown until after allocation.
767 locations[i] = Location::NoLocation();
755 continue; 768 continue;
756 } 769 }
757 770
758 const intptr_t block_start_pos = block->start_pos(); 771 ConstantInstr* constant = def->AsConstant();
759 const intptr_t use_pos = current->lifetime_position() + 1; 772 if (constant != NULL) {
760 773 locations[i] = Location::Constant(constant->value());
761 Location* locations = 774 continue;
762 Isolate::Current()->current_zone()->Alloc<Location>(env->Length());
763
764 for (intptr_t i = 0; i < env->Length(); ++i) {
765 Value* value = env->ValueAt(i);
766 locations[i] = Location::Any();
767 Definition* def = value->definition();
768
769 if (def->IsPushArgument()) {
770 // Frame size is unknown until after allocation.
771 locations[i] = Location::NoLocation();
772 continue;
773 }
774
775 ConstantInstr* constant = def->AsConstant();
776 if (constant != NULL) {
777 locations[i] = Location::Constant(constant->value());
778 continue;
779 }
780
781 const intptr_t vreg = def->ssa_temp_index();
782 LiveRange* range = GetLiveRange(vreg);
783 range->AddUseInterval(block_start_pos, use_pos);
784 range->AddUse(use_pos, &locations[i]);
785 } 775 }
786 776
787 env->set_locations(locations); 777 const intptr_t vreg = def->ssa_temp_index();
788 env = env->outer(); 778 LiveRange* range = GetLiveRange(vreg);
779 range->AddUseInterval(block_start_pos, use_pos);
780 range->AddUse(use_pos, &locations[i]);
789 } 781 }
782
783 env->set_locations(locations);
790 } 784 }
791 785
792 786
793 // Create and update live ranges corresponding to instruction's inputs, 787 // Create and update live ranges corresponding to instruction's inputs,
794 // temporaries and output. 788 // temporaries and output.
795 void FlowGraphAllocator::ProcessOneInstruction(BlockEntryInstr* block, 789 void FlowGraphAllocator::ProcessOneInstruction(BlockEntryInstr* block,
796 Instruction* current) { 790 Instruction* current) {
797 LocationSummary* locs = current->locs(); 791 LocationSummary* locs = current->locs();
798 792
799 Definition* def = current->AsDefinition(); 793 Definition* def = current->AsDefinition();
(...skipping 1412 matching lines...) Expand 10 before | Expand all | Expand 10 after
2212 OS::Print("-- [after ssa allocator] ir [%s] -------------\n", 2206 OS::Print("-- [after ssa allocator] ir [%s] -------------\n",
2213 function.ToFullyQualifiedCString()); 2207 function.ToFullyQualifiedCString());
2214 FlowGraphPrinter printer(flow_graph_, true); 2208 FlowGraphPrinter printer(flow_graph_, true);
2215 printer.PrintBlocks(); 2209 printer.PrintBlocks();
2216 OS::Print("----------------------------------------------\n"); 2210 OS::Print("----------------------------------------------\n");
2217 } 2211 }
2218 } 2212 }
2219 2213
2220 2214
2221 } // namespace dart 2215 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/flow_graph.cc ('k') | runtime/vm/flow_graph_builder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698