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

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

Issue 21272003: Fix crash bug in the polymorphic inlining. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: fixed one more corner case 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 | tests/language/allocation_sinking_inlining_test.dart » ('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) 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_inliner.h" 5 #include "vm/flow_graph_inliner.h"
6 6
7 #include "vm/compiler.h" 7 #include "vm/compiler.h"
8 #include "vm/flags.h" 8 #include "vm/flags.h"
9 #include "vm/flow_graph.h" 9 #include "vm/flow_graph.h"
10 #include "vm/flow_graph_builder.h" 10 #include "vm/flow_graph_builder.h"
(...skipping 1162 matching lines...) Expand 10 before | Expand all | Expand 10 after
1173 // Handle the two possible cases (unshared and shared subsequent 1173 // Handle the two possible cases (unshared and shared subsequent
1174 // predecessors) separately. 1174 // predecessors) separately.
1175 BlockEntryInstr* callee_entry = inlined_entries_[i]; 1175 BlockEntryInstr* callee_entry = inlined_entries_[i];
1176 if (callee_entry->IsGraphEntry()) { 1176 if (callee_entry->IsGraphEntry()) {
1177 // Unshared. Graft the normal entry on after the check class 1177 // Unshared. Graft the normal entry on after the check class
1178 // instruction. 1178 // instruction.
1179 TargetEntryInstr* target = 1179 TargetEntryInstr* target =
1180 callee_entry->AsGraphEntry()->normal_entry(); 1180 callee_entry->AsGraphEntry()->normal_entry();
1181 cursor->LinkTo(target->next()); 1181 cursor->LinkTo(target->next());
1182 target->ReplaceAsPredecessorWith(current_block); 1182 target->ReplaceAsPredecessorWith(current_block);
1183 // Unuse all inputs of the graph entry and the normal entry. They are
1184 // not in the graph anymore.
1185 callee_entry->UnuseAllInputs();
1186 target->UnuseAllInputs();
1183 // All blocks that were dominated by the normal entry are now 1187 // All blocks that were dominated by the normal entry are now
1184 // dominated by the current block. 1188 // dominated by the current block.
1185 for (intptr_t j = 0; 1189 for (intptr_t j = 0;
1186 j < target->dominated_blocks().length(); 1190 j < target->dominated_blocks().length();
1187 ++j) { 1191 ++j) {
1188 BlockEntryInstr* block = target->dominated_blocks()[j]; 1192 BlockEntryInstr* block = target->dominated_blocks()[j];
1189 current_block->AddDominatedBlock(block); 1193 current_block->AddDominatedBlock(block);
1190 } 1194 }
1191 } else if (callee_entry->IsJoinEntry()) { 1195 } else if (callee_entry->IsJoinEntry()) {
1192 // Shared inlined body and this is a subsequent entry. We have 1196 // Shared inlined body and this is a subsequent entry. We have
(...skipping 30 matching lines...) Expand all
1223 cursor = NULL; 1227 cursor = NULL;
1224 1228
1225 // 2. Handle a match by linking to the inlined body. There are three 1229 // 2. Handle a match by linking to the inlined body. There are three
1226 // cases (unshared, shared first predecessor, and shared subsequent 1230 // cases (unshared, shared first predecessor, and shared subsequent
1227 // predecessors). 1231 // predecessors).
1228 BlockEntryInstr* callee_entry = inlined_entries_[i]; 1232 BlockEntryInstr* callee_entry = inlined_entries_[i];
1229 TargetEntryInstr* true_target = NULL; 1233 TargetEntryInstr* true_target = NULL;
1230 if (callee_entry->IsGraphEntry()) { 1234 if (callee_entry->IsGraphEntry()) {
1231 // Unshared. 1235 // Unshared.
1232 true_target = callee_entry->AsGraphEntry()->normal_entry(); 1236 true_target = callee_entry->AsGraphEntry()->normal_entry();
1237 // Unuse all inputs of the graph entry. It is not in the graph anymore.
1238 callee_entry->UnuseAllInputs();
1233 } else if (callee_entry->IsTargetEntry()) { 1239 } else if (callee_entry->IsTargetEntry()) {
1234 // Shared inlined body and this is the first entry. We have already 1240 // Shared inlined body and this is the first entry. We have already
1235 // constructed a join and this target jumps to it. 1241 // constructed a join and this target jumps to it.
1236 true_target = callee_entry->AsTargetEntry(); 1242 true_target = callee_entry->AsTargetEntry();
1237 BlockEntryInstr* join = 1243 BlockEntryInstr* join =
1238 true_target->last_instruction()->SuccessorAt(0); 1244 true_target->last_instruction()->SuccessorAt(0);
1239 current_block->AddDominatedBlock(join); 1245 current_block->AddDominatedBlock(join);
1240 } else { 1246 } else {
1241 // Shared inlined body and this is a subsequent entry. We have 1247 // Shared inlined body and this is a subsequent entry. We have
1242 // already constructed a join. We need a fresh target that jumps to 1248 // already constructed a join. We need a fresh target that jumps to
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
1401 OS::Print("After Inlining of %s\n", flow_graph_-> 1407 OS::Print("After Inlining of %s\n", flow_graph_->
1402 parsed_function().function().ToFullyQualifiedCString()); 1408 parsed_function().function().ToFullyQualifiedCString());
1403 FlowGraphPrinter printer(*flow_graph_); 1409 FlowGraphPrinter printer(*flow_graph_);
1404 printer.PrintBlocks(); 1410 printer.PrintBlocks();
1405 } 1411 }
1406 } 1412 }
1407 } 1413 }
1408 } 1414 }
1409 1415
1410 } // namespace dart 1416 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | tests/language/allocation_sinking_inlining_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698