Reviewers: danno,

Description:
Merged r16082 into trunk branch.

Fix Array index dehoisting.

BUG=264203
[email protected]

Please review this at https://chromiumcodereview.appspot.com/22841002/

SVN Base: https://v8.googlecode.com/svn/trunk

Affected files:
  M src/hydrogen-dehoist.cc
  M src/version.cc
  A + test/mjsunit/regress/regress-264203.js


Index: src/hydrogen-dehoist.cc
diff --git a/src/hydrogen-dehoist.cc b/src/hydrogen-dehoist.cc
index 696d22c608e5b707635b13229cf0046dda4c3e03..67e6718998319d24158e901c2683f145282eb927 100644
--- a/src/hydrogen-dehoist.cc
+++ b/src/hydrogen-dehoist.cc
@@ -38,7 +38,7 @@ static void DehoistArrayIndex(ArrayInstructionInterface* array_operation) {
   HConstant* constant;
   HValue* subexpression;
   HBinaryOperation* binary_operation = HBinaryOperation::cast(index);
-  if (binary_operation->left()->IsConstant()) {
+  if (binary_operation->left()->IsConstant() && index->IsAdd()) {
     subexpression = binary_operation->right();
     constant = HConstant::cast(binary_operation->left());
   } else if (binary_operation->right()->IsConstant()) {
Index: src/version.cc
diff --git a/src/version.cc b/src/version.cc
index a6cbeb8d6c72f890179fab5642a025d240306f5f..9a39439cca72c8af16664ff717ced92373f304cc 100644
--- a/src/version.cc
+++ b/src/version.cc
@@ -35,7 +35,7 @@
 #define MAJOR_VERSION     3
 #define MINOR_VERSION     20
 #define BUILD_NUMBER      15
-#define PATCH_LEVEL       1
+#define PATCH_LEVEL       2
 // Use 1 for candidates and 0 otherwise.
 // (Boolean macro values are not supported by all preprocessors.)
 #define IS_CANDIDATE_VERSION 0
Index: test/mjsunit/regress/regress-264203.js
diff --git a/test/mjsunit/regress/regress-171641.js b/test/mjsunit/regress/regress-264203.js
similarity index 89%
copy from test/mjsunit/regress/regress-171641.js
copy to test/mjsunit/regress/regress-264203.js
index 8db6781821325f8f6253eb2df4abb2b362b001c0..fa0075662575d85241b6af82c5945cca32938991 100644
--- a/test/mjsunit/regress/regress-171641.js
+++ b/test/mjsunit/regress/regress-264203.js
@@ -27,14 +27,18 @@

 // Flags: --allow-natives-syntax

-function foo(k, p) {
-  for (var i = 0; i < 1; i++) {
-    p = Math.min(p, i);
+function foo(x) {
+  var a = [1, 2, 3, 4, 5, 6, 7, 8];
+  a[x + 5];
+  var result;
+  for (var i = 0; i < 3; i++) {
+    result = a[0 - x];
   }
-  m = Math.floor((k | 0) / p);
+  return result;
 }

-foo(0, 1);
-foo(0, 1);
+foo(0);
+foo(0);
 %OptimizeFunctionOnNextCall(foo);
-foo(0, 1);
+var r = foo(-2);
+assertEquals(3, r);


--
--
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/groups/opt_out.


Reply via email to