Fix missing GVN flag for new-space promotion.

R=vegorov@chromium.org
BUG=chromium:123919
TEST=mjsunit/regress/regress-123919

Review URL: https://chromiumcodereview.appspot.com/10119016

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@11382 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 73814e75
...@@ -1223,6 +1223,7 @@ class HChange: public HUnaryOperation { ...@@ -1223,6 +1223,7 @@ class HChange: public HUnaryOperation {
SetFlag(kUseGVN); SetFlag(kUseGVN);
if (deoptimize_on_undefined) SetFlag(kDeoptimizeOnUndefined); if (deoptimize_on_undefined) SetFlag(kDeoptimizeOnUndefined);
if (is_truncating) SetFlag(kTruncatingToInt32); if (is_truncating) SetFlag(kTruncatingToInt32);
if (to.IsTagged()) SetGVNFlag(kChangesNewSpacePromotion);
} }
virtual HValue* EnsureAndPropagateNotMinusZero(BitVector* visited); virtual HValue* EnsureAndPropagateNotMinusZero(BitVector* visited);
...@@ -1348,6 +1349,7 @@ class HStackCheck: public HTemplateInstruction<1> { ...@@ -1348,6 +1349,7 @@ class HStackCheck: public HTemplateInstruction<1> {
HStackCheck(HValue* context, Type type) : type_(type) { HStackCheck(HValue* context, Type type) : type_(type) {
SetOperandAt(0, context); SetOperandAt(0, context);
SetGVNFlag(kChangesNewSpacePromotion);
} }
HValue* context() { return OperandAt(0); } HValue* context() { return OperandAt(0); }
...@@ -1938,6 +1940,7 @@ class HUnaryMathOperation: public HTemplateInstruction<2> { ...@@ -1938,6 +1940,7 @@ class HUnaryMathOperation: public HTemplateInstruction<2> {
case kMathAbs: case kMathAbs:
set_representation(Representation::Tagged()); set_representation(Representation::Tagged());
SetFlag(kFlexibleRepresentation); SetFlag(kFlexibleRepresentation);
SetGVNFlag(kChangesNewSpacePromotion);
break; break;
case kMathSqrt: case kMathSqrt:
case kMathPowHalf: case kMathPowHalf:
...@@ -1946,6 +1949,7 @@ class HUnaryMathOperation: public HTemplateInstruction<2> { ...@@ -1946,6 +1949,7 @@ class HUnaryMathOperation: public HTemplateInstruction<2> {
case kMathCos: case kMathCos:
case kMathTan: case kMathTan:
set_representation(Representation::Double()); set_representation(Representation::Double());
SetGVNFlag(kChangesNewSpacePromotion);
break; break;
default: default:
UNREACHABLE(); UNREACHABLE();
...@@ -3166,6 +3170,7 @@ class HPower: public HTemplateInstruction<2> { ...@@ -3166,6 +3170,7 @@ class HPower: public HTemplateInstruction<2> {
SetOperandAt(1, right); SetOperandAt(1, right);
set_representation(Representation::Double()); set_representation(Representation::Double());
SetFlag(kUseGVN); SetFlag(kUseGVN);
SetGVNFlag(kChangesNewSpacePromotion);
} }
HValue* left() { return OperandAt(0); } HValue* left() { return OperandAt(0); }
...@@ -4335,6 +4340,7 @@ class HTransitionElementsKind: public HTemplateInstruction<1> { ...@@ -4335,6 +4340,7 @@ class HTransitionElementsKind: public HTemplateInstruction<1> {
SetFlag(kUseGVN); SetFlag(kUseGVN);
SetGVNFlag(kChangesElementsKind); SetGVNFlag(kChangesElementsKind);
SetGVNFlag(kChangesElementsPointer); SetGVNFlag(kChangesElementsPointer);
SetGVNFlag(kChangesNewSpacePromotion);
set_representation(Representation::Tagged()); set_representation(Representation::Tagged());
} }
...@@ -4396,6 +4402,7 @@ class HStringCharCodeAt: public HTemplateInstruction<3> { ...@@ -4396,6 +4402,7 @@ class HStringCharCodeAt: public HTemplateInstruction<3> {
set_representation(Representation::Integer32()); set_representation(Representation::Integer32());
SetFlag(kUseGVN); SetFlag(kUseGVN);
SetGVNFlag(kDependsOnMaps); SetGVNFlag(kDependsOnMaps);
SetGVNFlag(kChangesNewSpacePromotion);
} }
virtual Representation RequiredInputRepresentation(int index) { virtual Representation RequiredInputRepresentation(int index) {
...@@ -4427,6 +4434,7 @@ class HStringCharFromCode: public HTemplateInstruction<2> { ...@@ -4427,6 +4434,7 @@ class HStringCharFromCode: public HTemplateInstruction<2> {
SetOperandAt(1, char_code); SetOperandAt(1, char_code);
set_representation(Representation::Tagged()); set_representation(Representation::Tagged());
SetFlag(kUseGVN); SetFlag(kUseGVN);
SetGVNFlag(kChangesNewSpacePromotion);
} }
virtual Representation RequiredInputRepresentation(int index) { virtual Representation RequiredInputRepresentation(int index) {
...@@ -4528,6 +4536,7 @@ class HFastLiteral: public HMaterializedLiteral<1> { ...@@ -4528,6 +4536,7 @@ class HFastLiteral: public HMaterializedLiteral<1> {
boilerplate_(boilerplate), boilerplate_(boilerplate),
total_size_(total_size) { total_size_(total_size) {
SetOperandAt(0, context); SetOperandAt(0, context);
SetGVNFlag(kChangesNewSpacePromotion);
} }
// Maximum depth and total number of elements and properties for literal // Maximum depth and total number of elements and properties for literal
...@@ -4563,6 +4572,7 @@ class HArrayLiteral: public HMaterializedLiteral<1> { ...@@ -4563,6 +4572,7 @@ class HArrayLiteral: public HMaterializedLiteral<1> {
length_(length), length_(length),
boilerplate_object_(boilerplate_object) { boilerplate_object_(boilerplate_object) {
SetOperandAt(0, context); SetOperandAt(0, context);
SetGVNFlag(kChangesNewSpacePromotion);
} }
HValue* context() { return OperandAt(0); } HValue* context() { return OperandAt(0); }
...@@ -4603,6 +4613,7 @@ class HObjectLiteral: public HMaterializedLiteral<1> { ...@@ -4603,6 +4613,7 @@ class HObjectLiteral: public HMaterializedLiteral<1> {
fast_elements_(fast_elements), fast_elements_(fast_elements),
has_function_(has_function) { has_function_(has_function) {
SetOperandAt(0, context); SetOperandAt(0, context);
SetGVNFlag(kChangesNewSpacePromotion);
} }
HValue* context() { return OperandAt(0); } HValue* context() { return OperandAt(0); }
...@@ -4664,6 +4675,7 @@ class HFunctionLiteral: public HTemplateInstruction<1> { ...@@ -4664,6 +4675,7 @@ class HFunctionLiteral: public HTemplateInstruction<1> {
: shared_info_(shared), pretenure_(pretenure) { : shared_info_(shared), pretenure_(pretenure) {
SetOperandAt(0, context); SetOperandAt(0, context);
set_representation(Representation::Tagged()); set_representation(Representation::Tagged());
SetGVNFlag(kChangesNewSpacePromotion);
} }
HValue* context() { return OperandAt(0); } HValue* context() { return OperandAt(0); }
......
// Copyright 2012 the V8 project authors. All rights reserved.
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following
// disclaimer in the documentation and/or other materials provided
// with the distribution.
// * Neither the name of Google Inc. nor the names of its
// contributors may be used to endorse or promote products derived
// from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// Flags: --allow-natives-syntax --gc-global
function g(max,val) {
this.x = 0;
for (var i = 0; i < max; i++) {
this.x = i/100;
}
this.val = val;
}
function f(max) {
var val = 0.5;
var obj = new g(max,val);
assertSame(val, obj.val);
}
f(1);
f(1);
%OptimizeFunctionOnNextCall(f);
f(200000);
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment