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

Unified Diff: src/hydrogen.cc

Issue 18758003: Turn canonicalization into a proper HPhase. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/hydrogen.h ('k') | src/hydrogen-canonicalize.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/hydrogen.cc
diff --git a/src/hydrogen.cc b/src/hydrogen.cc
index 1b113305ef14714e6ad984ef73fea859c405d2ce..ae0c9ac9c84f40a9b3131b4208f2f9ce7f349b9a 100644
--- a/src/hydrogen.cc
+++ b/src/hydrogen.cc
@@ -34,6 +34,7 @@
#include "full-codegen.h"
#include "hashmap.h"
#include "hydrogen-bce.h"
+#include "hydrogen-canonicalize.h"
#include "hydrogen-dce.h"
#include "hydrogen-environment-liveness.h"
#include "hydrogen-escape-analysis.h"
@@ -2090,33 +2091,6 @@ void HGraph::FinalizeUniqueValueIds() {
}
-void HGraph::Canonicalize() {
- HPhase phase("H_Canonicalize", this);
- // Before removing no-op instructions, save their semantic value.
- // We must be careful not to set the flag unnecessarily, because GVN
- // cannot identify two instructions when their flag value differs.
- for (int i = 0; i < blocks()->length(); ++i) {
- for (HInstructionIterator it(blocks()->at(i)); !it.Done(); it.Advance()) {
- HInstruction* instr = it.Current();
- if (instr->IsArithmeticBinaryOperation() &&
- instr->representation().IsInteger32() &&
- instr->HasAtLeastOneUseWithFlagAndNoneWithout(
- HInstruction::kTruncatingToInt32)) {
- instr->SetFlag(HInstruction::kAllUsesTruncatingToInt32);
- }
- }
- }
- // Perform actual Canonicalization pass.
- for (int i = 0; i < blocks()->length(); ++i) {
- for (HInstructionIterator it(blocks()->at(i)); !it.Done(); it.Advance()) {
- HInstruction* instr = it.Current();
- HValue* value = instr->Canonicalize();
- if (value != instr) instr->DeleteAndReplaceWith(value);
- }
- }
-}
-
-
// Block ordering was implemented with two mutually recursive methods,
// HGraph::Postorder and HGraph::PostorderLoopBlocks.
// The recursion could lead to stack overflow so the algorithm has been
@@ -3149,7 +3123,7 @@ bool HGraph::Optimize(SmartArrayPointer<char>* bailout_reason) {
// zero.
if (FLAG_opt_safe_uint32_operations) Run<HUint32AnalysisPhase>();
- if (FLAG_use_canonicalizing) Canonicalize();
+ if (FLAG_use_canonicalizing) Run<HCanonicalizePhase>();
if (FLAG_use_escape_analysis) Run<HEscapeAnalysisPhase>();
« no previous file with comments | « src/hydrogen.h ('k') | src/hydrogen-canonicalize.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698