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

Side by Side Diff: src/hydrogen.cc

Issue 7553006: Check for phi-uses of arguments object before eliminating dead phi's. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 9 years, 4 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 | « src/hydrogen.h ('k') | test/mjsunit/regress/regress-1582.js » ('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 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 822 matching lines...) Expand 10 before | Expand all | Expand 10 after
833 HPhi* phi = phi_list[i]; 833 HPhi* phi = phi_list[i];
834 if (!phi->is_live()) { 834 if (!phi->is_live()) {
835 HBasicBlock* block = phi->block(); 835 HBasicBlock* block = phi->block();
836 block->RemovePhi(phi); 836 block->RemovePhi(phi);
837 block->RecordDeletedPhi(phi->merged_index()); 837 block->RecordDeletedPhi(phi->merged_index());
838 } 838 }
839 } 839 }
840 } 840 }
841 841
842 842
843 bool HGraph::CheckPhis() {
844 int block_count = blocks_.length();
845 for (int i = 0; i < block_count; ++i) {
846 for (int j = 0; j < blocks_[i]->phis()->length(); ++j) {
847 HPhi* phi = blocks_[i]->phis()->at(j);
848 // We don't support phi uses of arguments for now.
849 if (phi->CheckFlag(HValue::kIsArguments)) return false;
850 }
851 }
852 return true;
853 }
854
855
843 bool HGraph::CollectPhis() { 856 bool HGraph::CollectPhis() {
844 int block_count = blocks_.length(); 857 int block_count = blocks_.length();
845 phi_list_ = new ZoneList<HPhi*>(block_count); 858 phi_list_ = new ZoneList<HPhi*>(block_count);
846 for (int i = 0; i < block_count; ++i) { 859 for (int i = 0; i < block_count; ++i) {
847 for (int j = 0; j < blocks_[i]->phis()->length(); ++j) { 860 for (int j = 0; j < blocks_[i]->phis()->length(); ++j) {
848 HPhi* phi = blocks_[i]->phis()->at(j); 861 HPhi* phi = blocks_[i]->phis()->at(j);
849 phi_list_->Add(phi); 862 phi_list_->Add(phi);
850 // We don't support phi uses of arguments for now.
851 if (phi->CheckFlag(HValue::kIsArguments)) return false;
852 // Check for the hole value (from an uninitialized const). 863 // Check for the hole value (from an uninitialized const).
853 for (int k = 0; k < phi->OperandCount(); k++) { 864 for (int k = 0; k < phi->OperandCount(); k++) {
854 if (phi->OperandAt(k) == GetConstantHole()) return false; 865 if (phi->OperandAt(k) == GetConstantHole()) return false;
855 } 866 }
856 } 867 }
857 } 868 }
858 return true; 869 return true;
859 } 870 }
860 871
861 872
(...skipping 1431 matching lines...) Expand 10 before | Expand all | Expand 10 after
2293 if (current_block() != NULL) { 2304 if (current_block() != NULL) {
2294 HReturn* instr = new(zone()) HReturn(graph()->GetConstantUndefined()); 2305 HReturn* instr = new(zone()) HReturn(graph()->GetConstantUndefined());
2295 current_block()->FinishExit(instr); 2306 current_block()->FinishExit(instr);
2296 set_current_block(NULL); 2307 set_current_block(NULL);
2297 } 2308 }
2298 } 2309 }
2299 2310
2300 graph()->OrderBlocks(); 2311 graph()->OrderBlocks();
2301 graph()->AssignDominators(); 2312 graph()->AssignDominators();
2302 graph()->PropagateDeoptimizingMark(); 2313 graph()->PropagateDeoptimizingMark();
2314 if (!graph()->CheckPhis()) {
2315 Bailout("Unsupported phi-use");
Kevin Millikin (Chromium) 2011/08/02 09:21:25 1. There should be a unique bailout reason (to di
Vyacheslav Egorov (Chromium) 2011/08/02 09:26:23 1. Done. 2. I don't think HasStackOverflow is pret
2316 return NULL;
2317 }
2303 graph()->EliminateRedundantPhis(); 2318 graph()->EliminateRedundantPhis();
2304 if (FLAG_eliminate_dead_phis) graph()->EliminateUnreachablePhis(); 2319 if (FLAG_eliminate_dead_phis) graph()->EliminateUnreachablePhis();
2305 if (!graph()->CollectPhis()) { 2320 if (!graph()->CollectPhis()) {
2306 Bailout("Unsupported phi-use"); 2321 Bailout("Unsupported phi-use");
2307 return NULL; 2322 return NULL;
2308 } 2323 }
2309 2324
2310 HInferRepresentation rep(graph()); 2325 HInferRepresentation rep(graph());
2311 rep.Analyze(); 2326 rep.Analyze();
2312 2327
(...skipping 4418 matching lines...) Expand 10 before | Expand all | Expand 10 after
6731 } 6746 }
6732 } 6747 }
6733 6748
6734 #ifdef DEBUG 6749 #ifdef DEBUG
6735 if (graph_ != NULL) graph_->Verify(); 6750 if (graph_ != NULL) graph_->Verify();
6736 if (allocator_ != NULL) allocator_->Verify(); 6751 if (allocator_ != NULL) allocator_->Verify();
6737 #endif 6752 #endif
6738 } 6753 }
6739 6754
6740 } } // namespace v8::internal 6755 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/hydrogen.h ('k') | test/mjsunit/regress/regress-1582.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698