Reviewers: Toon Verwaest,

Message:
PTAL

Description:
Fix for a smi stores optimization on x64 with a regression test.

BUG=345715
LOG=N

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

SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge

Affected files (+22, -15 lines):
  M src/hydrogen.cc
  A + test/mjsunit/regress/regress-crbug-345715.js


Index: src/hydrogen.cc
diff --git a/src/hydrogen.cc b/src/hydrogen.cc
index d40c37b0685ed649d6af811fd92c65b00b12645c..1d437e7b4609fb2a581e53058c12b69ce92bc2b0 100644
--- a/src/hydrogen.cc
+++ b/src/hydrogen.cc
@@ -9924,9 +9924,11 @@ void HOptimizedGraphBuilder::BuildEmitInObjectProperties( Add<HStoreNamedField>(double_box, HObjectAccess::ForHeapNumberValue(),
                               Add<HConstant>(value));
         value_instruction = double_box;
-      } else if (representation.IsSmi() && value->IsUninitialized()) {
-        value_instruction = graph()->GetConstant0();
-        // Ensure that Constant0 is stored as smi.
+      } else if (representation.IsSmi()) {
+        value_instruction = value->IsUninitialized()
+            ? graph()->GetConstant0()
+            : Add<HConstant>(value);
+        // Ensure that value is stored as smi.
         access = access.WithRepresentation(representation);
       } else {
         value_instruction = Add<HConstant>(value);
Index: test/mjsunit/regress/regress-crbug-345715.js
diff --git a/test/mjsunit/regress/regress-check-eliminate-loop-phis.js b/test/mjsunit/regress/regress-crbug-345715.js
similarity index 50%
copy from test/mjsunit/regress/regress-check-eliminate-loop-phis.js
copy to test/mjsunit/regress/regress-crbug-345715.js
index 3791c35f71ccfc50dd384978e449103b39f6bff7..a3753417dfb6f8440ec36f883dc6ac1be4a6c8ce 100644
--- a/test/mjsunit/regress/regress-check-eliminate-loop-phis.js
+++ b/test/mjsunit/regress/regress-crbug-345715.js
@@ -4,18 +4,23 @@

 // Flags: --allow-natives-syntax

+a = {y:1.5};
+a.y = 0;
+b = a.y;
+c = {y:{}};
+
 function f() {
-  var o = {x:1};
-  var y = {y:2.5, x:0};
-  var result;
-  for (var i = 0; i < 2; i++) {
-    result = o.x + 3;
-    o = y;
-  }
-  return result;
+  return 1;
+}
+
+function g() {
+  var e = {y: b};
+  var d = {x:f()};
+  var d = {x:f()};
+  return [e, d];
 }

-f();
-f();
-%OptimizeFunctionOnNextCall(f);
-assertEquals(3, f());
+g();
+g();
+%OptimizeFunctionOnNextCall(g);
+assertEquals(1, g()[1].x);


--
--
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