OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
128 BlockEntryInstr* block = postorder_[i]; | 128 BlockEntryInstr* block = postorder_[i]; |
129 | 129 |
130 BitVector* kill = kill_[i]; | 130 BitVector* kill = kill_[i]; |
131 BitVector* live_in = live_in_[i]; | 131 BitVector* live_in = live_in_[i]; |
132 | 132 |
133 // Iterate backwards starting at the last instruction. | 133 // Iterate backwards starting at the last instruction. |
134 for (BackwardInstructionIterator it(block); !it.Done(); it.Advance()) { | 134 for (BackwardInstructionIterator it(block); !it.Done(); it.Advance()) { |
135 Instruction* current = it.Current(); | 135 Instruction* current = it.Current(); |
136 | 136 |
137 // Initialize location summary for instruction. | 137 // Initialize location summary for instruction. |
138 current->InitializeLocationSummary(true); // Optimizing. | 138 current->InitializeLocationSummary(Isolate::Current(), true); // opt |
139 LocationSummary* locs = current->locs(); | 139 LocationSummary* locs = current->locs(); |
140 | 140 |
141 // Handle definitions. | 141 // Handle definitions. |
142 Definition* current_def = current->AsDefinition(); | 142 Definition* current_def = current->AsDefinition(); |
143 if ((current_def != NULL) && current_def->HasSSATemp()) { | 143 if ((current_def != NULL) && current_def->HasSSATemp()) { |
144 kill->Add(current_def->ssa_temp_index()); | 144 kill->Add(current_def->ssa_temp_index()); |
145 live_in->Remove(current_def->ssa_temp_index()); | 145 live_in->Remove(current_def->ssa_temp_index()); |
146 if (current_def->HasPairRepresentation()) { | 146 if (current_def->HasPairRepresentation()) { |
147 kill->Add(ToSecondPairVreg(current_def->ssa_temp_index())); | 147 kill->Add(ToSecondPairVreg(current_def->ssa_temp_index())); |
148 live_in->Remove(ToSecondPairVreg(current_def->ssa_temp_index())); | 148 live_in->Remove(ToSecondPairVreg(current_def->ssa_temp_index())); |
(...skipping 1757 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1906 | 1906 |
1907 void FlowGraphAllocator::MarkAsObjectAtSafepoints(LiveRange* range) { | 1907 void FlowGraphAllocator::MarkAsObjectAtSafepoints(LiveRange* range) { |
1908 intptr_t stack_index = range->spill_slot().stack_index(); | 1908 intptr_t stack_index = range->spill_slot().stack_index(); |
1909 ASSERT(stack_index >= 0); | 1909 ASSERT(stack_index >= 0); |
1910 | 1910 |
1911 while (range != NULL) { | 1911 while (range != NULL) { |
1912 for (SafepointPosition* safepoint = range->first_safepoint(); | 1912 for (SafepointPosition* safepoint = range->first_safepoint(); |
1913 safepoint != NULL; | 1913 safepoint != NULL; |
1914 safepoint = safepoint->next()) { | 1914 safepoint = safepoint->next()) { |
1915 // Mark the stack slot as having an object. | 1915 // Mark the stack slot as having an object. |
1916 safepoint->locs()->stack_bitmap()->Set(stack_index, true); | 1916 safepoint->locs()->SetStackBit(stack_index); |
1917 } | 1917 } |
1918 range = range->next_sibling(); | 1918 range = range->next_sibling(); |
1919 } | 1919 } |
1920 } | 1920 } |
1921 | 1921 |
1922 | 1922 |
1923 void FlowGraphAllocator::Spill(LiveRange* range) { | 1923 void FlowGraphAllocator::Spill(LiveRange* range) { |
1924 LiveRange* parent = GetLiveRange(range->vreg()); | 1924 LiveRange* parent = GetLiveRange(range->vreg()); |
1925 if (parent->spill_slot().IsInvalid()) { | 1925 if (parent->spill_slot().IsInvalid()) { |
1926 AllocateSpillSlotFor(parent); | 1926 AllocateSpillSlotFor(parent); |
(...skipping 949 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2876 OS::Print("-- [after ssa allocator] ir [%s] -------------\n", | 2876 OS::Print("-- [after ssa allocator] ir [%s] -------------\n", |
2877 function.ToFullyQualifiedCString()); | 2877 function.ToFullyQualifiedCString()); |
2878 FlowGraphPrinter printer(flow_graph_, true); | 2878 FlowGraphPrinter printer(flow_graph_, true); |
2879 printer.PrintBlocks(); | 2879 printer.PrintBlocks(); |
2880 OS::Print("----------------------------------------------\n"); | 2880 OS::Print("----------------------------------------------\n"); |
2881 } | 2881 } |
2882 } | 2882 } |
2883 | 2883 |
2884 | 2884 |
2885 } // namespace dart | 2885 } // namespace dart |
OLD | NEW |