| OLD | NEW |
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 799 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 810 HPhi* phi = phi_list[i]; | 810 HPhi* phi = phi_list[i]; |
| 811 if (!phi->is_live()) { | 811 if (!phi->is_live()) { |
| 812 HBasicBlock* block = phi->block(); | 812 HBasicBlock* block = phi->block(); |
| 813 block->RemovePhi(phi); | 813 block->RemovePhi(phi); |
| 814 block->RecordDeletedPhi(phi->merged_index()); | 814 block->RecordDeletedPhi(phi->merged_index()); |
| 815 } | 815 } |
| 816 } | 816 } |
| 817 } | 817 } |
| 818 | 818 |
| 819 | 819 |
| 820 bool HGraph::CheckPhis() { |
| 821 int block_count = blocks_.length(); |
| 822 for (int i = 0; i < block_count; ++i) { |
| 823 for (int j = 0; j < blocks_[i]->phis()->length(); ++j) { |
| 824 HPhi* phi = blocks_[i]->phis()->at(j); |
| 825 // We don't support phi uses of arguments for now. |
| 826 if (phi->CheckFlag(HValue::kIsArguments)) return false; |
| 827 } |
| 828 } |
| 829 return true; |
| 830 } |
| 831 |
| 832 |
| 820 bool HGraph::CollectPhis() { | 833 bool HGraph::CollectPhis() { |
| 821 int block_count = blocks_.length(); | 834 int block_count = blocks_.length(); |
| 822 phi_list_ = new ZoneList<HPhi*>(block_count); | 835 phi_list_ = new ZoneList<HPhi*>(block_count); |
| 823 for (int i = 0; i < block_count; ++i) { | 836 for (int i = 0; i < block_count; ++i) { |
| 824 for (int j = 0; j < blocks_[i]->phis()->length(); ++j) { | 837 for (int j = 0; j < blocks_[i]->phis()->length(); ++j) { |
| 825 HPhi* phi = blocks_[i]->phis()->at(j); | 838 HPhi* phi = blocks_[i]->phis()->at(j); |
| 826 phi_list_->Add(phi); | 839 phi_list_->Add(phi); |
| 827 // We don't support phi uses of arguments for now. | |
| 828 if (phi->CheckFlag(HValue::kIsArguments)) return false; | |
| 829 } | 840 } |
| 830 } | 841 } |
| 831 return true; | 842 return true; |
| 832 } | 843 } |
| 833 | 844 |
| 834 | 845 |
| 835 void HGraph::InferTypes(ZoneList<HValue*>* worklist) { | 846 void HGraph::InferTypes(ZoneList<HValue*>* worklist) { |
| 836 BitVector in_worklist(GetMaximumValueID()); | 847 BitVector in_worklist(GetMaximumValueID()); |
| 837 for (int i = 0; i < worklist->length(); ++i) { | 848 for (int i = 0; i < worklist->length(); ++i) { |
| 838 ASSERT(!in_worklist.Contains(worklist->at(i)->id())); | 849 ASSERT(!in_worklist.Contains(worklist->at(i)->id())); |
| (...skipping 1412 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2251 | 2262 |
| 2252 if (current_block() != NULL) { | 2263 if (current_block() != NULL) { |
| 2253 HReturn* instr = new(zone()) HReturn(graph()->GetConstantUndefined()); | 2264 HReturn* instr = new(zone()) HReturn(graph()->GetConstantUndefined()); |
| 2254 current_block()->FinishExit(instr); | 2265 current_block()->FinishExit(instr); |
| 2255 set_current_block(NULL); | 2266 set_current_block(NULL); |
| 2256 } | 2267 } |
| 2257 } | 2268 } |
| 2258 | 2269 |
| 2259 graph()->OrderBlocks(); | 2270 graph()->OrderBlocks(); |
| 2260 graph()->AssignDominators(); | 2271 graph()->AssignDominators(); |
| 2272 if (!graph()->CheckPhis()) { |
| 2273 Bailout("Unsupported phi use of arguments object"); |
| 2274 return NULL; |
| 2275 } |
| 2261 graph()->EliminateRedundantPhis(); | 2276 graph()->EliminateRedundantPhis(); |
| 2262 if (FLAG_eliminate_dead_phis) graph()->EliminateUnreachablePhis(); | 2277 if (FLAG_eliminate_dead_phis) graph()->EliminateUnreachablePhis(); |
| 2263 if (!graph()->CollectPhis()) { | 2278 if (!graph()->CollectPhis()) { |
| 2264 Bailout("Phi-use of arguments object"); | 2279 Bailout("Unsupported phi use of uninitialized constant"); |
| 2265 return NULL; | 2280 return NULL; |
| 2266 } | 2281 } |
| 2267 | 2282 |
| 2268 HInferRepresentation rep(graph()); | 2283 HInferRepresentation rep(graph()); |
| 2269 rep.Analyze(); | 2284 rep.Analyze(); |
| 2270 | 2285 |
| 2271 if (FLAG_use_range) { | 2286 if (FLAG_use_range) { |
| 2272 HRangeAnalysis rangeAnalysis(graph()); | 2287 HRangeAnalysis rangeAnalysis(graph()); |
| 2273 rangeAnalysis.Analyze(); | 2288 rangeAnalysis.Analyze(); |
| 2274 } | 2289 } |
| (...skipping 4020 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6295 } | 6310 } |
| 6296 } | 6311 } |
| 6297 | 6312 |
| 6298 #ifdef DEBUG | 6313 #ifdef DEBUG |
| 6299 if (graph_ != NULL) graph_->Verify(); | 6314 if (graph_ != NULL) graph_->Verify(); |
| 6300 if (allocator_ != NULL) allocator_->Verify(); | 6315 if (allocator_ != NULL) allocator_->Verify(); |
| 6301 #endif | 6316 #endif |
| 6302 } | 6317 } |
| 6303 | 6318 |
| 6304 } } // namespace v8::internal | 6319 } } // namespace v8::internal |
| OLD | NEW |