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

Side by Side Diff: src/hydrogen.cc

Issue 9416092: Eliminate use of ZONE macro in BitVector class and pass a zone explicitly. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 8 years, 10 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
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 428 matching lines...) Expand 10 before | Expand all | Expand 10 after
439 // from the start block of the graph. If "dont_visit" is non-null, the given 439 // from the start block of the graph. If "dont_visit" is non-null, the given
440 // block is treated as if it would not be part of the graph. "visited_count()" 440 // block is treated as if it would not be part of the graph. "visited_count()"
441 // returns the number of reachable blocks. 441 // returns the number of reachable blocks.
442 class ReachabilityAnalyzer BASE_EMBEDDED { 442 class ReachabilityAnalyzer BASE_EMBEDDED {
443 public: 443 public:
444 ReachabilityAnalyzer(HBasicBlock* entry_block, 444 ReachabilityAnalyzer(HBasicBlock* entry_block,
445 int block_count, 445 int block_count,
446 HBasicBlock* dont_visit) 446 HBasicBlock* dont_visit)
447 : visited_count_(0), 447 : visited_count_(0),
448 stack_(16), 448 stack_(16),
449 reachable_(block_count), 449 reachable_(block_count, ZONE),
450 dont_visit_(dont_visit) { 450 dont_visit_(dont_visit) {
451 PushBlock(entry_block); 451 PushBlock(entry_block);
452 Analyze(); 452 Analyze();
453 } 453 }
454 454
455 int visited_count() const { return visited_count_; } 455 int visited_count() const { return visited_count_; }
456 const BitVector* reachable() const { return &reachable_; } 456 const BitVector* reachable() const { return &reachable_; }
457 457
458 private: 458 private:
459 void PushBlock(HBasicBlock* block) { 459 void PushBlock(HBasicBlock* block) {
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after
737 HValue* value = instr->Canonicalize(); 737 HValue* value = instr->Canonicalize();
738 if (value != instr) instr->DeleteAndReplaceWith(value); 738 if (value != instr) instr->DeleteAndReplaceWith(value);
739 instr = instr->next(); 739 instr = instr->next();
740 } 740 }
741 } 741 }
742 } 742 }
743 743
744 744
745 void HGraph::OrderBlocks() { 745 void HGraph::OrderBlocks() {
746 HPhase phase("Block ordering"); 746 HPhase phase("Block ordering");
747 BitVector visited(blocks_.length()); 747 BitVector visited(blocks_.length(), zone());
748 748
749 ZoneList<HBasicBlock*> reverse_result(8); 749 ZoneList<HBasicBlock*> reverse_result(8);
750 HBasicBlock* start = blocks_[0]; 750 HBasicBlock* start = blocks_[0];
751 Postorder(start, &visited, &reverse_result, NULL); 751 Postorder(start, &visited, &reverse_result, NULL);
752 752
753 blocks_.Rewind(0); 753 blocks_.Rewind(0);
754 int index = 0; 754 int index = 0;
755 for (int i = reverse_result.length() - 1; i >= 0; --i) { 755 for (int i = reverse_result.length() - 1; i >= 0; --i) {
756 HBasicBlock* b = reverse_result[i]; 756 HBasicBlock* b = reverse_result[i];
757 blocks_.Add(b); 757 blocks_.Add(b);
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
948 for (int i = 0; i < block_count; ++i) { 948 for (int i = 0; i < block_count; ++i) {
949 for (int j = 0; j < blocks_[i]->phis()->length(); ++j) { 949 for (int j = 0; j < blocks_[i]->phis()->length(); ++j) {
950 HPhi* phi = blocks_[i]->phis()->at(j); 950 HPhi* phi = blocks_[i]->phis()->at(j);
951 phi_list_->Add(phi); 951 phi_list_->Add(phi);
952 } 952 }
953 } 953 }
954 } 954 }
955 955
956 956
957 void HGraph::InferTypes(ZoneList<HValue*>* worklist) { 957 void HGraph::InferTypes(ZoneList<HValue*>* worklist) {
958 BitVector in_worklist(GetMaximumValueID()); 958 BitVector in_worklist(GetMaximumValueID(), zone());
959 for (int i = 0; i < worklist->length(); ++i) { 959 for (int i = 0; i < worklist->length(); ++i) {
960 ASSERT(!in_worklist.Contains(worklist->at(i)->id())); 960 ASSERT(!in_worklist.Contains(worklist->at(i)->id()));
961 in_worklist.Add(worklist->at(i)->id()); 961 in_worklist.Add(worklist->at(i)->id());
962 } 962 }
963 963
964 while (!worklist->is_empty()) { 964 while (!worklist->is_empty()) {
965 HValue* current = worklist->RemoveLast(); 965 HValue* current = worklist->RemoveLast();
966 in_worklist.Remove(current->id()); 966 in_worklist.Remove(current->id());
967 if (current->UpdateInferredType()) { 967 if (current->UpdateInferredType()) {
968 for (HUseIterator it(current->uses()); !it.Done(); it.Advance()) { 968 for (HUseIterator it(current->uses()); !it.Done(); it.Advance()) {
(...skipping 743 matching lines...) Expand 10 before | Expand all | Expand 10 after
1712 dominated)); 1712 dominated));
1713 } 1713 }
1714 AnalyzeBlock(dominated, successor_map); 1714 AnalyzeBlock(dominated, successor_map);
1715 } 1715 }
1716 } 1716 }
1717 1717
1718 1718
1719 class HInferRepresentation BASE_EMBEDDED { 1719 class HInferRepresentation BASE_EMBEDDED {
1720 public: 1720 public:
1721 explicit HInferRepresentation(HGraph* graph) 1721 explicit HInferRepresentation(HGraph* graph)
1722 : graph_(graph), worklist_(8), in_worklist_(graph->GetMaximumValueID()) {} 1722 : graph_(graph),
1723 worklist_(8),
1724 in_worklist_(graph->GetMaximumValueID(), graph->zone()) { }
1723 1725
1724 void Analyze(); 1726 void Analyze();
1725 1727
1726 private: 1728 private:
1727 Representation TryChange(HValue* current); 1729 Representation TryChange(HValue* current);
1728 void AddToWorklist(HValue* current); 1730 void AddToWorklist(HValue* current);
1729 void InferBasedOnInputs(HValue* current); 1731 void InferBasedOnInputs(HValue* current);
1730 void AddDependantsToWorklist(HValue* current); 1732 void AddDependantsToWorklist(HValue* current);
1731 void InferBasedOnUses(HValue* current); 1733 void InferBasedOnUses(HValue* current);
1732 1734
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
1829 void HInferRepresentation::Analyze() { 1831 void HInferRepresentation::Analyze() {
1830 HPhase phase("Infer representations", graph_); 1832 HPhase phase("Infer representations", graph_);
1831 1833
1832 // (1) Initialize bit vectors and count real uses. Each phi gets a 1834 // (1) Initialize bit vectors and count real uses. Each phi gets a
1833 // bit-vector of length <number of phis>. 1835 // bit-vector of length <number of phis>.
1834 const ZoneList<HPhi*>* phi_list = graph_->phi_list(); 1836 const ZoneList<HPhi*>* phi_list = graph_->phi_list();
1835 int phi_count = phi_list->length(); 1837 int phi_count = phi_list->length();
1836 ZoneList<BitVector*> connected_phis(phi_count); 1838 ZoneList<BitVector*> connected_phis(phi_count);
1837 for (int i = 0; i < phi_count; ++i) { 1839 for (int i = 0; i < phi_count; ++i) {
1838 phi_list->at(i)->InitRealUses(i); 1840 phi_list->at(i)->InitRealUses(i);
1839 BitVector* connected_set = new(zone()) BitVector(phi_count); 1841 BitVector* connected_set = new(zone()) BitVector(phi_count, graph_->zone());
1840 connected_set->Add(i); 1842 connected_set->Add(i);
1841 connected_phis.Add(connected_set); 1843 connected_phis.Add(connected_set);
1842 } 1844 }
1843 1845
1844 // (2) Do a fixed point iteration to find the set of connected phis. A 1846 // (2) Do a fixed point iteration to find the set of connected phis. A
1845 // phi is connected to another phi if its value is used either directly or 1847 // phi is connected to another phi if its value is used either directly or
1846 // indirectly through a transitive closure of the def-use relation. 1848 // indirectly through a transitive closure of the def-use relation.
1847 bool change = true; 1849 bool change = true;
1848 while (change) { 1850 while (change) {
1849 change = false; 1851 change = false;
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after
2119 RecursivelyMarkPhiDeoptimizeOnUndefined(phi); 2121 RecursivelyMarkPhiDeoptimizeOnUndefined(phi);
2120 break; 2122 break;
2121 } 2123 }
2122 } 2124 }
2123 } 2125 }
2124 } 2126 }
2125 } 2127 }
2126 2128
2127 2129
2128 void HGraph::ComputeMinusZeroChecks() { 2130 void HGraph::ComputeMinusZeroChecks() {
2129 BitVector visited(GetMaximumValueID()); 2131 BitVector visited(GetMaximumValueID(), zone());
2130 for (int i = 0; i < blocks_.length(); ++i) { 2132 for (int i = 0; i < blocks_.length(); ++i) {
2131 for (HInstruction* current = blocks_[i]->first(); 2133 for (HInstruction* current = blocks_[i]->first();
2132 current != NULL; 2134 current != NULL;
2133 current = current->next()) { 2135 current = current->next()) {
2134 if (current->IsChange()) { 2136 if (current->IsChange()) {
2135 HChange* change = HChange::cast(current); 2137 HChange* change = HChange::cast(current);
2136 // Propagate flags for negative zero checks upwards from conversions 2138 // Propagate flags for negative zero checks upwards from conversions
2137 // int32-to-tagged and int32-to-double. 2139 // int32-to-tagged and int32-to-double.
2138 Representation from = change->value()->representation(); 2140 Representation from = change->value()->representation();
2139 ASSERT(from.Equals(change->from())); 2141 ASSERT(from.Equals(change->from()));
(...skipping 5629 matching lines...) Expand 10 before | Expand all | Expand 10 after
7769 } 7771 }
7770 } 7772 }
7771 7773
7772 #ifdef DEBUG 7774 #ifdef DEBUG
7773 if (graph_ != NULL) graph_->Verify(false); // No full verify. 7775 if (graph_ != NULL) graph_->Verify(false); // No full verify.
7774 if (allocator_ != NULL) allocator_->Verify(); 7776 if (allocator_ != NULL) allocator_->Verify();
7775 #endif 7777 #endif
7776 } 7778 }
7777 7779
7778 } } // namespace v8::internal 7780 } } // namespace v8::internal
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698