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

Side by Side Diff: src/hydrogen.cc

Issue 14260013: Detect truncating Phi uses of Phis with constant inputs (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 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
« no previous file with comments | « no previous file | src/hydrogen-instructions.cc » ('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 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 3744 matching lines...) Expand 10 before | Expand all | Expand 10 after
3755 HValue* use = it.value(); 3755 HValue* use = it.value();
3756 if (use->IsPhi()) { 3756 if (use->IsPhi()) {
3757 int id = HPhi::cast(use)->phi_id(); 3757 int id = HPhi::cast(use)->phi_id();
3758 if (connected_phis[i]->UnionIsChanged(*connected_phis[id])) 3758 if (connected_phis[i]->UnionIsChanged(*connected_phis[id]))
3759 change = true; 3759 change = true;
3760 } 3760 }
3761 } 3761 }
3762 } 3762 }
3763 } 3763 }
3764 3764
3765 // Set truncation flags for groups of connected phis. This is a conservative
3766 // approximation; the flag will be properly re-computed after representations
3767 // have been determined.
3768 if (phi_count > 0) {
3769 BitVector* done = new(zone()) BitVector(phi_count, graph_->zone());
3770 for (int i = 0; i < phi_count; ++i) {
3771 if (done->Contains(i)) continue;
3772
3773 // Check if all uses of all connected phis in this group are truncating.
3774 bool all_uses_everywhere_truncating = true;
3775 for (BitVector::Iterator it(connected_phis.at(i));
3776 !it.Done();
3777 it.Advance()) {
3778 int index = it.Current();
3779 all_uses_everywhere_truncating &=
3780 phi_list->at(index)->CheckFlag(HInstruction::kTruncatingToInt32);
3781 done->Add(index);
3782 }
3783 if (all_uses_everywhere_truncating) {
3784 continue; // Great, nothing to do.
3785 }
3786 // Clear truncation flag of this group of connected phis.
3787 for (BitVector::Iterator it(connected_phis.at(i));
3788 !it.Done();
3789 it.Advance()) {
3790 int index = it.Current();
3791 phi_list->at(index)->ClearFlag(HInstruction::kTruncatingToInt32);
3792 }
3793 }
3794 }
3795
3765 // Simplify constant phi inputs where possible. 3796 // Simplify constant phi inputs where possible.
3797 // This step uses kTruncatingToInt32 flags of phis.
3766 for (int i = 0; i < phi_count; ++i) { 3798 for (int i = 0; i < phi_count; ++i) {
3767 phi_list->at(i)->SimplifyConstantInputs(); 3799 phi_list->at(i)->SimplifyConstantInputs();
3768 } 3800 }
3769 3801
3770 // Use the phi reachability information from step 2 to 3802 // Use the phi reachability information from step 2 to
3771 // push information about values which can't be converted to integer 3803 // push information about values which can't be converted to integer
3772 // without deoptimization through the phi use-def chains, avoiding 3804 // without deoptimization through the phi use-def chains, avoiding
3773 // unnecessary deoptimizations later. 3805 // unnecessary deoptimizations later.
3774 for (int i = 0; i < phi_count; ++i) { 3806 for (int i = 0; i < phi_count; ++i) {
3775 HPhi* phi = phi_list->at(i); 3807 HPhi* phi = phi_list->at(i);
(...skipping 8441 matching lines...) Expand 10 before | Expand all | Expand 10 after
12217 } 12249 }
12218 } 12250 }
12219 12251
12220 #ifdef DEBUG 12252 #ifdef DEBUG
12221 if (graph_ != NULL) graph_->Verify(false); // No full verify. 12253 if (graph_ != NULL) graph_->Verify(false); // No full verify.
12222 if (allocator_ != NULL) allocator_->Verify(); 12254 if (allocator_ != NULL) allocator_->Verify();
12223 #endif 12255 #endif
12224 } 12256 }
12225 12257
12226 } } // namespace v8::internal 12258 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | src/hydrogen-instructions.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698