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

Side by Side Diff: vm/flow_graph_optimizer.cc

Issue 10665022: Make IL instructions a doubly-linked list within basic blocks. (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/flow_graph_compiler.cc ('k') | vm/il_printer.cc » ('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) 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/flow_graph_optimizer.h" 5 #include "vm/flow_graph_optimizer.h"
6 6
7 #include "vm/flow_graph_builder.h" 7 #include "vm/flow_graph_builder.h"
8 #include "vm/il_printer.h" 8 #include "vm/il_printer.h"
9 #include "vm/object_store.h" 9 #include "vm/object_store.h"
10 10
(...skipping 514 matching lines...) Expand 10 before | Expand all | Expand 10 after
525 switch (class_id) { 525 switch (class_id) {
526 case kArray: 526 case kArray:
527 case kGrowableObjectArray: 527 case kGrowableObjectArray:
528 comp->set_receiver_type(static_cast<ObjectKind>(class_id)); 528 comp->set_receiver_type(static_cast<ObjectKind>(class_id));
529 } 529 }
530 } 530 }
531 531
532 532
533 static void TryFuseComparisonWithBranch(ComparisonComp* comp) { 533 static void TryFuseComparisonWithBranch(ComparisonComp* comp) {
534 Instruction* instr = comp->instr(); 534 Instruction* instr = comp->instr();
535 Instruction* next_instr = instr->StraightLineSuccessor(); 535 Instruction* next_instr = instr->successor();
536 if ((next_instr != NULL) && next_instr->IsBranch()) { 536 if ((next_instr != NULL) && next_instr->IsBranch()) {
537 BranchInstr* branch = next_instr->AsBranch(); 537 BranchInstr* branch = next_instr->AsBranch();
538 UseVal* use = branch->value()->AsUse(); 538 UseVal* use = branch->value()->AsUse();
539 if (instr == use->definition()) { 539 if (instr == use->definition()) {
540 comp->MarkFusedWithBranch(branch); 540 comp->MarkFusedWithBranch(branch);
541 branch->MarkFusedWithComparison(); 541 branch->MarkFusedWithComparison();
542 return; 542 return;
543 } 543 }
544 } 544 }
545 if ((next_instr != NULL) && next_instr->IsBind()) { 545 if ((next_instr != NULL) && next_instr->IsBind()) {
546 Computation* next_comp = next_instr->AsBind()->computation(); 546 Computation* next_comp = next_instr->AsBind()->computation();
547 if (next_comp->IsBooleanNegate()) { 547 if (next_comp->IsBooleanNegate()) {
548 Instruction* next_next_instr = next_instr->StraightLineSuccessor(); 548 Instruction* next_next_instr = next_instr->successor();
549 if ((next_next_instr != NULL) && next_next_instr->IsBranch()) { 549 if ((next_next_instr != NULL) && next_next_instr->IsBranch()) {
550 BooleanNegateComp* negate = next_comp->AsBooleanNegate(); 550 BooleanNegateComp* negate = next_comp->AsBooleanNegate();
551 BranchInstr* branch = next_next_instr->AsBranch(); 551 BranchInstr* branch = next_next_instr->AsBranch();
552 if ((branch->value()->AsUse()->definition() == negate->instr()) && 552 if ((branch->value()->AsUse()->definition() == negate->instr()) &&
553 (negate->value()->AsUse()->definition() == instr)) { 553 (negate->value()->AsUse()->definition() == instr)) {
554 comp->MarkFusedWithBranch(branch); 554 comp->MarkFusedWithBranch(branch);
555 branch->MarkFusedWithComparison(); 555 branch->MarkFusedWithComparison();
556 branch->set_is_negated(true); 556 branch->set_is_negated(true);
557 instr->SetSuccessor(next_next_instr); 557 instr->set_successor(next_next_instr);
558 return; 558 return;
559 } 559 }
560 } 560 }
561 } 561 }
562 } 562 }
563 } 563 }
564 564
565 565
566 void FlowGraphOptimizer::VisitRelationalOp(RelationalOpComp* comp) { 566 void FlowGraphOptimizer::VisitRelationalOp(RelationalOpComp* comp) {
567 if (!comp->HasICData()) return; 567 if (!comp->HasICData()) return;
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
617 617
618 FlowGraphAnalyzer::FlowGraphAnalyzer( 618 FlowGraphAnalyzer::FlowGraphAnalyzer(
619 const GrowableArray<BlockEntryInstr*>& blocks) 619 const GrowableArray<BlockEntryInstr*>& blocks)
620 :blocks_(blocks), is_leaf_(false) {} 620 :blocks_(blocks), is_leaf_(false) {}
621 621
622 622
623 void FlowGraphAnalyzer::Analyze() { 623 void FlowGraphAnalyzer::Analyze() {
624 is_leaf_ = true; 624 is_leaf_ = true;
625 for (intptr_t i = 0; i < blocks_.length(); ++i) { 625 for (intptr_t i = 0; i < blocks_.length(); ++i) {
626 BlockEntryInstr* block_entry = blocks_[i]; 626 BlockEntryInstr* block_entry = blocks_[i];
627 Instruction* instr = block_entry->StraightLineSuccessor(); 627 Instruction* instr = block_entry->successor();
628 while ((instr != NULL) && !instr->IsBlockEntry()) { 628 while ((instr != NULL) && !instr->IsBlockEntry()) {
629 LocationSummary* locs = instr->locs(); 629 LocationSummary* locs = instr->locs();
630 if (locs != NULL) { 630 if (locs != NULL) {
631 if (locs->is_call()) { 631 if (locs->is_call()) {
632 is_leaf_ = false; 632 is_leaf_ = false;
633 return; 633 return;
634 } 634 }
635 } 635 }
636 instr = instr->StraightLineSuccessor(); 636 instr = instr->successor();
637 } 637 }
638 } 638 }
639 } 639 }
640 640
641 } // namespace dart 641 } // namespace dart
OLDNEW
« no previous file with comments | « vm/flow_graph_compiler.cc ('k') | vm/il_printer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698