Reviewers: Benedikt Meurer,

Message:
PTAL

Description:
[arm64] Don't try convert binary operation to shifted form when both operands
are the same.

BUG=chromium:523307
LOG=N

Please review this at https://codereview.chromium.org/1304923003/

Base URL: https://chromium.googlesource.com/v8/v8.git@master

Affected files (+10, -6 lines):
  M src/arm64/lithium-arm64.cc
  A + test/mjsunit/regress/regress-crbug-523307.js


Index: src/arm64/lithium-arm64.cc
diff --git a/src/arm64/lithium-arm64.cc b/src/arm64/lithium-arm64.cc
index bdf49bfff009e94a0c66c33bd7c30ac5d940fb6b..63ae4214ffc7283759c52d825cb4defe57b5e456 100644
--- a/src/arm64/lithium-arm64.cc
+++ b/src/arm64/lithium-arm64.cc
@@ -2132,6 +2132,8 @@ HBitwiseBinaryOperation* LChunkBuilder::CanTransformToShiftedOp(HValue* val,
   DCHECK(hleft->representation().Equals(hinstr->representation()));
   DCHECK(hright->representation().Equals(hinstr->representation()));

+  if (hleft == hright) return NULL;
+
   if ((hright->IsConstant() &&
LikelyFitsImmField(hinstr, HConstant::cast(hright)->Integer32Value())) ||
       (hinstr->IsCommutative() && hleft->IsConstant() &&
Index: test/mjsunit/regress/regress-crbug-523307.js
diff --git a/test/mjsunit/regress/regress-filter-contexts.js b/test/mjsunit/regress/regress-crbug-523307.js
similarity index 72%
copy from test/mjsunit/regress/regress-filter-contexts.js
copy to test/mjsunit/regress/regress-crbug-523307.js
index d2abe0032548428324afd6675a7031bf53a5e56e..f2909675b2424c68c83fcf0b0f891467fcce851c 100644
--- a/test/mjsunit/regress/regress-filter-contexts.js
+++ b/test/mjsunit/regress/regress-crbug-523307.js
@@ -4,11 +4,13 @@

 // Flags: --allow-natives-syntax

-function f() { return f.x; }
-f.__proto__ = null;
-f.prototype = "";
+function f(x) {
+  var c = x * x << 366;
+  var a = c + c;
+  return a;
+}

-f();
-f();
+f(1);
+f(1);
 %OptimizeFunctionOnNextCall(f);
-f();
+f(1);


--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to