Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 509 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 520 successor()->IsBlockEntry()); | 520 successor()->IsBlockEntry()); |
| 521 return successor() != NULL ? 1 : 0; | 521 return successor() != NULL ? 1 : 0; |
| 522 } | 522 } |
| 523 | 523 |
| 524 | 524 |
| 525 BlockEntryInstr* Instruction::SuccessorAt(intptr_t index) const { | 525 BlockEntryInstr* Instruction::SuccessorAt(intptr_t index) const { |
| 526 return successor()->AsBlockEntry(); | 526 return successor()->AsBlockEntry(); |
| 527 } | 527 } |
| 528 | 528 |
| 529 | 529 |
| 530 Instruction* Instruction::RemoveFromGraph() { | 530 Instruction* Instruction::RemoveFromGraph(RemoveReturnValue ret) { |
|
Kevin Millikin (Google)
2012/07/06 10:44:30
Do you think we could (should) get rid of this fun
| |
| 531 ASSERT(!IsBlockEntry()); | 531 ASSERT(!IsBlockEntry()); |
| 532 ASSERT(!IsBranch()); | 532 ASSERT(!IsBranch()); |
| 533 ASSERT(!IsThrow()); | 533 ASSERT(!IsThrow()); |
| 534 ASSERT(!IsReturn()); | 534 ASSERT(!IsReturn()); |
| 535 ASSERT(!IsReThrow()); | 535 ASSERT(!IsReThrow()); |
| 536 ASSERT(previous() != NULL); | 536 ASSERT(previous() != NULL); |
| 537 Instruction* next = successor(); | 537 Instruction* next = successor(); |
| 538 previous()->set_successor(next); | 538 Instruction* prev = previous(); |
| 539 prev->set_successor(next); | |
| 539 if (next != NULL) { | 540 if (next != NULL) { |
| 540 if (!next->IsBlockEntry()) { | 541 if (!next->IsBlockEntry()) { |
| 541 next->set_previous(previous()); | 542 next->set_previous(prev); |
| 542 } else { | 543 } else { |
| 543 // Removing the last instruction of a block. | 544 // Removing the last instruction of a block. |
| 544 // Update last_instruction of the current basic block. | 545 // Update last_instruction of the current basic block. |
| 545 Instruction* current = this; | 546 Instruction* current = this; |
| 546 while (!current->IsBlockEntry()) { | 547 while (!current->IsBlockEntry()) { |
| 547 current = current->previous(); | 548 current = current->previous(); |
| 548 } | 549 } |
| 549 ASSERT(current->AsBlockEntry()->last_instruction() == this); | 550 ASSERT(current->AsBlockEntry()->last_instruction() == this); |
| 550 current->AsBlockEntry()->set_last_instruction(previous()); | 551 current->AsBlockEntry()->set_last_instruction(prev); |
| 551 } | 552 } |
| 552 } | 553 } |
| 553 // Reset successor and previous instruction to indicate | 554 // Reset successor and previous instruction to indicate |
| 554 // that the instruction is removed from the graph. | 555 // that the instruction is removed from the graph. |
| 555 set_successor(NULL); | 556 set_successor(NULL); |
| 556 set_previous(NULL); | 557 set_previous(NULL); |
| 557 return next; | 558 return ret == kReturnPrevious ? prev : next; |
| 558 } | 559 } |
| 559 | 560 |
| 560 | 561 |
| 561 intptr_t GraphEntryInstr::SuccessorCount() const { | 562 intptr_t GraphEntryInstr::SuccessorCount() const { |
| 562 return 1 + catch_entries_.length(); | 563 return 1 + catch_entries_.length(); |
| 563 } | 564 } |
| 564 | 565 |
| 565 | 566 |
| 566 BlockEntryInstr* GraphEntryInstr::SuccessorAt(intptr_t index) const { | 567 BlockEntryInstr* GraphEntryInstr::SuccessorAt(intptr_t index) const { |
| 567 if (index == 0) return normal_entry_; | 568 if (index == 0) return normal_entry_; |
| (...skipping 764 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1332 const ExternalLabel label(closure_function.ToCString(), stub.EntryPoint()); | 1333 const ExternalLabel label(closure_function.ToCString(), stub.EntryPoint()); |
| 1333 compiler->GenerateCall(token_pos(), try_index(), &label, | 1334 compiler->GenerateCall(token_pos(), try_index(), &label, |
| 1334 PcDescriptors::kOther); | 1335 PcDescriptors::kOther); |
| 1335 __ Drop(2); // Discard type arguments and receiver. | 1336 __ Drop(2); // Discard type arguments and receiver. |
| 1336 } | 1337 } |
| 1337 | 1338 |
| 1338 | 1339 |
| 1339 #undef __ | 1340 #undef __ |
| 1340 | 1341 |
| 1341 } // namespace dart | 1342 } // namespace dart |
| OLD | NEW |