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

BUG=345715
LOG=N
R=verwaest@chromium.org

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@19535 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
ishell@chromium.org 2014-02-25 09:55:02 +00:00
parent 6eb2d35870
commit 6c1659becf
2 changed files with 31 additions and 3 deletions

View File

@ -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);

View File

@ -0,0 +1,26 @@
// Copyright 2014 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Flags: --allow-natives-syntax
a = {y:1.5};
a.y = 0;
b = a.y;
c = {y:{}};
function f() {
return 1;
}
function g() {
var e = {y: b};
var d = {x:f()};
var d = {x:f()};
return [e, d];
}
g();
g();
%OptimizeFunctionOnNextCall(g);
assertEquals(1, g()[1].x);