| 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 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 257 void LiveRange::AddUseInterval(intptr_t start, intptr_t end) { | 257 void LiveRange::AddUseInterval(intptr_t start, intptr_t end) { |
| 258 ASSERT(start < end); | 258 ASSERT(start < end); |
| 259 | 259 |
| 260 // Live ranges are being build by visiting instructions in post-order. | 260 // Live ranges are being build by visiting instructions in post-order. |
| 261 // This implies that use intervals will be prepended in a monotonically | 261 // This implies that use intervals will be prepended in a monotonically |
| 262 // decreasing order. | 262 // decreasing order. |
| 263 if (first_use_interval() != NULL) { | 263 if (first_use_interval() != NULL) { |
| 264 // If the first use interval and the use interval we are adding | 264 // If the first use interval and the use interval we are adding |
| 265 // touch then we can just extend the first interval to cover their | 265 // touch then we can just extend the first interval to cover their |
| 266 // union. | 266 // union. |
| 267 if (start >= first_use_interval()->start()) { | 267 if (start > first_use_interval()->start()) { |
| 268 // The only case when we can add intervals with start greater than | 268 // The only case when we can add intervals with start greater than |
| 269 // start of an already created interval is BlockLocation. | 269 // start of an already created interval is BlockLocation. |
| 270 ASSERT((start == first_use_interval()->start()) || | 270 ASSERT(vreg() == kNoVirtualRegister); |
| 271 (vreg() == kNoVirtualRegister)); | |
| 272 ASSERT(end <= first_use_interval()->end()); | 271 ASSERT(end <= first_use_interval()->end()); |
| 273 return; | 272 return; |
| 273 } else if (start == first_use_interval()->start()) { |
| 274 // Grow first interval if necessary. |
| 275 if (end <= first_use_interval()->end()) return; |
| 276 first_use_interval_->end_ = end; |
| 277 return; |
| 274 } else if (end == first_use_interval()->start()) { | 278 } else if (end == first_use_interval()->start()) { |
| 275 first_use_interval()->start_ = start; | 279 first_use_interval()->start_ = start; |
| 276 return; | 280 return; |
| 277 } | 281 } |
| 278 | 282 |
| 279 ASSERT(end < first_use_interval()->start()); | 283 ASSERT(end < first_use_interval()->start()); |
| 280 } | 284 } |
| 281 | 285 |
| 282 first_use_interval_ = new UseInterval(start, end, first_use_interval_); | 286 first_use_interval_ = new UseInterval(start, end, first_use_interval_); |
| 283 if (last_use_interval_ == NULL) { | 287 if (last_use_interval_ == NULL) { |
| (...skipping 2317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2601 OS::Print("-- [after ssa allocator] ir [%s] -------------\n", | 2605 OS::Print("-- [after ssa allocator] ir [%s] -------------\n", |
| 2602 function.ToFullyQualifiedCString()); | 2606 function.ToFullyQualifiedCString()); |
| 2603 FlowGraphPrinter printer(flow_graph_, true); | 2607 FlowGraphPrinter printer(flow_graph_, true); |
| 2604 printer.PrintBlocks(); | 2608 printer.PrintBlocks(); |
| 2605 OS::Print("----------------------------------------------\n"); | 2609 OS::Print("----------------------------------------------\n"); |
| 2606 } | 2610 } |
| 2607 } | 2611 } |
| 2608 | 2612 |
| 2609 | 2613 |
| 2610 } // namespace dart | 2614 } // namespace dart |
| OLD | NEW |