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

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

Issue 22590002: Fix bug with optimized try-catch on ARM/MIPS. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: added cleanup of CatchEntry Created 7 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/flow_graph_builder.cc » ('j') | runtime/vm/flow_graph_builder.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 static intptr_t ToInstructionStart(intptr_t pos) { 53 static intptr_t ToInstructionStart(intptr_t pos) {
54 return (pos & ~1); 54 return (pos & ~1);
55 } 55 }
56 56
57 57
58 static intptr_t ToInstructionEnd(intptr_t pos) { 58 static intptr_t ToInstructionEnd(intptr_t pos) {
59 return (pos | 1); 59 return (pos | 1);
60 } 60 }
61 61
62 62
63 static intptr_t NextInstructionPos(intptr_t pos) {
64 ASSERT(IsInstructionStartPosition(pos));
65 return pos + 2;
66 }
67
68
69 FlowGraphAllocator::FlowGraphAllocator(const FlowGraph& flow_graph) 63 FlowGraphAllocator::FlowGraphAllocator(const FlowGraph& flow_graph)
70 : flow_graph_(flow_graph), 64 : flow_graph_(flow_graph),
71 reaching_defs_(flow_graph), 65 reaching_defs_(flow_graph),
72 value_representations_(flow_graph.max_virtual_register_number()), 66 value_representations_(flow_graph.max_virtual_register_number()),
73 block_order_(flow_graph.reverse_postorder()), 67 block_order_(flow_graph.reverse_postorder()),
74 postorder_(flow_graph.postorder()), 68 postorder_(flow_graph.postorder()),
75 liveness_(flow_graph), 69 liveness_(flow_graph),
76 vreg_count_(flow_graph.max_virtual_register_number()), 70 vreg_count_(flow_graph.max_virtual_register_number()),
77 live_ranges_(flow_graph.max_virtual_register_number()), 71 live_ranges_(flow_graph.max_virtual_register_number()),
78 cpu_regs_(), 72 cpu_regs_(),
(...skipping 436 matching lines...) Expand 10 before | Expand all | Expand 10 after
515 // Process initial definitions. 509 // Process initial definitions.
516 CatchBlockEntryInstr* catch_entry = block->AsCatchBlockEntry(); 510 CatchBlockEntryInstr* catch_entry = block->AsCatchBlockEntry();
517 for (intptr_t i = 0; 511 for (intptr_t i = 0;
518 i < catch_entry->initial_definitions()->length(); 512 i < catch_entry->initial_definitions()->length();
519 i++) { 513 i++) {
520 Definition* defn = (*catch_entry->initial_definitions())[i]; 514 Definition* defn = (*catch_entry->initial_definitions())[i];
521 LiveRange* range = GetLiveRange(defn->ssa_temp_index()); 515 LiveRange* range = GetLiveRange(defn->ssa_temp_index());
522 range->DefineAt(catch_entry->start_pos()); // Defined at block entry. 516 range->DefineAt(catch_entry->start_pos()); // Defined at block entry.
523 ProcessInitialDefinition(defn, range, catch_entry); 517 ProcessInitialDefinition(defn, range, catch_entry);
524 } 518 }
525 // Block the two registers used by CatchEntryInstr from the block start to 519 // Block the two fixed registers used by CatchBlockEntryInstr from the
526 // until the end of the instruction so that they are preserved. 520 // block start to until the end of the instruction so that they are
527 ASSERT(catch_entry->next()->IsCatchEntry()); 521 // preserved.
528 intptr_t start = catch_entry->start_pos(); 522 intptr_t start = catch_entry->start_pos();
529 BlockLocation(Location::RegisterLocation(kExceptionObjectReg), 523 BlockLocation(Location::RegisterLocation(kExceptionObjectReg),
530 start, 524 start,
531 ToInstructionEnd(NextInstructionPos(start))); 525 ToInstructionEnd(start));
532 BlockLocation(Location::RegisterLocation(kStackTraceObjectReg), 526 BlockLocation(Location::RegisterLocation(kStackTraceObjectReg),
533 start, 527 start,
534 ToInstructionEnd(NextInstructionPos(start))); 528 ToInstructionEnd(start));
535 } 529 }
536 } 530 }
537 531
538 // Process incoming parameters and constants. Do this after all other 532 // Process incoming parameters and constants. Do this after all other
539 // instructions so that safepoints for all calls have already been found. 533 // instructions so that safepoints for all calls have already been found.
540 GraphEntryInstr* graph_entry = flow_graph_.graph_entry(); 534 GraphEntryInstr* graph_entry = flow_graph_.graph_entry();
541 for (intptr_t i = 0; i < graph_entry->initial_definitions()->length(); i++) { 535 for (intptr_t i = 0; i < graph_entry->initial_definitions()->length(); i++) {
542 Definition* defn = (*graph_entry->initial_definitions())[i]; 536 Definition* defn = (*graph_entry->initial_definitions())[i];
543 LiveRange* range = GetLiveRange(defn->ssa_temp_index()); 537 LiveRange* range = GetLiveRange(defn->ssa_temp_index());
544 range->AddUseInterval(graph_entry->start_pos(), graph_entry->end_pos()); 538 range->AddUseInterval(graph_entry->start_pos(), graph_entry->end_pos());
(...skipping 2060 matching lines...) Expand 10 before | Expand all | Expand 10 after
2605 OS::Print("-- [after ssa allocator] ir [%s] -------------\n", 2599 OS::Print("-- [after ssa allocator] ir [%s] -------------\n",
2606 function.ToFullyQualifiedCString()); 2600 function.ToFullyQualifiedCString());
2607 FlowGraphPrinter printer(flow_graph_, true); 2601 FlowGraphPrinter printer(flow_graph_, true);
2608 printer.PrintBlocks(); 2602 printer.PrintBlocks();
2609 OS::Print("----------------------------------------------\n"); 2603 OS::Print("----------------------------------------------\n");
2610 } 2604 }
2611 } 2605 }
2612 2606
2613 2607
2614 } // namespace dart 2608 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | runtime/vm/flow_graph_builder.cc » ('j') | runtime/vm/flow_graph_builder.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698