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

Side by Side Diff: vm/intermediate_language.cc

Issue 10692072: Fix a bug in SSA renaming introduced when using the RemoveFromGraph helper for removing instruction… (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/runtime/
Patch Set: Created 8 years, 5 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 | « vm/intermediate_language.h ('k') | no next file » | 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/intermediate_language.h" 5 #include "vm/intermediate_language.h"
6 6
7 #include "vm/bit_vector.h" 7 #include "vm/bit_vector.h"
8 #include "vm/dart_entry.h" 8 #include "vm/dart_entry.h"
9 #include "vm/flow_graph_builder.h" 9 #include "vm/flow_graph_builder.h"
10 #include "vm/flow_graph_compiler.h" 10 #include "vm/flow_graph_compiler.h"
(...skipping 514 matching lines...) Expand 10 before | Expand all | Expand 10 after
525 successor()->IsBlockEntry()); 525 successor()->IsBlockEntry());
526 return successor() != NULL ? 1 : 0; 526 return successor() != NULL ? 1 : 0;
527 } 527 }
528 528
529 529
530 BlockEntryInstr* Instruction::SuccessorAt(intptr_t index) const { 530 BlockEntryInstr* Instruction::SuccessorAt(intptr_t index) const {
531 return successor()->AsBlockEntry(); 531 return successor()->AsBlockEntry();
532 } 532 }
533 533
534 534
535 void Instruction::RemoveFromGraph() { 535 Instruction* Instruction::RemoveFromGraph() {
536 ASSERT(!IsBlockEntry()); 536 ASSERT(!IsBlockEntry());
537 ASSERT(!IsBranch()); 537 ASSERT(!IsBranch());
538 ASSERT(!IsThrow()); 538 ASSERT(!IsThrow());
539 ASSERT(!IsReturn()); 539 ASSERT(!IsReturn());
540 ASSERT(!IsReThrow()); 540 ASSERT(!IsReThrow());
541 ASSERT(previous() != NULL); 541 ASSERT(previous() != NULL);
542 Instruction* next = successor(); 542 Instruction* next = successor();
543 previous()->set_successor(next); 543 previous()->set_successor(next);
544 if (next != NULL) { 544 if (next != NULL) {
545 if (!next->IsBlockEntry()) { 545 if (!next->IsBlockEntry()) {
546 next->set_previous(previous()); 546 next->set_previous(previous());
547 } else { 547 } else {
548 // Removing the last instruction of a block. 548 // Removing the last instruction of a block.
549 // Update last_instruction of the current basic block. 549 // Update last_instruction of the current basic block.
550 Instruction* current = this; 550 Instruction* current = this;
551 while (!current->IsBlockEntry()) { 551 while (!current->IsBlockEntry()) {
552 current = current->previous(); 552 current = current->previous();
553 } 553 }
554 ASSERT(current->AsBlockEntry()->last_instruction() == this); 554 ASSERT(current->AsBlockEntry()->last_instruction() == this);
555 current->AsBlockEntry()->set_last_instruction(previous()); 555 current->AsBlockEntry()->set_last_instruction(previous());
556 } 556 }
557 } 557 }
558 // Reset successor and previous instruction to indicate 558 // Reset successor and previous instruction to indicate
559 // that the instruction is removed from the graph. 559 // that the instruction is removed from the graph.
560 set_successor(NULL); 560 set_successor(NULL);
561 set_previous(NULL); 561 set_previous(NULL);
562 return next;
562 } 563 }
563 564
564 565
565 intptr_t GraphEntryInstr::SuccessorCount() const { 566 intptr_t GraphEntryInstr::SuccessorCount() const {
566 return 1 + catch_entries_.length(); 567 return 1 + catch_entries_.length();
567 } 568 }
568 569
569 570
570 BlockEntryInstr* GraphEntryInstr::SuccessorAt(intptr_t index) const { 571 BlockEntryInstr* GraphEntryInstr::SuccessorAt(intptr_t index) const {
571 if (index == 0) return normal_entry_; 572 if (index == 0) return normal_entry_;
(...skipping 764 matching lines...) Expand 10 before | Expand all | Expand 10 after
1336 const ExternalLabel label(closure_function.ToCString(), stub.EntryPoint()); 1337 const ExternalLabel label(closure_function.ToCString(), stub.EntryPoint());
1337 compiler->GenerateCall(token_pos(), try_index(), &label, 1338 compiler->GenerateCall(token_pos(), try_index(), &label,
1338 PcDescriptors::kOther); 1339 PcDescriptors::kOther);
1339 __ Drop(2); // Discard type arguments and receiver. 1340 __ Drop(2); // Discard type arguments and receiver.
1340 } 1341 }
1341 1342
1342 1343
1343 #undef __ 1344 #undef __
1344 1345
1345 } // namespace dart 1346 } // namespace dart
OLDNEW
« no previous file with comments | « vm/intermediate_language.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698