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

Side by Side Diff: src/lithium-allocator.cc

Issue 7008011: First step in refactoring hydrogen control instructions. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 9 years, 7 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
« src/hydrogen-instructions.h ('K') | « src/hydrogen-instructions.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 2010 the V8 project authors. All rights reserved. 1 // Copyright 2010 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 547 matching lines...) Expand 10 before | Expand all | Expand 10 after
558 live_in_sets_.AddBlock(NULL, block_count); 558 live_in_sets_.AddBlock(NULL, block_count);
559 } 559 }
560 560
561 561
562 BitVector* LAllocator::ComputeLiveOut(HBasicBlock* block) { 562 BitVector* LAllocator::ComputeLiveOut(HBasicBlock* block) {
563 // Compute live out for the given block, except not including backward 563 // Compute live out for the given block, except not including backward
564 // successor edges. 564 // successor edges.
565 BitVector* live_out = new BitVector(next_virtual_register_); 565 BitVector* live_out = new BitVector(next_virtual_register_);
566 566
567 // Process all successor blocks. 567 // Process all successor blocks.
568 HBasicBlock* successor = block->end()->FirstSuccessor(); 568 for (HSuccessorIterator it(block->end()); it.HasNext(); it.Advance()) {
569 while (successor != NULL) {
570 // Add values live on entry to the successor. Note the successor's 569 // Add values live on entry to the successor. Note the successor's
571 // live_in will not be computed yet for backwards edges. 570 // live_in will not be computed yet for backwards edges.
571 HBasicBlock* successor = it.Next();
572 BitVector* live_in = live_in_sets_[successor->block_id()]; 572 BitVector* live_in = live_in_sets_[successor->block_id()];
573 if (live_in != NULL) live_out->Union(*live_in); 573 if (live_in != NULL) live_out->Union(*live_in);
574 574
575 // All phi input operands corresponding to this successor edge are live 575 // All phi input operands corresponding to this successor edge are live
576 // out from this block. 576 // out from this block.
577 int index = successor->PredecessorIndexOf(block); 577 int index = successor->PredecessorIndexOf(block);
578 const ZoneList<HPhi*>* phis = successor->phis(); 578 const ZoneList<HPhi*>* phis = successor->phis();
579 for (int i = 0; i < phis->length(); ++i) { 579 for (int i = 0; i < phis->length(); ++i) {
580 HPhi* phi = phis->at(i); 580 HPhi* phi = phis->at(i);
581 if (!phi->OperandAt(index)->IsConstant()) { 581 if (!phi->OperandAt(index)->IsConstant()) {
582 live_out->Add(phi->OperandAt(index)->id()); 582 live_out->Add(phi->OperandAt(index)->id());
583 } 583 }
584 } 584 }
585
586 // Check if we are done with second successor.
587 if (successor == block->end()->SecondSuccessor()) break;
588
589 successor = block->end()->SecondSuccessor();
590 } 585 }
591 586
592 return live_out; 587 return live_out;
593 } 588 }
594 589
595 590
596 void LAllocator::AddInitialIntervals(HBasicBlock* block, 591 void LAllocator::AddInitialIntervals(HBasicBlock* block,
597 BitVector* live_out) { 592 BitVector* live_out) {
598 // Add an interval that includes the entire block to the live range for 593 // Add an interval that includes the entire block to the live range for
599 // each live_out value. 594 // each live_out value.
(...skipping 1514 matching lines...) Expand 10 before | Expand all | Expand 10 after
2114 LiveRange* current = live_ranges()->at(i); 2109 LiveRange* current = live_ranges()->at(i);
2115 if (current != NULL) current->Verify(); 2110 if (current != NULL) current->Verify();
2116 } 2111 }
2117 } 2112 }
2118 2113
2119 2114
2120 #endif 2115 #endif
2121 2116
2122 2117
2123 } } // namespace v8::internal 2118 } } // namespace v8::internal
OLDNEW
« src/hydrogen-instructions.h ('K') | « src/hydrogen-instructions.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698