Improve alias analysis for HConstants (and fix small snafu in MustAlias).
authortitzer@chromium.org <titzer@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Wed, 11 Sep 2013 12:59:07 +0000 (12:59 +0000)
committertitzer@chromium.org <titzer@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Wed, 11 Sep 2013 12:59:07 +0000 (12:59 +0000)
BUG=
R=verwaest@chromium.org

Review URL: https://codereview.chromium.org/24107003

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@16651 ce2b1a6d-e550-0410-aec6-3dcde31c8c00

src/hydrogen-alias-analysis.h

index 4478501..73e116e 100644 (file)
@@ -65,7 +65,11 @@ class HAliasAnalyzer : public ZoneObject {
       if (a->IsConstant()) return kNoAlias;
     }
 
-    // TODO(titzer): return MustAlias for two equivalent constants.
+    // Constant objects can be distinguished statically.
+    if (a->IsConstant()) {
+      // TODO(titzer): DataEquals() is more efficient, but that's protected.
+      return a->Equals(b) ? kMustAlias : kNoAlias;
+    }
     return kMayAlias;
   }
 
@@ -78,7 +82,7 @@ class HAliasAnalyzer : public ZoneObject {
   }
 
   inline bool MustAlias(HValue* a, HValue* b) {
-    return Query(a, b) == kMayAlias;
+    return Query(a, b) == kMustAlias;
   }
 
   inline bool NoAlias(HValue* a, HValue* b) {