Revision: 11382
Author: [email protected]
Date: Thu Apr 19 00:49:11 2012
Log: Fix missing GVN flag for new-space promotion.
[email protected]
BUG=chromium:123919
TEST=mjsunit/regress/regress-123919
Review URL: https://chromiumcodereview.appspot.com/10119016
http://code.google.com/p/v8/source/detail?r=11382
Added:
/branches/bleeding_edge/test/mjsunit/regress/regress-123919.js
Modified:
/branches/bleeding_edge/src/hydrogen-instructions.h
=======================================
--- /dev/null
+++ /branches/bleeding_edge/test/mjsunit/regress/regress-123919.js Thu Apr
19 00:49:11 2012
@@ -0,0 +1,47 @@
+// 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);
=======================================
--- /branches/bleeding_edge/src/hydrogen-instructions.h Wed Apr 18 02:38:45
2012
+++ /branches/bleeding_edge/src/hydrogen-instructions.h Thu Apr 19 00:49:11
2012
@@ -1223,6 +1223,7 @@
SetFlag(kUseGVN);
if (deoptimize_on_undefined) SetFlag(kDeoptimizeOnUndefined);
if (is_truncating) SetFlag(kTruncatingToInt32);
+ if (to.IsTagged()) SetGVNFlag(kChangesNewSpacePromotion);
}
virtual HValue* EnsureAndPropagateNotMinusZero(BitVector* visited);
@@ -1348,6 +1349,7 @@
HStackCheck(HValue* context, Type type) : type_(type) {
SetOperandAt(0, context);
+ SetGVNFlag(kChangesNewSpacePromotion);
}
HValue* context() { return OperandAt(0); }
@@ -1938,6 +1940,7 @@
case kMathAbs:
set_representation(Representation::Tagged());
SetFlag(kFlexibleRepresentation);
+ SetGVNFlag(kChangesNewSpacePromotion);
break;
case kMathSqrt:
case kMathPowHalf:
@@ -1946,6 +1949,7 @@
case kMathCos:
case kMathTan:
set_representation(Representation::Double());
+ SetGVNFlag(kChangesNewSpacePromotion);
break;
default:
UNREACHABLE();
@@ -3166,6 +3170,7 @@
SetOperandAt(1, right);
set_representation(Representation::Double());
SetFlag(kUseGVN);
+ SetGVNFlag(kChangesNewSpacePromotion);
}
HValue* left() { return OperandAt(0); }
@@ -4335,6 +4340,7 @@
SetFlag(kUseGVN);
SetGVNFlag(kChangesElementsKind);
SetGVNFlag(kChangesElementsPointer);
+ SetGVNFlag(kChangesNewSpacePromotion);
set_representation(Representation::Tagged());
}
@@ -4396,6 +4402,7 @@
set_representation(Representation::Integer32());
SetFlag(kUseGVN);
SetGVNFlag(kDependsOnMaps);
+ SetGVNFlag(kChangesNewSpacePromotion);
}
virtual Representation RequiredInputRepresentation(int index) {
@@ -4427,6 +4434,7 @@
SetOperandAt(1, char_code);
set_representation(Representation::Tagged());
SetFlag(kUseGVN);
+ SetGVNFlag(kChangesNewSpacePromotion);
}
virtual Representation RequiredInputRepresentation(int index) {
@@ -4528,6 +4536,7 @@
boilerplate_(boilerplate),
total_size_(total_size) {
SetOperandAt(0, context);
+ SetGVNFlag(kChangesNewSpacePromotion);
}
// Maximum depth and total number of elements and properties for literal
@@ -4563,6 +4572,7 @@
length_(length),
boilerplate_object_(boilerplate_object) {
SetOperandAt(0, context);
+ SetGVNFlag(kChangesNewSpacePromotion);
}
HValue* context() { return OperandAt(0); }
@@ -4603,6 +4613,7 @@
fast_elements_(fast_elements),
has_function_(has_function) {
SetOperandAt(0, context);
+ SetGVNFlag(kChangesNewSpacePromotion);
}
HValue* context() { return OperandAt(0); }
@@ -4664,6 +4675,7 @@
: shared_info_(shared), pretenure_(pretenure) {
SetOperandAt(0, context);
set_representation(Representation::Tagged());
+ SetGVNFlag(kChangesNewSpacePromotion);
}
HValue* context() { return OperandAt(0); }
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev