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 818 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
829 HPhi* phi = phi_list[i]; | 829 HPhi* phi = phi_list[i]; |
830 if (!phi->is_live()) { | 830 if (!phi->is_live()) { |
831 HBasicBlock* block = phi->block(); | 831 HBasicBlock* block = phi->block(); |
832 block->RemovePhi(phi); | 832 block->RemovePhi(phi); |
833 block->RecordDeletedPhi(phi->merged_index()); | 833 block->RecordDeletedPhi(phi->merged_index()); |
834 } | 834 } |
835 } | 835 } |
836 } | 836 } |
837 | 837 |
838 | 838 |
| 839 bool HGraph::CheckPhis() { |
| 840 int block_count = blocks_.length(); |
| 841 for (int i = 0; i < block_count; ++i) { |
| 842 for (int j = 0; j < blocks_[i]->phis()->length(); ++j) { |
| 843 HPhi* phi = blocks_[i]->phis()->at(j); |
| 844 // We don't support phi uses of arguments for now. |
| 845 if (phi->CheckFlag(HValue::kIsArguments)) return false; |
| 846 } |
| 847 } |
| 848 return true; |
| 849 } |
| 850 |
| 851 |
839 bool HGraph::CollectPhis() { | 852 bool HGraph::CollectPhis() { |
840 int block_count = blocks_.length(); | 853 int block_count = blocks_.length(); |
841 phi_list_ = new ZoneList<HPhi*>(block_count); | 854 phi_list_ = new ZoneList<HPhi*>(block_count); |
842 for (int i = 0; i < block_count; ++i) { | 855 for (int i = 0; i < block_count; ++i) { |
843 for (int j = 0; j < blocks_[i]->phis()->length(); ++j) { | 856 for (int j = 0; j < blocks_[i]->phis()->length(); ++j) { |
844 HPhi* phi = blocks_[i]->phis()->at(j); | 857 HPhi* phi = blocks_[i]->phis()->at(j); |
845 phi_list_->Add(phi); | 858 phi_list_->Add(phi); |
846 // We don't support phi uses of arguments for now. | |
847 if (phi->CheckFlag(HValue::kIsArguments)) return false; | |
848 // Check for the hole value (from an uninitialized const). | 859 // Check for the hole value (from an uninitialized const). |
849 for (int k = 0; k < phi->OperandCount(); k++) { | 860 for (int k = 0; k < phi->OperandCount(); k++) { |
850 if (phi->OperandAt(k) == GetConstantHole()) return false; | 861 if (phi->OperandAt(k) == GetConstantHole()) return false; |
851 } | 862 } |
852 } | 863 } |
853 } | 864 } |
854 return true; | 865 return true; |
855 } | 866 } |
856 | 867 |
857 | 868 |
(...skipping 1428 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2286 | 2297 |
2287 if (current_block() != NULL) { | 2298 if (current_block() != NULL) { |
2288 HReturn* instr = new(zone()) HReturn(graph()->GetConstantUndefined()); | 2299 HReturn* instr = new(zone()) HReturn(graph()->GetConstantUndefined()); |
2289 current_block()->FinishExit(instr); | 2300 current_block()->FinishExit(instr); |
2290 set_current_block(NULL); | 2301 set_current_block(NULL); |
2291 } | 2302 } |
2292 } | 2303 } |
2293 | 2304 |
2294 graph()->OrderBlocks(); | 2305 graph()->OrderBlocks(); |
2295 graph()->AssignDominators(); | 2306 graph()->AssignDominators(); |
| 2307 if (!graph()->CheckPhis()) { |
| 2308 Bailout("Unsupported phi use of arguments object"); |
| 2309 return NULL; |
| 2310 } |
2296 graph()->EliminateRedundantPhis(); | 2311 graph()->EliminateRedundantPhis(); |
2297 if (FLAG_eliminate_dead_phis) graph()->EliminateUnreachablePhis(); | 2312 if (FLAG_eliminate_dead_phis) graph()->EliminateUnreachablePhis(); |
2298 if (!graph()->CollectPhis()) { | 2313 if (!graph()->CollectPhis()) { |
2299 Bailout("Unsupported phi-use"); | 2314 Bailout("Unsupported phi use of uninitialized constant"); |
2300 return NULL; | 2315 return NULL; |
2301 } | 2316 } |
2302 | 2317 |
2303 HInferRepresentation rep(graph()); | 2318 HInferRepresentation rep(graph()); |
2304 rep.Analyze(); | 2319 rep.Analyze(); |
2305 | 2320 |
2306 if (FLAG_use_range) { | 2321 if (FLAG_use_range) { |
2307 HRangeAnalysis rangeAnalysis(graph()); | 2322 HRangeAnalysis rangeAnalysis(graph()); |
2308 rangeAnalysis.Analyze(); | 2323 rangeAnalysis.Analyze(); |
2309 } | 2324 } |
(...skipping 4434 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6744 } | 6759 } |
6745 } | 6760 } |
6746 | 6761 |
6747 #ifdef DEBUG | 6762 #ifdef DEBUG |
6748 if (graph_ != NULL) graph_->Verify(); | 6763 if (graph_ != NULL) graph_->Verify(); |
6749 if (allocator_ != NULL) allocator_->Verify(); | 6764 if (allocator_ != NULL) allocator_->Verify(); |
6750 #endif | 6765 #endif |
6751 } | 6766 } |
6752 | 6767 |
6753 } } // namespace v8::internal | 6768 } } // namespace v8::internal |
OLD | NEW |